Skip to content

A job budget stop explains itself to an idle chat - #2388

Merged
santoshkumarradha merged 5 commits into
app/v3from
c52/budget-notice-idle-owner
Nov 5, 2026
Merged

santoshkumarradha merged 5 commits into
app/v3from
c52/budget-notice-idle-owner

Conversation

@santoshkumarradha

Copy link
Copy Markdown
Member

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

  • The watcher passes the refusal into the stop.
  • When the stop finishes, the chat records it once and sends it to anyone watching the chat. This happens before a new message can start work again.
  • Product changes: job_budget.go +1/-1, stopwork.go +14/-6.

Tests

  • TestBudgetStopExplainsIdleCrewOwner failed 3 of 3 on app/v3 before this change, with "idle owner lost budget notice after worker stop".
  • TestBudgetStopNoticeRecordedOnce checks that the notice appears exactly once, and that a person's Stop records no budget notice.
  • Both new tests: 20 runs, EXIT=0. go vet ./internal/session: EXIT=0.
  • Two whole runs of internal/session each failed only on tests that also fail on app/v3 without this change: TestNoRoadInTheTaskEngineHasMoreEndingsThanItsLedgerRow, TestNoRoadInTheMemoryEngineHasMoreEndingsThanTheCeiling, TestTheFixedPrefixStaysUnderItsBudget, TestTheLeanPrefixStaysUnderItsBudget and TestProgramHoldClassifiesEveryRegisteredChatTool.

Limits

This covers the job budget. The daily spending limit stop is changed in the hard cap PR (#2364).

🤖 Generated with Claude Code

santoshkumarradha and others added 3 commits November 5, 2026 03:49
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]>
@santoshkumarradha
santoshkumarradha marked this pull request as ready for review November 5, 2026 09:09
@santoshkumarradha
santoshkumarradha merged commit 4e7710a into app/v3 Nov 5, 2026
@santoshkumarradha
santoshkumarradha deleted the c52/budget-notice-idle-owner branch November 5, 2026 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant