feat: add cost and timeout limits to headless runs - #25
Merged
Merged
Conversation
Strip ANSI styling before matching option names, using the existing help-test pattern so CI preserves the same validation assertions.
Mouhand-Kaddo
changed the base branch from
main
to
worktree/rapid-valley-cbfe
September 29, 2026 08:24
Mouhand-Kaddo
added this pull request to stack #28
September 29, 2026 08:24
This was referenced Sep 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
--max-costand--timeoutto single-prompt headless runs. Keep max turns at exit 3 and reserve provider codes 4–9; context overflow now exits 10, local cost limit or unknown spend exits 11, and execution timeout exits 12.All model calls share cost admission, including workers, subagents, compaction, learning, reviews, and retries. Unknown prices or spend close admission. Already admitted calls can exceed the threshold. The timeout covers MCP connection and active execution; synchronous startup and cleanup remain outside its deadline. Remove the unused
on_overflowsetting and retain partial responses on limits.Regression coverage includes concurrent accounting, unknown prices, cancellation, distinct exits, and cleanup. The following JSON layer preserves limit stop reasons and known partial usage.
Tracks LaFabrique #46.
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 #24. PR #22 is merged.
Merged
mainat74a5e28into 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,192 local tests pass on Linux/Python 3.14.3. All four Linux/macOS Python 3.13/3.14 CI jobs pass on
48ca007.