Repository navigation
fix: a session's Stop hook ends its working mark - #878
Merged
Merged
Conversation
added 2 commits
December 1, 2026 19:59
A background session that ends its turn while a job of its own runs on (a watch started with run_in_background, a Monitor) can stay listed busy/working by `claude agents --json` for as long as the job runs. The task's page then said "Claude is working" for over an hour after the turn ended, and the task read as stuck. ClaudeActivity now takes the Stop hooks' times as the session cap already does (ClaudeRunning.TurnEndedByHook): a session whose Stop came after its last prompt is not working, whatever the list says. The two-poll hold still applies, and the next prompt makes it working again. *opus5.5*
With the working mark now idle once a session's Stop hook ends its turn, the page shows no Stop button for it. Compact and Clear still refused such a session with "press Stop first", leaving nothing to press. They now use the same rule as the mark, and task overview reports a session busy only when the mark says it is working. *opus5.5*
petre-c
force-pushed
the
worktree-working-mark-follows-stop-hook
branch
from
December 1, 2026 16:00
54618fa to
00ad426
Compare
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.
Deskbar task c33113c5
A task's page said "Claude is working" for more than an hour after its session had finished its turn, so the task looked stuck.
What happened: the /iam-check-data session ended its turn at 13:22:05 UTC. Its Stop hook fired, and Claude Code sent its idle notice a minute later. A background watch of its own kept running, and the whole time
claude agents --jsonlisted the session asstatus: busy, state: working, not thebusy/donethatClaudeAgent.TurnOverexpects. The session cap already ignores that row when the Stop hook says otherwise (ClaudeRunning.TurnEndedByHook, task 777a8519). The working mark did not.The change:
ClaudeActivity.Nextnow getsTaskService.TurnsEnded. A session whose Stop hook came after its last prompt does not count as working, whatever the list says. The two-poll hold still applies, so the mark turns idle about 30 seconds after the Stop. The next prompt (a comment, a wake, the watch's own notice) makes it working again. A session Deskbar has heard no hooks from falls back to the list. The halo, the Working filter, the Stop button and the thread's session states all read this one record.task overviewnow reports a session as busy only when the mark says it is working, so the manager sees what the page shows.Left out on purpose: the went-quiet check (
StalledTasks) still reads raw busy. If those sessions counted as quiet, Deskbar would nudge and hand back sessions that are only waiting on their own watch. That needs its own decision, so it is filed as a follow-up note.Tests: four new
ClaudeActivityTests. The Release build passes with-warnaserror. Core tests: 6230 passed, 0 failed.Release notes
opus5.5