You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(status): hold a Claude pane's queue through the turn a background task's notice begins - #3629
A message queued for a Claude Code pane could be typed into the turn Claude had just begun by itself because a background task ended (a subagent, a background command, a monitor, a workflow). Such a turn starts with no prompt of the person's and no send of the chat's, and for a moment herdr still reads the pane as idle, or says idle late for the turn before: the queue's gate let the message through, pasted and entered into the turn at work.
#3574 closed this race for a /loop wakeup and a scheduled task (#3494) and left it open for a task's notice (its bound 7), where it is far more common: 573 such prompts in the session transcripts on this PC against 1 scheduled one. This PR arms the same rest-or-60-s hold for that turn, with #3574's mechanism and no new rule, as the merge pass asked. It has no issue of its own: #3574's bound 7 named it.
Change
One more entry arms the hold (server/claude-subagents.ts, three lines of code). The prompt of a notice's turn, which Claude Code 2.1.296 to 2.1.321 write as a user entry of the session's own with turnOrigin: "task_notification", now arms #3574's hold as the prompt of a scheduled turn does: selfResumed and the line filter in front of it (SELF_RESUMED_RE) take that turnOrigin too.
How it ends. In two ways and no other: a rest (turn_duration with a timestamp) written after the prompt, or 60 s (LOOP_HOLD_MS) after the prompt was read. A later notice prompt holds anew for its own 60 s. A prompt found already written at a transcript's first read holds for what is left of 60 s by its own timestamp. No word of herdr's begins, prevents or ends it.
Whoever ends it tells the queue: the tracker's 2 s poll, which keeps reading while a hold stands; a snapshot's replay that changes nothing; the read a status report makes of the pane's work; a send's own read of the hold.
Delivery reads the hold from the transcript as it is now three times: right before the paste (a hold found there types nothing and leaves the message queued), after the last read before the Enter, and inside the Enter write's guard. A hold found at the Enter sends no key: the paste stays in Claude's input line and the message is "not confirmed". Send now is not held.
server/core/status.ts and server/core/pending.ts change in comments only: both transpile to the same output as on main.
What arms nothing, each pinned by a test: the notice in Claude's queue (queue-operation enqueue and dequeue); a notice taken into a turn at work (queued_command, 283 here); a notice written as a user entry with no turnOrigin (17 here, none followed by an answer); a subagent's own entries; an entry that only quotes or carries the key; the prompt of a turn of any other origin: the person's, one begun on another session's message (turnOrigin: "peer"), one sent through the SDK ("sdk").
A clock set back (a few lines, one of #3574's three post-release items). The hold's 60 s were counted from the wall clock at the read that armed it, so a clock stepped back while a hold stood, with no rest written, kept the queue held for the step and the minute on top of it. Now:
a hold a poll finds over (its rest written, or its minute up) is over for good: a clock set back later does not make it hold again, told to no one;
a hold dated ahead of the clock (the clock was set back to before the hold began) is moved to the time of the poll that finds it so: it ends a minute after that poll at the latest;
a clock set back by less than the hold's age cannot be told from a clock that was not set back: the hold stands for what that clock leaves of its minute. Either way a hold ends within a minute of the first poll after the step, so one step back costs up to about two minutes of real time, not the step and a minute.
Notices arm the hold far more often than wakeups did, so it rides here.
Not in this PR: #3574's other two items. Each needs a rule of its own, not a few lines, so they stay for after the release:
(a) Two tasks fired: the first turn's rest clears the only recorded fire. What closes it is a hold that outlives a rest, which changes what a rest ends. The notice has the same shape (bound 2 below), and the same change would close both.
(c) /loop over a local slash command writes no end-of-turn entry. It needs another end for the hold, as does a session that writes no rest (Cost below).
Also for after the release: a turn begun on another session's message (bound 8).
Six LOW findings, dealt with in 91dbedc (tests), 9587643 (comments and the changelog fragment), 576db4f and 567f087 (the comment that gives the write lag, as more prompts were read live) and 3207ed2 (one sentence of the changelog fragment). No behaviour changed since bcb3fdf: the three source files transpile to the same output at every one of these commits.
The paste-left counts hold only for the stated timings. Confirmed twice. In the timed model with herdr 5 to 40 ms behind and RPCs of 2 to 10 ms the branch leaves more pastes uncommitted than main: 1,862 of 41,072 against 1,731 of 41,228 (tables under "A paste left in the input line"). And a new delivery test runs the steps the skeptic gave: a message queued behind a turn at work, a task that ends during that turn, herdr's idle word heard before the prompt of the notice's turn is written. The branch pastes and sends no Enter; on main the same test fails with keys Enter written into the notice's turn. One thing the model adds: by how the turn began, a turn begun at a rest leaves a paste about as often on main as on the branch with that quick herdr (main refuses the Enter on herdr's word), and the pastes the branch adds come from tasks that end in a pane at rest. This body now gives the counts for four sets of timings, and bound 2 gives when the prompt reaches the file, not only its date. Closing it takes a hold from a queued notice across the rest, a new arm: after the release.
Holds chain. Confirmed with the skeptic's probe (six notice turns of 5 s, 41 s apart, none writing a rest: the queue is held for 265 s without a break, then let go and told; on main nothing holds). Cost and the changelog fragment now say it. No code change.
What puts a session in the no-rest state. The skeptic's lead holds in my own scan and is named under Cost. Ending the hold on a stop_hook_summary is a third way to end it: after the release.
No test pinned which origins arm. The mutant that arms on any turnOrigin but the person's passed both files (169 and 164 pass). The test of the keys now writes a peer and an sdk prompt with the keys Claude Code writes on them and expects no hold: that mutant fails it, as do ones arming on peer alone, on sdk alone, or on an origin of the kind peer.
Changelog wording. "as after a /loop wakeup"; the fragment now also says a turn begun between a message's paste and its Enter leaves the text in Claude's input line, marked as not confirmed, that this can happen to a message that waited behind the turn the task ended during, and that the queue stays held while such turns keep beginning less than a minute apart.
Stale comments. The comments in server/core/status.ts and server/core/pending.ts that listed only a /loop wakeup and a scheduled task now name a background task's notice (the four the skeptic listed, and two more of the same kind).
A correction of my own. The transcript counts of the last body were too high: one project folder under ~/.claude/projects is a link to another, so five session files were read twice (a scan with the double read counts 821 notice prompts, 250 of them twice). Every count in this body reads each file once. The skeptic's counts match mine with the double read (58 of 815 begun at a rest; read once it is 32 of 573 prompts).
MEDIUM: the clamp did not close the clock case. It acted only while a hold stood. A hold that had run out its minute with no rest written kept its start, so a clock set back later made it hold again, and the poll that would have clamped it skipped the pane (its files unchanged), so nobody was told. A hold a poll finds over is now cleared (b4b8446, with tracker and hub tests).
LOW: the clamp's test pinned one step back only. Four steps are pinned now, to before the hold began and by less than its age (f4d1d47), and a poll that finds the clock gone on moves nothing (626fc47).
LOW: the status shown. Named under "Panes with no notice turn" below; no code change.
These three commits were not looked at by a skeptic again: the round that made them was cut off by the account's rate limit after its two source commits and its harness reruns, and the session that opens this PR finished the last test commit and compared the reruns itself (below).
For the owner's check
The wait. In a session whose Claude Code writes no end-of-turn entry, each notice's turn shorter than a minute holds the pane's queue until a minute after it began, and notices less than a minute apart keep it held. Here that is sessions that run named agents or message other sessions: 24 of their 80 notice turns would have cost a wait (a median of 39 s), against 0 of 276 in the other sessions on the same Claude Code. Send now is not held.
A paste left, not confirmed. A notice's turn that begins while a message is being typed leaves the text in Claude's input line. With a quick herdr the branch leaves more of them than main, where main typed the Enter into the turn instead.
Counts. The transcript counts are lower than in the last body, for the reason above.
Cost
A notice's turn that ends with no rest written holds the pane's queue until 60 s after its prompt was read, though herdr reads the pane idle (a minute from that read, plus up to 2 s for the timer's poll to tell the queue). While it lasts the pane shows herdr's status, the queued row reads "Next turn", and Send now still types and commits the message at once.
How often the hold costs a wait, in the session transcripts on this PC (Claude Code 2.1.296 to 2.1.321, each file read once, counted on 2026-11-11; the live sessions move a count by one or two between scans):
notice turns
wrote no rest
over inside their minute: the queue held with no turn at work
all 50 sessions
570
89 (15.6%)
28 (4.9%): a median of 36 s; 16 for 30 s or longer; 3 for 55 s or longer; none past 60 s
four sessions on 2.1.321 that had stopped writing rests
80
78
24: a median of 39 s; 15 for 30 s or longer; 3 for 55 s or longer
the other 13 sessions on 2.1.321
276
0
0
33 sessions on 2.1.296 to 2.1.318
214
11
4: a median of 26 s, 47 s at most
So close to a full minute (55 s or longer) was lost after 3 of 570 notice turns, half a minute or more after 16, some wait after 28. The other 61 turns with no rest were still at work when their minute ran out, or the next prompt came first. A turn that writes its rest costs no wait: the hold ends there. 202 of the 481 that rested lasted a minute or longer, where the minute ends first (bound 3).
When no rest is written.
The turn is interrupted. As in fix(status): hold a Claude pane's queue from a /loop or scheduled wakeup to its turn's rest #3574, and with each file read once its table stands: on 2.1.311 and later 9 of 11 interrupts were followed by a turn_duration (all 9 made during a tool call; neither of the 2 made while the answer streamed), on 2.1.308 and earlier 0 of 8. Two of those interrupts were of a notice's turn, both followed by a rest.
The session does not write them. That is every one of the 89 turns above: none was interrupted. 78 are in four sessions on 2.1.321 that had stopped writing rests, 10 of the other 11 in two sessions on 2.1.302 to 2.1.308. For the owner's check, a lead on what puts a session in that state, not a cause:
On 2.1.321, 5 of the 18 interactive sessions with five or more answered turns stop writing turn_duration: none of their last 8 to 49 answered turns has one (d1f93653, d1a7add2, 3aaec6c4, 12cbc362, d46eefce).
In those five every Agent call carries a name: 13 of 13. In the 13 sessions that keep their rests none of 165 does.
In four of the five the rests stop in the turn that first makes such a call (three sessions) or the one after it (one).
The fifth makes no Agent call. Its rests stop at a notice's turn that was answered within 34 ms by an answer with the stop reason stop_sequence, one turn before its first ListAgents and SendMessage; it later runs Workflow.
ListAgents is called in all five and SendMessage in four of them (30 calls); in the other 13 sessions, in 2 and in 1 (3 calls). Workflow is called in both groups (17 calls in 2 sessions, 37 in 4).
Older versions agree in part: of five sessions on 2.1.296 to 2.1.318 that call a named agent, three write no rest for many of their answered turns (43 of 48, 20 of 44 and 7 of 8; the 10 notice turns named above are in the first two) and two write one for every turn.
So the minute's cost falls on sessions that run named agents or talk to other sessions. Why Claude Code writes no turn_duration there was not found.
In 83 of the 89 notice turns with no rest a stop_hook_summary is still written after the last answer, a median of 134 ms after it. It could end the hold where no turn_duration follows, but that is a third way to end it and depends on a Stop hook being installed: not for this PR.
Holds chain. A later notice prompt holds anew for its own minute (#3574's "a later fire or prompt holds anew"). So in a session that writes no rest, notices less than a minute apart hold the queue for as long as they keep coming: in the probe above for 265 s, of which a turn worked for 30 s. It ends a minute after the last one, and is told. A monitor's events come as notices too (the skeptic counted 6 here) and can come often. In the transcripts here it is rare: of the 89 notice turns with no rest, the next notice prompt came inside the minute after 2. Send now is not held.
Also toward holding, each for a minute at most, as in #3574: a prompt found at a transcript's first read, younger than a minute, holds for the rest of its minute even if its turn was interrupted before; a turn_duration with no timestamp ends no hold; a transcript rewritten in place that moves a prompt with no rest after it.
In the timed model below, where one self-resumed turn in ten writes no rest by construction, the hold stood with no turn at work for a median of 220 ms (p95 13 s, 60.7 s at most): for more than 5 s after 484 of 11,178 notice turns (4.3%), for 30 s or longer after 114 (1.0%), for 55 s or longer after 25 (0.2%).
Known bounds
The race is between two clocks, Claude's transcript and herdr's events. It is narrowed, not closed.
A message can still reach a running notice's turn:
The prompt is not in the file yet (a task that ends in a pane at rest). Claude dates the prompt 24 to 104 ms after it queued the notice (p10 to p90 of 537, a median of 46) and writes it later than it dates it. Of nine such prompts read as they reached their files, eight were there 52 to 73 ms after their own date, in one batch with the notice's enqueue and dequeue: before that batch nothing in the file tells of the task's end. The ninth was there 186 ms after its date, 112 ms after a batch that held only the enqueue and the dequeue. So nothing holds for about the first 80 to 180 ms of the turn, and for up to some 300 ms when the prompt is written late. An Enter whose last read falls before that goes through, as does one herdr is handing to the pane as the task ends. With a herdr quick to tell the turn, a message typed at once in that moment goes in as a Ctrl+Enter, which Claude takes into the turn at work (94 of the branch's 390 such Enters with the quick herdr below, against 237 of main's 1,068).
A notice's turn begun at the rest of the turn its notice waited behind (32 of the 573 notice prompts here). The notice in Claude's queue holds nothing, so nothing holds between that rest and the prompt's line. Claude dates the line 24 to 97 ms after the rest (a median of 40) and writes it later still: the one read as it reached the file was there 133 ms after its own date, 107 ms after the batch that held the turn's last answers, the notice's dequeue and the Stop hook's summary. So the window is nearer 100 to 230 ms after the rest than the 24 to 97 ms the prompt is dated (by the lags read in a pane at rest, 75 to 285 ms). That rest is also what drains the queue, so this is where a queued message most likely meets a notice's turn. What happens then depends on when herdr's idle word is heard:
after the prompt is in the file: the message stays queued and goes at the notice's turn's rest;
before it, with the prompt written by the Enter's last read: the message is pasted and no Enter is sent ("A paste left in the input line" below). On main the Enter goes into the notice's turn, unless herdr has told that turn by then: then main leaves the paste too;
before it, with paste, wait and Enter all done before the prompt is written: the Enter goes into the turn, as on main.
The hold's minute. After 60 s the queue goes by herdr's status alone: a notice's turn longer than a minute that herdr reads as idle gets the message.
A prompt found at a transcript's first read that is a minute old or older, or tells no time, is history.
No transcript found for the pane (after a server start until the first lookup answers): nothing holds, and a send's own read looks none up.
Keys. Detection is by Claude Code's own key, turnOrigin: "task_notification" on the session's own user entry (2.1.296 to 2.1.321 here). A version that renames it, or writes the notice's prompt without it, arms nothing and main's behaviour returns silently.
A turn of another origin that Claude begins by itself arms nothing: one begun on another session's message (turnOrigin: "peer", 24 prompts here) has the same race. A prompt sent through the SDK ("sdk", 440 here) is a caller's, not Claude's own.
A paste left in the input line (not sent, not waiting): a prompt written between the check before the paste and the Enter key's last read. That spans the paste's connection and write, the 120 ms wait (SUBMIT_DELAY_MS), the look before the Enter and the key's connection: a few tenths of a second per delivery. The message reads "not confirmed", and the pane's other queued messages wait for the person. For a notice's turn begun at a rest (bound 2) this is the likely outcome whenever herdr's idle word is heard inside the 100 to 230 ms before the prompt is written: with a quick herdr about one such turn in eight in the model below, on main as on the branch.
How many are left depends on the timings, and with a quick herdr the branch leaves more than main. The timed model (3,000 scripts with notice turns on a virtual clock, each tree's real hub and delivery; one self-resumed turn in ten writes no rest), main f372ef1 against this branch:
timings
Enter keys written
Enters into a running notice's turn (Ctrl+Enter)
of them with the prompt in the file at the key's last read
pastes with no Enter
of them tied to a notice's turn
as #3574's run: herdr 20 to 400 ms behind, its RPCs 3 to 40 ms, an entry in the file 5 to 100 ms after its date
main
36,585
2,010 (504)
1,551
2,435 of 39,020
1,577
branch
42,069
446 (2)
0
1,611 of 43,680
756
the skeptic's: herdr 5 to 40 ms behind, RPCs 2 to 10 ms
main
39,497
1,068 (237)
693
1,731 of 41,228
1,187
branch
39,210
390 (94)
0
1,862 of 41,072
1,350
#3574's herdr, an entry in the file 60 to 135 ms after its date (as read live)
main
36,566
2,014 (504)
1,447
2,443 of 39,009
1,585
branch
41,251
560 (9)
0
1,720 of 42,971
872
the quick herdr and the late entry
main
39,454
1,070 (237)
634
1,745 of 41,199
1,197
branch
39,007
449 (143)
0
1,864 of 40,871
1,348
In every run on the branch no key and no paste was written while a notice prompt under a minute old stood in the file at the check before it, and no hold outlived its bound or left the queue untold (main has one such script in each run, its own). The Enters left on the branch are bounds 1 and 2 (279, 230, 398 and 286 in the four runs, all but 4 of them in a pane at rest: a median of 53 to 90 ms into the turn, 244 ms at most) and bounds 3 and 4 (160 to 167). The skeptic's own notice model gave the same direction for a quick herdr: 736 pastes with no Enter of 16,507 on the branch against 665 of 16,746 on main.
By how the notice's turn began (the same model, which also writes out each turn's shape; its traces are identical):
So with a quick herdr about one notice's turn in eight that begins at a rest leaves a paste, on main as on the branch: there herdr tells the turn before the Enter, and main refuses the key on herdr's word where the branch refuses it on the prompt. The pastes the branch adds come from tasks that end in a pane at rest, where main types the Enter into the turn instead (403 turns against 234). With #3574's slower herdr the branch leaves far fewer at a rest (35 against 1,311) and more in a pane at rest (335 against 201), again where main typed the Enter (1,230 against 282). Of the 455 turns at work as the server started, 158 took an Enter on main and 69 on the branch, none a paste.
The model's mix is not this PC's: three notice turns in four begin at a rest there, one in eighteen in the transcripts here (32 of 573), and it submits messages far more often than a person does. Read the rates per turn, not the totals.
Panes with no notice turn
They are asked nothing new. A transcript line is parsed by selfResumed only when it holds the key, as before; the clamp acts only on a hold dated ahead of the clock.
Differential run (#3574's harness, kept outside the tree; 600 seeded scripts in three families, each driven through one tree's real hub and delivery with a fake clock, recording after every step the status shown, what the queue was told, its messages, what was written to the pane, the answers and the alerts), main f372ef1 against this branch:
scripts
steps
differ
no fire, no self-resumed prompt, no notice turn: main against itself
43,783
0
the same: main against this branch
43,783
0
with /loop fires and scheduled prompts: main against this branch
47,660
0
with what a notice writes that begins no turn, and prompts of other origins (added in this round): main against itself
44,796
0
the same: main against this branch
44,796
0
control, with notice turns: main against this branch
46,937
487 of 600 scripts
The scripts added in this round write a notice's enqueue and dequeue with no prompt, a notice taken into a turn at work, a notice entry with no turnOrigin, a subagent's notice entry, a person's prompt that quotes the key, and peer and sdk prompts. With that mode added the harness reproduces the first row's run: 0 of its 43,783 steps differ.
With notice turns in the scripts, keys written while a notice prompt under a minute old had no rest after it: main 747 of 2,302 Enters, this branch 0 of 1,665. Pastes in that state: main 785 (764 with the prompt written before the paste's connection was asked for), this branch 17, each with its prompt written after the check before the paste. With fires and notice turns together (50,606 steps): main 350 of 1,618 Enters and 420 pastes, this branch 0 of 1,331 and 25. No script ends with the queue held or told to wait.
The timed model agrees: 1,500 scripts with no wakeup and no notice, 105,463 recorded steps, 0 differ between main and this branch; 3,000 scripts with scheduled wakeups, 348,783 steps, 0 differ.
With notice turns the status shown can move at a moment main sent none. When a hold begins or ends, the hub sends the pane's status frame again as it has it and reads herdr's last heard word again, which main does only when a rest or the counts change. In the skeptic's notice-turn comparison 23 of 600 scripts first differ from main in the status shown or the alerts while what is written to the pane is the same; in every case traced herdr's snapshot and its events disagreed, and no status was wrong by herdr's own last word. It is the path #3574's fires already take.
Pinned by no test
Nothing of this PR's own lines: 14 one-line mutants of them (the key missing from the filter or from the parsed check; no isSidechain or type guard; the prompt's time not read; a meta entry only; any other origin, peer, sdk; no clamp, a clamp at every poll, a clamp the wrong way) each fail a test, and so does a clamp that acts only on a start more than a minute ahead of the clock (the skeptic's second round; four steps back are pinned since f4d1d47). #3574's own list stands as it was.
Validation
At 626fc47 (its sources are those of b4b8446; the two commits after it add tests):
bun run check fast: green (unit 15747 pass, 0 fail; typecheck, build, generated files).
server/claude-subagents.test.ts 172 pass, server/core/status.test.ts 166 pass at this head; the other files below were run at 3207ed2. Also server/core/pending.test.ts (79), pending-identity-race.test.ts (23), pending-agent-only.test.ts (24), pending-omo-holder.test.ts (3), pending-birth-guard.test.ts (32), letta-status-hub.test.ts (12), server/pending-input.test.ts (61), server/conventions.test.ts (14), scripts/conventions.test.ts (19), scripts/changelog-fold.test.ts (12): all pass (the two touched files, the three convention and changelog files and the typecheck at 3207ed2, the rest at 567f087). bun run typecheck: clean.
Failing first: the branch adds 11 tests to the tracker's file and 10 to the hub's (main: 158 and 155 pass). On main's sources 10 and 9 of them fail (the hub tests show pending.next() offering the message, the delivery tests show paste and keys Enter written); the other two pin what does not change (the pane's counts and rests through a notice's turn, and its status under a background subagent's spinner).
Mutations (at 567f087), the differential run and the timed model: as above. Both harnesses were rerun in this round on main f372ef1 and on the branch at 9587643, at 576db4f and at 567f087, which differ from each other in comments only: every run at the two later heads gives the earlier one's steps (0 differ), so the counts above are this head's. The runs with the default timings give the counts of the last round to the digit. The pass by how a turn began ran at 9587643 only.
Real transcripts were read for key names, entry types, tool names, stop reasons and timestamps only; content was tested for nothing but the fixed texts that tell an interrupt and a notice, and none was printed or copied. Ten notice prompts were read as they reached their files: nine in a pane at rest (eight in my records, one in the skeptic's) and one at the rest of the turn before (the skeptic's record, read again here).
Both harnesses at this head's sources (run by the round that was cut off, compared by the session that opens this PR): the differential run gives 0 of 600 scripts differing with no notice (against the branch base and against main), 0 with /loop fires and 0 with entries that begin no turn; the timed model gives 0 of 1,500 with no wakeup and 0 of 3,000 with scheduled wakeups. With notice turns the model's counts are those of the tables above (Enters into a running notice turn: main 2,010, 1,551 of them with the prompt in the file; this branch 446, none with the prompt in the file; no hold past its bound and no queue never told free).
Not run: check full, the integration and contract suites, browser regressions (no client change).
Harness changes in this round, both outside the tree: a mode of the differential that writes notice entries beginning no turn and prompts of other origins, and a copy of the timed model that also writes out how each turn began. What the other modes draw and record is unchanged: the plain differential run reproduces (0 of 43,783 steps differ), and the copy's traces are identical to the model's.
This touches queued input: it waits for a real review.
…nd task's notice turn to its rest
A message queued for a Claude Code pane could be typed into the turn Claude
had just begun by itself because a background task ended (a subagent, a
background command, a monitor, a workflow). Such a turn starts with no prompt
of the person's and no send of the chat's, and for a moment herdr still reads
the pane as idle, or says idle late for the turn before: the queue's gate let
the message through, pasted and entered into the turn at work. #3574 closed
this for a /loop wakeup and a scheduled task and left the notice's turn open
(its bound 7), though it is far more common in the transcripts.
The prompt of a notice's turn (a user entry with turnOrigin
"task_notification", written by Claude Code 2.1.296 to 2.1.321) now arms the
hold #3574 added, as the prompt of a scheduled turn does: selfResumed takes
that turnOrigin too. Nothing else changes. The hold ends as before, at that
turn's rest (a turn_duration with a timestamp written after the prompt) or
60 s after the prompt was read, and whoever finds it ended tells the queue.
No word of herdr's begins, prevents or ends it. The notice in Claude's queue
(a queue-operation), a notice taken into a turn at work (a queued_command),
a notice entry with no turnOrigin and a subagent's own entries arm nothing.
The cost: a notice's turn that ends with no rest written (interrupted on a
Claude Code that writes none for it, or in a session that writes none) holds
the pane's queue until a minute after its prompt was read, though herdr
reads the pane idle. Send now is not held.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
…ld outlive its minute
The hold of a pane's queue on a turn Claude resumed by itself ends at that
turn's rest or 60 s after the entry that told of it was read. The 60 s were
counted from the wall clock at that read, so a clock stepped back while the
hold stood, with no rest written, kept the queue held for the step and the
minute on top of it (a LOW finding of #3574's review, left for after it).
Background tasks' notices arm that hold far more often than scheduled
wakeups did, so it is closed here.
The pane's poll, which runs every 2 s while a hold stands, now moves a hold
dated ahead of the clock to the time of that poll: the hold ends a minute
after that poll at the latest. Nothing changes while the clock only moves
forward.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
…the paste a notice's turn begun at a rest leaves
Two gaps in the tests of the hold a background task's notice arms.
No test said which origins arm. A change that armed the hold on any
turnOrigin other than the person's passed both test files (169 and 164
pass), though only a scheduled turn's prompt and a notice's may hold: a
turn begun on another session's message (turnOrigin "peer") and one sent
through the SDK ("sdk") hold nothing. The test of the keys now writes both
prompts, with the keys Claude Code writes on them, and expects no hold.
That change, and ones arming on "peer" or on "sdk" alone, now fail it.
No test ran the likely way a paste is left in the input line: a message
queued behind a turn at work, a task that ends during that turn, and
herdr's idle word for that turn heard before Claude has written the prompt
of the notice's turn, which begins at that rest. The check before the paste
finds no prompt, the read before the Enter finds it: the new delivery test
expects the paste and no Enter, the message left as not confirmed and
typed again by nothing. On main the same steps write the Enter into the
notice's turn.
The comments that give the prompt's date after that rest (24 to 97 ms)
now also say it is written later than it is dated: read once as it
reached the file, 133 ms after its own date.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
…is described, and say what its cost looks like
Comments only, and the changelog fragment. No behaviour changes: the three
source files transpile to the same output as before.
The comments on the queue's hold in server/core/status.ts (queueStatus,
queueHeld) and server/core/pending.ts (the queueHeld option, the reads
before the paste and before the Enter, the pending_wait answer) still
listed only a /loop wakeup and a scheduled task as what arms it. A turn
resumed on a background task's notice arms it too since a5e07e6, so
they name it. The comment on selfResumed said only when Claude dates the
prompt of a notice's turn: it now also says the line reaches the file
later than its date (60 to 65 ms in a pane at rest, 133 ms at the rest of
the turn before, read as four such lines were written), so some 100 to
230 ms after that rest.
The changelog fragment said "as it already did after a /loop wakeup",
though that entry is unreleased too: both appear as new in one release.
It also left out two things a user can see: a turn begun this way between
a message's paste and its Enter leaves the text in Claude's input line,
marked as not confirmed, most likely when the task ended during the turn
the message waited behind; and in a session that writes no end-of-turn
entry the queue stays held for as long as such turns keep beginning less
than a minute apart.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
…ads have it
A comment only: the file transpiles to the same output as before.
The comment on selfResumed gave how long after its own date the prompt of
a notice's turn reaches the transcript from four lines read as they were
written: 60 to 65 ms in a pane at rest. Five more were read since, and the
range is wider: 52 to 73 ms over the eight read in a pane at rest. The one
read at the rest of the turn before stands at 133 ms. The comment now says
some 50 to 75 ms, and how many lines each figure is from.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
…ple's count
Comments only, in one source file and one test: the source transpiles to
the same output as before.
The comment on selfResumed gave the write lag of a notice's prompt from the
lines read as they reached their files, with how many each figure was from.
A tenth was read since: in a pane at rest, 186 ms after its own date, with
the notice's enqueue and dequeue written in a batch 112 ms before it. The
figures no longer held, so the comment now gives the range of all ten (50
to 190 ms after the date, so up to a few tenths of a second after the
task's end or the rest) and leaves the counts to the PR. The comment of the
delivery test that runs that window says the same.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
…happen, not as the likely case
The changelog fragment only. Its last sentence said a paste left in
Claude's input line is most likely when the task ended during the turn
the message waited behind. How likely depends on how soon herdr tells
that turn's end, which was measured in a model only: there it is the
common case with a quick herdr and a rare one with a slow herdr. The
sentence now says it can happen to such a message, and why: that turn's
end both sends the message and begins the new turn.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
… is set back later
A self-resumed turn's hold that ran out its minute with no rest written kept
its start in the pane's turns. A clock set back later made it hold again by
that start: told to no one, and where the pane's files stayed as they were the
poll skipped the read (their signature was certified once the hold was over),
so nothing said when its time was up a second time. A message queued meanwhile
waited until herdr's next word on the pane. Run through the hub and the
bridge's delivery: a notice's prompt with no rest, its minute run out and told,
two more polls, the clock set back ten minutes; a message sent then was
queued with nothing written, the hold stood for another 590 s, and polls every
2 s for 20 minutes sent nothing. The same held on main for a /loop fire with
no rest; a notice's turn that writes no rest puts far more panes in that state.
The poll that finds a hold over now ends it for good, by its rest or by its
time: the start is cleared where the poll decides what to tell, for every pane
it looks at, read or not. So what a poll told as over cannot hold again, and a
signature is certified only with nothing left that a clock could bring back.
A hold that stands as the clock is set back is the clamp's, as before.
Tests: the tracker with the pane's files read at each poll and with them
quiet (the poll that reads nothing), for a fire and for a notice's prompt, and
the delivery's own sequence. All three fail on 3207ed2.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
…ess than a minute
The clamp's test set the clock back ten minutes only, so a clamp that acted
only on a start more than LOOP_HOLD_MS ahead of the clock passed every test.
And bcb3fdf's title said more than its line does: a clock set back by less
than the hold's age is not clamped, as nothing tells it from a clock that was
not set back, so the hold then stands for what that clock leaves of its time.
Four steps back are pinned now. To before the hold began by less than a minute
(30 s back 10 s into it, and 1 ms past its start 59 s into it): the hold ends
LOOP_HOLD_MS after the poll that finds it so. By less than its age (40 s back
50 s into it, 58 s back 59 s into it): it ends LOOP_HOLD_MS after its start by
the clock as it is, so 50 s and 59 s after that poll, and is told. Either way
no longer than a minute past that poll: up to about two minutes of real time
across one step back.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
The steps back that are pinned poll once half a second into the hold first: a
clamp that acted at any poll, not only at one that finds the hold's start ahead
of the clock, would move the hold there and fail them.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Auto incremental reviews are disabled on this repository.
Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Summary
Summary by CodeRabbit
Bug Fixes
Queued messages now wait while Claude handles a background-task notification, then send when the turn ends or the hold expires.
If a turn starts between pasting a message and pressing Enter, the message remains in the input line and is marked unconfirmed rather than being sent into that turn.
“Send now” continues to send immediately.
Documentation
Clarified queue-hold behavior, including cases where interrupted turns leave the queue held for up to a minute.
The changes recognize Claude turns resumed by background-task notices as queue holds. Polling adjusts future hold times and clears expired holds. Tests cover queue status, clock changes, and delivery checks around paste and Enter.
Changes: Task-notification queue holds
Layer / File(s)
Summary
Recognize and track task-notification holds server/claude-subagents.ts, server/claude-subagents.test.ts
Self-resumed-turn detection now includes user entries with turnOrigin: "task_notification". Polling resets future-dated hold starts to the current time and clears expired holds. Tests cover task-notification holds, overlapping turns, and clock rollback.
Apply holds to queue status server/core/status.test.ts, server/core/status.ts
Status tests cover queue holds from task-notification prompts through turn rest or timeout, including interrupted turns and active background subagents. Comments describe transcript-based hold status.
Guard message delivery during holds server/core/pending.ts, server/core/status.test.ts, changelog.d/queue-holds-claude-task-notice.md
Delivery tests check that queued messages wait through a notice turn and that Enter is withheld if a turn starts during submission. The changelog describes the resulting unconfirmed-paste case and “Send now” behavior.
devswha/ovis#3574: Introduced queue holds for /loop and scheduled wakeups, including transcript checks before paste and Enter.
Suggested reviewers:jimbb
Merge Risk: Minimal · previous review 626fc
This change makes queued messages wait while Claude resumes from a background-task notice. No concrete problem was found. The queued-input path still needs the maintainer review the repository requires.
Pre-merge checks: 5
Check name
Status
Explanation
Title check
The title clearly and concisely identifies the main change: holding a Claude pane queue through a background-task notice turn.
Description check
The description includes the required Change and Validation sections. It explains the problem, resulting behavior, test results, skipped checks, known limits, and the related issue context.
Docstring Coverage
Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentati…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage
Explanation
Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 5 functions across 5 files. (1 skipped: 1 unsupported.)
Finishing Touches
Generate docstrings
Commit to this branch
Create a new PR
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Reviewing files that changed from the base of the PR and between 3081474 and 626fc47.
Files selected for processing: 6
changelog.d/queue-holds-claude-task-notice.md
server/claude-subagents.test.ts
server/claude-subagents.ts
server/core/pending.ts
server/core/status.test.ts
server/core/status.ts
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
Merge pass: parked at 626fc47e1 on one reproduced HIGH
Two reviewers at this head: Claude (Opus) CLEAR, Codex Terra BLOCK.
HIGH (Codex, reproduced by the merge pass): a notice prompt written after the Enter still lets a queued message into the notice's turn.
A message waits behind a turn at work, a background task ends during that turn, the turn rests and Claude begins the notice's turn, and herdr's idle word is heard before Claude has written that turn's prompt. Nothing holds yet, so the queue pastes the message and sends its Enter into the notice's turn. Reproduced with a scratch test in server/core/status.test.ts beside the PR's own "at the rest" test, with the prompt written only after the flush:
writes before the prompt is written: ["paste \u001b[200~at the rest\u001b[201~","keys Enter"] waiting: []
after the prompt: held now = true
This is the PR's own "Known bounds" 2, third case, and it is main's behaviour in that ordering: the head changes nothing there, and no regression was found. It still counts as a reproduced HIGH under the merge rule, because the changelog fragment says such a message "no longer goes into the turn" without that window. Closing it needs a hold that begins at the notice's enqueue and outlives the rest of the turn it waited behind, which the description leaves for after the release (item (a)); a task that ends in a pane at rest (bound 1) has no earlier signal to hold on at all.
MEDIUM (Claude, not run): in a session that writes no turn_duration, notices less than a minute apart re-arm the hold with no limit on the chain as a whole. Disclosed under "Holds chain".
LOW (Claude, not run): with a quick herdr the head leaves more pastes uncommitted than main for tasks that end in a pane at rest. Disclosed under "A paste left in the input line".
Not merged. The owner decides between merging this head as a narrowing of the race with the window named in the release notes, and waiting for the hold from the notice's enqueue. Reports: ~/.cache/ovis-tmp/reports/pr-3629-626fc47e-*.report.md, and the scratch test beside them.
Merged head 9688fb9788f6 as b346ce268076 on GitHub's checks, with no unresolved review threads.
Reviewer
Verdict
Note
claude
CLEAR
codex
CLEAR
Two reviewers at this head: Claude (Opus) CLEAR, Codex Terra CLEAR. This head differs from 626fc47e1 only in the changelog fragment.
One gap is left, and the owner chose to merge with it named (2026-11-11, relayed by the lead). At 626fc47e1 Codex reported a HIGH that the merge pass reproduced: a message already waiting behind a turn goes into the notice's turn when a background task ended during that turn, the turn rests, and herdr says idle before Claude has written the notice turn's prompt. Nothing holds until that prompt is in the transcript, so the queue pastes the message and sends its Enter. This is the description's own known bound 2 and main's behaviour in that ordering; the head changes nothing there and no regression was found. The changelog fragment at this head says so. Closing it needs a hold that begins at the notice's enqueue and outlives the rest of the turn it waited behind, which is not asked for now.
Also left, none reproduced:
MEDIUM (Claude): in a session that writes no end-of-turn entry, notices less than a minute apart re-arm the hold with no limit on the chain; the pane shows idle meanwhile. Send now is not held.
LOW (Claude): with a quick herdr, more pastes are left uncommitted ("not confirmed") than on main for tasks that end in a pane at rest, where main typed the Enter into the turn.
LOW (Claude): no fixture is a real Claude transcript with task_notification; a renamed key in a later Claude Code would bring main's behaviour back silently.
CodeRabbit did not review this head. Reports and the reproduction: ~/.cache/ovis-tmp/reports/pr-3629-*.
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
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 message queued for a Claude Code pane could be typed into the turn Claude had just begun by itself because a background task ended (a subagent, a background command, a monitor, a workflow). Such a turn starts with no prompt of the person's and no send of the chat's, and for a moment herdr still reads the pane as idle, or says idle late for the turn before: the queue's gate let the message through, pasted and entered into the turn at work.
#3574 closed this race for a
/loopwakeup and a scheduled task (#3494) and left it open for a task's notice (its bound 7), where it is far more common: 573 such prompts in the session transcripts on this PC against 1 scheduled one. This PR arms the same rest-or-60-s hold for that turn, with #3574's mechanism and no new rule, as the merge pass asked. It has no issue of its own: #3574's bound 7 named it.Change
One more entry arms the hold (
server/claude-subagents.ts, three lines of code). The prompt of a notice's turn, which Claude Code 2.1.296 to 2.1.321 write as a user entry of the session's own withturnOrigin: "task_notification", now arms #3574's hold as the prompt of a scheduled turn does:selfResumedand the line filter in front of it (SELF_RESUMED_RE) take thatturnOrigintoo.Everything else is #3574's, untouched:
turn_durationwith a timestamp) written after the prompt, or 60 s (LOOP_HOLD_MS) after the prompt was read. A later notice prompt holds anew for its own 60 s. A prompt found already written at a transcript's first read holds for what is left of 60 s by its own timestamp. No word of herdr's begins, prevents or ends it.server/core/status.tsandserver/core/pending.tschange in comments only: both transpile to the same output as on main.What arms nothing, each pinned by a test: the notice in Claude's queue (
queue-operationenqueue and dequeue); a notice taken into a turn at work (queued_command, 283 here); a notice written as a user entry with noturnOrigin(17 here, none followed by an answer); a subagent's own entries; an entry that only quotes or carries the key; the prompt of a turn of any other origin: the person's, one begun on another session's message (turnOrigin: "peer"), one sent through the SDK ("sdk").A clock set back (a few lines, one of #3574's three post-release items). The hold's 60 s were counted from the wall clock at the read that armed it, so a clock stepped back while a hold stood, with no rest written, kept the queue held for the step and the minute on top of it. Now:
Notices arm the hold far more often than wakeups did, so it rides here.
Not in this PR: #3574's other two items. Each needs a rule of its own, not a few lines, so they stay for after the release:
/loopover a local slash command writes no end-of-turn entry. It needs another end for the hold, as does a session that writes no rest (Cost below).Also for after the release: a turn begun on another session's message (bound 8).
Since the skeptic's round on bcb3fdf
Six LOW findings, dealt with in 91dbedc (tests), 9587643 (comments and the changelog fragment), 576db4f and 567f087 (the comment that gives the write lag, as more prompts were read live) and 3207ed2 (one sentence of the changelog fragment). No behaviour changed since bcb3fdf: the three source files transpile to the same output at every one of these commits.
keys Enterwritten into the notice's turn. One thing the model adds: by how the turn began, a turn begun at a rest leaves a paste about as often on main as on the branch with that quick herdr (main refuses the Enter on herdr's word), and the pastes the branch adds come from tasks that end in a pane at rest. This body now gives the counts for four sets of timings, and bound 2 gives when the prompt reaches the file, not only its date. Closing it takes a hold from a queued notice across the rest, a new arm: after the release.stop_hook_summaryis a third way to end it: after the release.turnOriginbut the person's passed both files (169 and 164 pass). The test of the keys now writes apeerand ansdkprompt with the keys Claude Code writes on them and expects no hold: that mutant fails it, as do ones arming onpeeralone, onsdkalone, or on anoriginof the kindpeer./loopwakeup"; the fragment now also says a turn begun between a message's paste and its Enter leaves the text in Claude's input line, marked as not confirmed, that this can happen to a message that waited behind the turn the task ended during, and that the queue stays held while such turns keep beginning less than a minute apart.server/core/status.tsandserver/core/pending.tsthat listed only a/loopwakeup and a scheduled task now name a background task's notice (the four the skeptic listed, and two more of the same kind).A correction of my own. The transcript counts of the last body were too high: one project folder under
~/.claude/projectsis a link to another, so five session files were read twice (a scan with the double read counts 821 notice prompts, 250 of them twice). Every count in this body reads each file once. The skeptic's counts match mine with the double read (58 of 815 begun at a rest; read once it is 32 of 573 prompts).Since the skeptic's second round on 3207ed2
One MEDIUM and two LOW findings, dealt with in b4b8446, f4d1d47 and 626fc47:
These three commits were not looked at by a skeptic again: the round that made them was cut off by the account's rate limit after its two source commits and its harness reruns, and the session that opens this PR finished the last test commit and compared the reruns itself (below).
For the owner's check
Cost
A notice's turn that ends with no rest written holds the pane's queue until 60 s after its prompt was read, though herdr reads the pane idle (a minute from that read, plus up to 2 s for the timer's poll to tell the queue). While it lasts the pane shows herdr's status, the queued row reads "Next turn", and Send now still types and commits the message at once.
How often the hold costs a wait, in the session transcripts on this PC (Claude Code 2.1.296 to 2.1.321, each file read once, counted on 2026-11-11; the live sessions move a count by one or two between scans):
So close to a full minute (55 s or longer) was lost after 3 of 570 notice turns, half a minute or more after 16, some wait after 28. The other 61 turns with no rest were still at work when their minute ran out, or the next prompt came first. A turn that writes its rest costs no wait: the hold ends there. 202 of the 481 that rested lasted a minute or longer, where the minute ends first (bound 3).
When no rest is written.
turn_duration(all 9 made during a tool call; neither of the 2 made while the answer streamed), on 2.1.308 and earlier 0 of 8. Two of those interrupts were of a notice's turn, both followed by a rest.turn_duration: none of their last 8 to 49 answered turns has one (d1f93653, d1a7add2, 3aaec6c4, 12cbc362, d46eefce).Agentcall carries aname: 13 of 13. In the 13 sessions that keep their rests none of 165 does.Agentcall. Its rests stop at a notice's turn that was answered within 34 ms by an answer with the stop reasonstop_sequence, one turn before its firstListAgentsandSendMessage; it later runsWorkflow.ListAgentsis called in all five andSendMessagein four of them (30 calls); in the other 13 sessions, in 2 and in 1 (3 calls).Workflowis called in both groups (17 calls in 2 sessions, 37 in 4).turn_durationthere was not found.stop_hook_summaryis still written after the last answer, a median of 134 ms after it. It could end the hold where noturn_durationfollows, but that is a third way to end it and depends on a Stop hook being installed: not for this PR.Holds chain. A later notice prompt holds anew for its own minute (#3574's "a later fire or prompt holds anew"). So in a session that writes no rest, notices less than a minute apart hold the queue for as long as they keep coming: in the probe above for 265 s, of which a turn worked for 30 s. It ends a minute after the last one, and is told. A monitor's events come as notices too (the skeptic counted 6 here) and can come often. In the transcripts here it is rare: of the 89 notice turns with no rest, the next notice prompt came inside the minute after 2. Send now is not held.
Also toward holding, each for a minute at most, as in #3574: a prompt found at a transcript's first read, younger than a minute, holds for the rest of its minute even if its turn was interrupted before; a
turn_durationwith no timestamp ends no hold; a transcript rewritten in place that moves a prompt with no rest after it.In the timed model below, where one self-resumed turn in ten writes no rest by construction, the hold stood with no turn at work for a median of 220 ms (p95 13 s, 60.7 s at most): for more than 5 s after 484 of 11,178 notice turns (4.3%), for 30 s or longer after 114 (1.0%), for 55 s or longer after 25 (0.2%).
Known bounds
The race is between two clocks, Claude's transcript and herdr's events. It is narrowed, not closed.
A message can still reach a running notice's turn:
turnOrigin: "task_notification"on the session's own user entry (2.1.296 to 2.1.321 here). A version that renames it, or writes the notice's prompt without it, arms nothing and main's behaviour returns silently.turnOrigin: "peer", 24 prompts here) has the same race. A prompt sent through the SDK ("sdk", 440 here) is a caller's, not Claude's own.A paste left in the input line (not sent, not waiting): a prompt written between the check before the paste and the Enter key's last read. That spans the paste's connection and write, the 120 ms wait (
SUBMIT_DELAY_MS), the look before the Enter and the key's connection: a few tenths of a second per delivery. The message reads "not confirmed", and the pane's other queued messages wait for the person. For a notice's turn begun at a rest (bound 2) this is the likely outcome whenever herdr's idle word is heard inside the 100 to 230 ms before the prompt is written: with a quick herdr about one such turn in eight in the model below, on main as on the branch.How many are left depends on the timings, and with a quick herdr the branch leaves more than main. The timed model (3,000 scripts with notice turns on a virtual clock, each tree's real hub and delivery; one self-resumed turn in ten writes no rest), main f372ef1 against this branch:
In every run on the branch no key and no paste was written while a notice prompt under a minute old stood in the file at the check before it, and no hold outlived its bound or left the queue untold (main has one such script in each run, its own). The Enters left on the branch are bounds 1 and 2 (279, 230, 398 and 286 in the four runs, all but 4 of them in a pane at rest: a median of 53 to 90 ms into the turn, 244 ms at most) and bounds 3 and 4 (160 to 167). The skeptic's own notice model gave the same direction for a quick herdr: 736 pastes with no Enter of 16,507 on the branch against 665 of 16,746 on main.
By how the notice's turn began (the same model, which also writes out each turn's shape; its traces are identical):
So with a quick herdr about one notice's turn in eight that begins at a rest leaves a paste, on main as on the branch: there herdr tells the turn before the Enter, and main refuses the key on herdr's word where the branch refuses it on the prompt. The pastes the branch adds come from tasks that end in a pane at rest, where main types the Enter into the turn instead (403 turns against 234). With #3574's slower herdr the branch leaves far fewer at a rest (35 against 1,311) and more in a pane at rest (335 against 201), again where main typed the Enter (1,230 against 282). Of the 455 turns at work as the server started, 158 took an Enter on main and 69 on the branch, none a paste.
The model's mix is not this PC's: three notice turns in four begin at a rest there, one in eighteen in the transcripts here (32 of 573), and it submits messages far more often than a person does. Read the rates per turn, not the totals.
Panes with no notice turn
They are asked nothing new. A transcript line is parsed by
selfResumedonly when it holds the key, as before; the clamp acts only on a hold dated ahead of the clock.Differential run (#3574's harness, kept outside the tree; 600 seeded scripts in three families, each driven through one tree's real hub and delivery with a fake clock, recording after every step the status shown, what the queue was told, its messages, what was written to the pane, the answers and the alerts), main f372ef1 against this branch:
/loopfires and scheduled prompts: main against this branchThe scripts added in this round write a notice's enqueue and dequeue with no prompt, a notice taken into a turn at work, a notice entry with no
turnOrigin, a subagent's notice entry, a person's prompt that quotes the key, andpeerandsdkprompts. With that mode added the harness reproduces the first row's run: 0 of its 43,783 steps differ.With notice turns in the scripts, keys written while a notice prompt under a minute old had no rest after it: main 747 of 2,302 Enters, this branch 0 of 1,665. Pastes in that state: main 785 (764 with the prompt written before the paste's connection was asked for), this branch 17, each with its prompt written after the check before the paste. With fires and notice turns together (50,606 steps): main 350 of 1,618 Enters and 420 pastes, this branch 0 of 1,331 and 25. No script ends with the queue held or told to wait.
The timed model agrees: 1,500 scripts with no wakeup and no notice, 105,463 recorded steps, 0 differ between main and this branch; 3,000 scripts with scheduled wakeups, 348,783 steps, 0 differ.
With notice turns the status shown can move at a moment main sent none. When a hold begins or ends, the hub sends the pane's status frame again as it has it and reads herdr's last heard word again, which main does only when a rest or the counts change. In the skeptic's notice-turn comparison 23 of 600 scripts first differ from main in the status shown or the alerts while what is written to the pane is the same; in every case traced herdr's snapshot and its events disagreed, and no status was wrong by herdr's own last word. It is the path #3574's fires already take.
Pinned by no test
Nothing of this PR's own lines: 14 one-line mutants of them (the key missing from the filter or from the parsed check; no
isSidechainortypeguard; the prompt's time not read; a meta entry only; any other origin,peer,sdk; no clamp, a clamp at every poll, a clamp the wrong way) each fail a test, and so does a clamp that acts only on a start more than a minute ahead of the clock (the skeptic's second round; four steps back are pinned since f4d1d47). #3574's own list stands as it was.Validation
At 626fc47 (its sources are those of b4b8446; the two commits after it add tests):
bun run check fast: green (unit 15747 pass, 0 fail; typecheck, build, generated files).server/claude-subagents.test.ts172 pass,server/core/status.test.ts166 pass at this head; the other files below were run at 3207ed2. Alsoserver/core/pending.test.ts(79),pending-identity-race.test.ts(23),pending-agent-only.test.ts(24),pending-omo-holder.test.ts(3),pending-birth-guard.test.ts(32),letta-status-hub.test.ts(12),server/pending-input.test.ts(61),server/conventions.test.ts(14),scripts/conventions.test.ts(19),scripts/changelog-fold.test.ts(12): all pass (the two touched files, the three convention and changelog files and the typecheck at 3207ed2, the rest at 567f087).bun run typecheck: clean.pending.next()offering the message, the delivery tests showpasteandkeys Enterwritten); the other two pin what does not change (the pane's counts and rests through a notice's turn, and its status under a background subagent's spinner)./loopfires and 0 with entries that begin no turn; the timed model gives 0 of 1,500 with no wakeup and 0 of 3,000 with scheduled wakeups. With notice turns the model's counts are those of the tables above (Enters into a running notice turn: main 2,010, 1,551 of them with the prompt in the file; this branch 446, none with the prompt in the file; no hold past its bound and no queue never told free).check full, the integration and contract suites, browser regressions (no client change).🤖 Generated with Claude Code