# feat\(server\): snooze a thread until its pull request needs attention · flambo/t3code

[View on GitCafe](https://git.cafe/flambo/t3code/commit/91256f4c1b30532f8d85156d7378a6dcf4a6f22e)

Repository: [flambo/t3code](https://git.cafe/flambo/t3code)

Visibility: public

Requested revision: 91256f4c1b30532f8d85156d7378a6dcf4a6f22e

Requested commit: 91256f4c1b30532f8d85156d7378a6dcf4a6f22e

Commit: 91256f4c1b30532f8d85156d7378a6dcf4a6f22e

Tree: d0500288b00493aa96f8346faa8d831817d584b3

Author: flamboh

Committer: flamboh

## Message

```
feat(server): snooze a thread until its pull request needs attention

A thread whose pull request waits on someone else can now be snoozed with no
wake time, held by pull request watches. The new thread.snooze-until-attention
command and the agent's snooze_until_pull_request_needs_attention tool both go
through PullRequestWatchReactor.snoozeUntilAttention. It reads each open linked
pull request from its host and dispatches the snooze with watches primed from
that read, the way a watch pass records it. Nothing the pull request already
shows (failing checks, required checks that passed, a conflict) wakes the
thread, and anything that changes afterwards does. A watch already on keeps its
start, remark cursor, and wake count, so comments after its last read still wake
it. The snooze is refused when no linked pull request is open, when one cannot
be read, or when the thread's linked pull requests or their watches changed
while the host was read. It follows the snooze rules, and an agent's call that
lands after the user pressed Stop is refused, like watch_pull_request. A watch
pass that began before a snooze primed a pull request reports nothing about it,
caches no read of it, and does not count a failed read of it against the watch,
so a stale read cannot replace what the snooze recorded, settle the thread on a
close the pull request has since undone, let the next pass skip it, or end the
watch early. The snooze's own read starts the failure count over, the way a
pass's successful read does.

A later watch wake brings the thread back and the watch continues. Merging or
closing the last watched pull request settles the thread instead of sending the
closed note, unless the thread's link snapshots show another linked pull request
open, such as one that reopened after its watch ended and so is not watched
again. Then the snooze ends with the watch and the agent hears of the close as
usual. The orchestrator decides this under the thread lock. While the thread is
still at work, the watch reactor leaves the watch and snooze in place and
settles it on the first pass after the turn ends.
A merge is final, so that pass does not read the host again; a closed pull
request can reopen, so each pass reads it again first. Any other way the last
watch ends (unwatch, Stop, unlink, settle, archive) ends the snooze, so it can
never outlive what could wake it. Waking or pinning the thread clears it too,
and a subagent made under such a thread does not inherit it. Usage-limit
recovery respects it: the worker's automatic arming records the recovery without
replacing the snooze, and an armed continuation waits until the snooze ends.

Pull requests only such threads watch are checked every 10 minutes. With the new
snoozePullRequestsAwaitingReview setting, agents are told to snooze instead of
unwatching when a pull request only waits on review: in the shared runtime
instructions when the thread attaches to a provider session, and in watch wakes.

Servers advertise the threadSnoozeUntilAttention capability for the command and
the setting, because servers from before it already advertise threadSnooze.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

```

## Parents

- [b77108bc41506ad7ba28839d9a8e04ba79fe340b](https://git.cafe/flambo/t3code/commit/b77108bc41506ad7ba28839d9a8e04ba79fe340b?format=markdown)

[Source at this commit](https://git.cafe/flambo/t3code/tree/91256f4c1b30532f8d85156d7378a6dcf4a6f22e?format=markdown)
