Skip to content

fix: a session's Stop hook ends its working mark - #878

Merged
petre-c merged 2 commits into
mainfrom
worktree-working-mark-follows-stop-hook
Dec 1, 2026
Merged

petre-c merged 2 commits into
mainfrom
worktree-working-mark-follows-stop-hook

Conversation

@petre-c

@petre-c petre-c commented Dec 1, 2026

Copy link
Copy Markdown

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 --json listed the session as status: busy, state: working, not the busy/done that ClaudeAgent.TurnOver expects. 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.Next now gets TaskService.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.
  • Compact and Clear checked the raw row and answered "press Stop first", but the page no longer shows a Stop button for such a session. They now follow the same rule.
  • task overview now 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

  • A task no longer shows "Claude is working" after its session has finished its turn and is only waiting on a background job of its own, such as a watch. Compact and Clear work on such a session again, without asking you to press Stop first.

opus5.5

Petre Chitashvili 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
petre-c force-pushed the worktree-working-mark-follows-stop-hook branch from 54618fa to 00ad426 Compare December 1, 2026 16:00
@petre-c
petre-c merged commit 7b9c07b into main Dec 1, 2026
1 of 2 checks passed
@petre-c
petre-c deleted the worktree-working-mark-follows-stop-hook branch December 1, 2026 16:01
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