feat: summarize agent run logs in harness status - #68
Samyra312007 wants to merge 4 commits into
Conversation
- add harness/runs.py: a read-only parser that maps claude's result line and codex's turn.completed line onto one shared row shape, with ralph's framing lines giving iterations and elapsed minutes for any agent; lines are found by type, never position - harness status now renders a newest-first table (date, agent, run, iterations, minutes, tokens in/out, cache read/write, cost, duration, stop reason); --verbose adds each agent's last message and log path; a fact an agent never reports shows as a dash, never a zero - parse defensively: unparseable lines, non-object lines, and unreadable files are skipped, so one weird log cannot crash status; totals must be finite numbers (hypothesis caught unicode-digit junk parsing as float) - commit real claude/codex sample logs as fixtures under harness/tests/logs and cover the reader with unit and hypothesis property tests in harness/tests/test_runs.py; run_worker is untouched
|
Local docs-only commit d832ee6 is ready: docs/PROJECT_STATUS.md and docs/specs/base.md exactly match origin/main. Normal push was blocked by the mandatory pre-push gate after xdist/environment test_cli.py failures (96.1% coverage); remote PR head remains f646f01. No bypass was used. |
|
Normal push to git@github.com:Samyra312007/loopgate_harness.git was attempted; mandatory pre-push gate rejected it. 4 test_cli.py failures under xdist/environment (template temp.pyproject missing, uv not found, plus coverage 96.1%), so remote head remains f646f01; no bypass used. |
|
GitHub API blob writes are forbidden (403 Resource not accessible by integration), so cannot update contributor fork via connector. PR #68 currently still shows docs edits and is clean/mergeable at old head. |
Per maintainer request in PR rxdt#68 — the feature docs under docs/ belong to the upstream repo's workflow, not the contributor fork. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
|
ca65ae2 on the PR head resets docs/PROJECT_STATUS.md and docs/specs/base.md to match main byte-for-byte (same blob SHAs as origin/main ), replacing the local d832ee6 which is unreachable to anyone without your clone. The full pre-push gate is green on this head: test, coverage, ruff ×2, pylint, types, security, complexity, audit all PASSED. For the record, the xdist/coverage failures you hit reproduce only when the gate runs without the venv activated ( .venv/bin missing from PATH breaks tool resolution in subprocesses) worth a note in the README if others hit it. |
Closes #9 harness status no longer just counts log files. It reads back the JSONL that harness run already writes under scratchpad/runs/ and renders a newest-first table of finished runs: iterations, tokens in/out with the cache split, cost, duration, and why the run stopped. --verbose adds each agent's last message and the log path. run_worker is untouched; this feature is strictly read-only.
Decision: our logs (Option A), not the agent's native session logs
The issue asks for the call to be made and argued in the PR. Option A scratchpad/runs/ , because:
Codex's native logs would have been a duplicate of what we already captured, so there was nothing to gain.
Before / after
Before, the only read-back was a file count:
7 run log(s) in /repo/scratchpad/runs
newest:
/repo/scratchpad/runs/20260902/claude/0004.jsonl
Now ( harness status ):
DATE AGENT RUN ITERS MIN TOKENS IN TOKENS OUT CACHE R CACHE W COST MS STOP
2026-09-02T05:38 codex 0003 1 1 15376 142 9600 0 - - -
2026-09-02T06:34 claude 0003 1 0 2 13 5903 13757 $0.14 1800 end_turn
harness status --verbose appends a second table with the agent's own last words and the file to open:
DATE AGENT RUN LAST MESSAGE LOG
2026-09-02T05:38 codex 0003 Hi —
codex-0003here. No edits made. No big issues .../20260902/codex/0003.jsonl2026-09-02T06:34 claude 0003 I don't have access to my session ID. .../20260902/claude/0003.jsonl
An empty repo keeps the old one-line receipt, 0 run log(s) in ... .
How it reads the logs
All parsing lives in a new module, harness/runs.py (~190 lines; cli.py only got its status body rewritten) — per the challenge in the issue, since cli.py is at its complexity cap.
[tool.harness.agents]#49) will get.What this deliberately does not do
Testing
No test runs an agent or spends a cent, per the issue:
Notes