Repository navigation
fix(planner): enforce run budgets and stop revive loops (#705, #714) - #726
Merged
Merged
Conversation
Review of #714 found three issues before it could ship in 0.7.1. The Main Agent chat path used reviveTaskFromAgent, which refuses a timed-out task by logging only, so an operator could no longer resume from the chat and got no explanation. The chat is an explicit operator turn: it uses reviveTask like the console again, and the admission guards still refuse a settling or budget-exhausted task. Automatic agent revival through delegateToTask keeps the stricter guard. TestBudgetStopReservesPlannerRoundCost pre-marked the wrap-up before calling budgetStop, so it passed because wrap-up was already set, not because the planner+worker reservation worked. It now calls budgetStop from Plan alone, with a bounded context that only shortens the settle wait. README documents the planner+worker reservation, the skipped final judgment past the hard ceiling, and which revivals are refused. Verified: gofmt on the committed blobs, go build ./..., go vet ./..., and the full ./agent ./server suites on disposable PostgreSQL 16, including TestHardExhaustedBudgetSkipsFinalPlannerRound.
esp0xdeadbeef
pushed a commit
to esp0xdeadbeef/ARTEX
that referenced
this pull request
Nov 30, 2026
upstream: Merge pull request BaaRai#726 from BaaRai/integr/705-planner-budget overlay: nix overlay: refresh npm-deps and vendor hashes for upstream 0529f6b files: flake.nix flake.lock nix .github/workflows/update-flake-lock.yml .github/workflows/sync-upstream.yml scripts/sync-upstream.sh
esp0xdeadbeef
pushed a commit
to esp0xdeadbeef/ARTEX
that referenced
this pull request
Nov 30, 2026
upstream: Merge pull request BaaRai#726 from BaaRai/integr/705-planner-budget overlay: sync-upstream: extend our previous sync commit instead of replacing it files: flake.nix flake.lock nix .github/workflows/update-flake-lock.yml .github/workflows/sync-upstream.yml scripts/sync-upstream.sh
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.
Summary
Ships the #705 fix from #714 by @brixtonpham in 0.7.1, rebased on current main with three review corrections. The cherry-pick keeps the contributor's authorship; the correction commit is mine.
#705: a task could exhaust its run budget while planner rounds kept starting, and an agent-driven
set_goalscould revive a timed-out task indefinitely. The report reached 18.4M tokens against a 250k cap. This branch:BudgetState.PlanreplacesDispatchat the round gate);PlannerMeter), clamps its turns, blocks intent/goal mutations on forced wrap-up or exhaustion, and stops retrying onceErrTaskBudgetExhaustedis raised;Review corrections on top
server/server.go). fix(server,agent): enforce planner run budgets and stop revive loops (#705) #714 routed the Main Agent chat throughreviveTaskFromAgent, which refuses a timed-out task by logging only: an operator could no longer resume from the chat and got no explanation. The chat is an explicit operator turn, so it usesreviveTasklike the console again. The admission guards still refuse a settling or budget-exhausted task, and agent delegation keeps the stricter guard.server/engine_budget_test.go).TestBudgetStopReservesPlannerRoundCostpre-marked the wrap-up before callingbudgetStop, so it passed because wrap-up was already set, not because the reservation worked. It now callsbudgetStopfromPlanalone. I verified the test fails when the gate is reverted tost.Dispatchand passes withst.Plan.Verification
go build ./...andgo vet ./...: PASS.go test -count=1 ./agent ./serveron disposable PostgreSQL 16:agent35.3s,server125.3s, PASS.go test -race -count=1 ./agent ./server:agent31.7s,server222.8s, PASS.TestHardExhaustedBudgetSkipsFinalPlannerRound,TestBudgetStopReservesPlannerRoundCost,TestReviveGuardsPreventTimeoutSettlingAndBudgetLoops: PASS.st.DispatchmakesTestBudgetStopReservesPlannerRoundCostfail, so the test is not self-fulfilling any more.Known limit, documented rather than changed
With a token-only budget and
MaxTurns = 0, a normal round's turn allowance stays unlimited, so it can consume the wrap-up reserve before the provider's hard ceiling stops it. The effect is that the final judgment is skipped more often, not unbounded spend. Documented in the README; a token-to-turn estimate would be a separate change.Not included
The recommended, non-blocking items from the review: a 409 status for refusal paths, a dedicated cancellation cause, and the turn-cap change above. #714 itself will be closed in favour of this branch once merged.
Ships in 0.7.1; the changelog entry is in this branch.