Repository navigation
A job budget stop explains itself to an idle chat - #2388
Merged
Merged
Conversation
The job budget watcher discarded its refusal before the epoch-guarded stop, and an idle owner had no turn to explain the stop. Carry the notice separately from producer stop reasons and record it once after owned work settles. Cover idle and active owners, a refusing owner call, and person stops. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
santoshkumarradha
marked this pull request as ready for review
November 5, 2026 09:09
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.
What a person sees
A job budget can stop a crew while the chat that started it is idle, meaning its own reply has finished and only the crew's worker is still running. Until now that chat never recorded why the work stopped. The person saw the crew stop with no reason given.
Now the chat records "job budget reached" once, after the stopped work has finished stopping. It does so whether the chat was idle or still replying. A person's own Stop adds no budget notice.
Cause
internal/session/job_budget.go: the budget watcher stopped the work but threw away the refusal, so the reason never reached the chat.internal/session/stopwork.go: when the stop finished, nothing recorded a notice for a chat that wasn't replying.Fix
job_budget.go+1/-1,stopwork.go+14/-6.Tests
TestBudgetStopExplainsIdleCrewOwnerfailed 3 of 3 on app/v3 before this change, with "idle owner lost budget notice after worker stop".TestBudgetStopNoticeRecordedOncechecks that the notice appears exactly once, and that a person's Stop records no budget notice.go vet ./internal/session: EXIT=0.internal/sessioneach failed only on tests that also fail on app/v3 without this change:TestNoRoadInTheTaskEngineHasMoreEndingsThanItsLedgerRow,TestNoRoadInTheMemoryEngineHasMoreEndingsThanTheCeiling,TestTheFixedPrefixStaysUnderItsBudget,TestTheLeanPrefixStaysUnderItsBudgetandTestProgramHoldClassifiesEveryRegisteredChatTool.Limits
This covers the job budget. The daily spending limit stop is changed in the hard cap PR (#2364).
🤖 Generated with Claude Code