Skip to content

do: a node re-dispatched after running out is given more room, never the identical grant - #1098

Closed
santoshkumarradha wants to merge 6 commits into
devfrom
fix/overrun-regrant
Closed

santoshkumarradha wants to merge 6 commits into
devfrom
fix/overrun-regrant

Conversation

@santoshkumarradha

Copy link
Copy Markdown
Member

What

A plan node that ran out of its token budget was released back to pending and re-dispatched with the byte-identical grant and brief, up to MaxOverrunRounds, and bought the same truncated ending each time (observed twice in one run, ~12 USD).

  • cmd/codeaf/subharness.go: regrantAfterRunningOut grows the token grant by three halves per re-dispatch, never above overrunGrantCeiling (four flat leaf grants; a fan-in that measured more keeps every token it measured). Wired at the dispatch grant in chat.go; the leaf's wall follows the larger grant.
  • internal/resident/runner.go: a re-dispatch that banks nothing beyond what the hand-on release journaled (store.ReleasedTurnsFor) is failed with the refusal named (outOfRoomRefusedFailure) instead of sent round again.
  • internal/store/lifecycle.go: ReleasedTurnsFor, NodeRedispatches read off the journal.
  • --json envelope: redispatches (absent when none), counted per node of the run's own session; manual row added.
  • Tests: TestARedispatchIsGrantedMoreRoomThanTheAttemptThatRanOut, TestAnExhaustedRedispatchThatBankedNothingNewFails, TestAnErrandCountsTheRedispatchesItsOwnNodesBought, envelope key test extended. Change note in docs/changes/unreleased/.

Verification

Spark job 20260917-094736-000551 on e689581ea, go test -count=1 ./cmd/codeaf/ ./internal/resident/... ./internal/store/...:

ok  cmd/codeaf          69.348s
ok  internal/resident   27.160s
ok  internal/store      23.067s

The only commit after that head renames the change note to this PR's number. Not merged; awaiting the owner's look.

🤖 Generated with Claude Code

@santoshkumarradha

Copy link
Copy Markdown
Member Author

Hi @AbirAbbas, please review as high priority.

@santoshkumarradha

santoshkumarradha commented Sep 17, 2026 •

Copy link
Copy Markdown
Member Author

Also internal/manual on head 85aae36c2: ok (Spark job 20260917-114912-000563), for the envelope row the manual gained.

santoshkumarradha and others added 6 commits September 17, 2026 09:01
…om than the attempt that ran out

Co-Authored-By: codeaf <agentfield-bot@users.noreply.github.com>
…de took, are readable off the journal

Co-Authored-By: codeaf <agentfield-bot@users.noreply.github.com>
…sent round again

Co-Authored-By: codeaf <agentfield-bot@users.noreply.github.com>
…ispatched in place

Co-Authored-By: codeaf <agentfield-bot@users.noreply.github.com>
Co-Authored-By: codeaf <agentfield-bot@users.noreply.github.com>
@santoshkumarradha
santoshkumarradha changed the base branch from santos/dev to dev September 17, 2026 13:04
@santoshkumarradha

Copy link
Copy Markdown
Member Author

Retargeted to dev at Santosh's request: the branch was rebased from santos/dev onto origin/dev (09299019b), same diff, and builds clean. Spark make pr-ready on this head is fleet job 20260917-130548-000567; result follows.

@santoshkumarradha

Copy link
Copy Markdown
Member Author

Correction: the Spark job for this head is 20260917-132058-000568 (cpu lane); 000567 was queued behind a stuck gpu-lane job and dropped.

@santoshkumarradha

Copy link
Copy Markdown
Member Author

Spark make pr-ready on head eafafb160 against origin/dev 09299019b: exit 0 (light gate + touched-package suites, fleet job 20260917-132058-000568, finished 13:37Z).

@santoshkumarradha
santoshkumarradha marked this pull request as draft September 17, 2026 14:23
@santoshkumarradha

Copy link
Copy Markdown
Member Author

Folded into #1093 (merged into feat/auto-crew at 5e7f0f0); this branch is kept for its history.

@santoshkumarradha
santoshkumarradha deleted the fix/overrun-regrant branch September 17, 2026 16:38
@santoshkumarradha santoshkumarradha added the bug Something the code does that it should not label Oct 3, 2026
@santoshkumarradha santoshkumarradha added this to the Reliable agent milestone Oct 3, 2026
@santoshkumarradha santoshkumarradha added the area:headless codeaf do and codeaf exec, runs with no screen label Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:headless codeaf do and codeaf exec, runs with no screen bug Something the code does that it should not

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant