refactor: split bot.py into runtime/dispatch/worker modules; add retry scheduler, route TTL, ack tracking, follow-up screener, structured event log, and test suite

This commit is contained in:
swaits committed 2026-04-16 13:47:17 -06:00
1 parent 9e6f171c5d
commit 228432f9e3
24 files changed
+3531 -434

No files matched your search

+37 -4
View File
@@ -6,12 +6,12 @@ default: run
_ensure_tools:
@mise trust --yes . 2>/dev/null; mise install --quiet
# Run the AI bot
# Run the AI bot (optionally pass a serial port: `just run /dev/ttyACM0`)
run *args: _ensure_tools
@uv run ai_bot.py {{args}}
# Run all checks (fmt, lint)
check: fmt-check lint
# Run the full gauntlet: format-check, lint, type-check, tests
check: fmt-check lint typecheck test
# Format code
fmt: _ensure_tools
@@ -21,6 +21,39 @@ fmt: _ensure_tools
fmt-check: _ensure_tools
@uv run ruff format --check .
# Lint
# Lint (ruff)
lint: _ensure_tools
@uv run ruff check .
# Auto-fix lint where possible
lint-fix: _ensure_tools
@uv run ruff check --fix .
# Static type check (pyright)
typecheck: _ensure_tools
@uv run pyright orac tests ai_bot.py
# Run the test suite
test *args: _ensure_tools
@uv run pytest {{args}}
# Run tests with verbose output
test-v: _ensure_tools
@uv run pytest -v
# Dump live metrics from a running bot (sends SIGUSR1 by PID; pass the pid)
metrics pid: _ensure_tools
@kill -USR1 {{pid}}
@echo "Sent SIGUSR1 to PID {{pid}}; check the bot's stderr for METRICS line"
# Tail the structured event log (JSONL)
events:
@tail -F ~/.donglora/orac-events.jsonl
# Pretty-print the events log with jq
events-pretty:
@tail -F ~/.donglora/orac-events.jsonl | jq .
# Clean cached artifacts
clean:
@rm -rf .pytest_cache .ruff_cache __pycache__ orac/__pycache__ tests/__pycache__