Plan C: live budget downgrade + concurrency proof + documented run - #7
Merged
Conversation
This was referenced Jul 25, 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.
Plan C — Evidence: live budget downgrade, collision proof, documented run
Final engine plan (Plan A #5 and Plan B #6 are already merged to
main). Closes the remaining evidence gaps so every resume claim is not just implemented but proven.What this proves
config/budget.yamldowngrade_pathsare injected into the state server; at claim time, once spend crosses 85%, the model is swapped.test_budget_downgrade_live.pyruns a real pipeline at--budget-limit 5.0and asserts the Test-phase agents are downgraded (qa_test→gpt-4o-mini,security→claude-3-5-haiku-20241022) while skip-listed critical agents keep theirs. The crossing is deterministic (Test opens only after all Code spend commits, in the same transaction).test_concurrency_no_collision.pydrives 8 real worker subprocesses at a pool of 12 simultaneously-ready tasks, then inspects the persisted SQLite directly:done == total == distinct == spend_rows == state_rows == 12. These assertions are gated by the store's version/owner guards (not by schema), so they genuinely prove exactly-once, collision-free effect.docs/runs/2026-07-24/holds a real run'srun-summary.md/snapshot.json/dag.md: statusdone, all six phasescomplete, gateapproved, and the live Test-phase downgrade. (The final reviewer re-derived the downgrade math across all 13 tasks to confirm it's a genuine DB capture, not hand-written.)Two real bugs the stress test surfaced (and fixed)
Store.create_runhardcoded"clarify"as the entry phase → generalized to the order-0 phase (phase_names[0]); behavior-identical for the six-phase config (enforced byPhasesConfig's order-0 validation).Also
APPFORGE_PHASESenv override for the phases-config path (enables the synthetic stress config to drive real subprocess workers).ruff check0 errors,black --checkclean,pytest tests/at 87.65% coverage (gate 70%).Out of scope (Plan D)
Retiring the legacy LangGraph orchestrator + repointing
backend/main.py+ migrating its ~25 coupled tests — a destructive cutover the design scoped as its own gated PR. Deliberately excluded so this evidence work stays out of that blast radius.