Skip to content

feat: add JSON output for noninteractive runs - #26

Merged
wowi42 merged 6 commits into
mainfrom
feat/json-output
Sep 30, 2026
Merged

wowi42 merged 6 commits into
mainfrom
feat/json-output

Conversation

@Mouhand-Kaddo

@Mouhand-Kaddo Mouhand-Kaddo commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Add --output-format json for prompt, loop, and chain runs. Emit one object containing final_text, stop_reason, turns, input/output tokens, cost, model, and usage_incomplete; progress and diagnostics remain on stderr. Unknown metrics are null, and answers remain strings even when they contain JSON.

Reconcile reporting with per-run overrides, provider exits, and execution limits. Count worker, subagent, compaction, learning, and review usage without duplicating resumed delegates. Preserve known usage after failed auxiliary calls and cancellation, and retain cost-limit/timeout outcomes and partial responses.

Session reporting streams records and retains only usage/undo metadata. On a synthetic 64 MiB transcript, median peak Python allocation across three runs falls from 129.4 MiB to 1.14 MiB. This measures reporting allocations, not whole-process RSS or the factory workload. Regression tests cover bounded JSON reporting, undo/redo, auxiliary failures/cancellation, unknown pricing, limits, and text/JSON reasoning overrides.

Tracks LaFabrique #45. Factory adoption remains tracked in #80.

The foreground-shell timeout regression allows two seconds for startup on slow runners while retaining its timeout exit, shell-start, and terminated-process assertions.

Stack and validation

#23 → #24 → #25 → #26

Native GitHub stack #28. This PR targets PR #25. PR #22 is merged.

Merged main at 74a5e28 into the stack, retaining merged PR #22’s memory improvements and PR #27’s removal of automatic Exa/Context7 servers. Each updated branch retains its previous remote head and preceding stack layer through additive merges. Configured MCP servers remain supported.

Repaired the session-name mock at its lazy import location, used schema version 2 in non-persistence fixtures, and removed obsolete MCP flag assignments from the memory regression harness. All existing behavioral assertions are retained. Provider codes remain 4–9; context overflow, local cost limit/unknown spend, and execution timeout remain 10/11/12. The existing memory and usage-accounting implementation is unchanged.

Ruff lint and formatting pass; all 2,271 local tests pass on Linux/Python 3.14.3. All four Linux/macOS Python 3.13/3.14 CI jobs pass on 58a06c5.

Base automatically changed from feat/headless-run-limits to main September 29, 2026 12:56
@wowi42
wowi42 merged commit fdc4882 into main Sep 30, 2026
4 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants