Skip to content
Source
Sign inSign up
pingdotgg/t3code

watch_pull_request never wakes on merge and retires silently #34298

Closedozimos(GitHub profile, opens in a new tab) opened this issue 1 comment

What happened

An agent called watch_pull_request for an open PR and was told watching: true, with the documented wake conditions being failed checks, passed required checks, new comments or reviews, or conflicts. The PR was then merged.

No wake arrived. The agent only learned about the merge second-hand, and a later list_thread_pull_requests showed the PR as merged with watching: false. Nothing in the thread recorded that the watch had ended: no wake, no event entry, no reason.

Diagnosis

The watch's event set does not include terminal transitions (merged, closed), so a merge produces no wake. The watch is then retired as a side effect of the PR reaching a terminal state, and that retirement is silent — the state simply changes on the next read rather than being delivered as an event.

Two consequences follow from the same gap:

  • "watch this PR" reads as "tell me when it is resolved", but it only means "tell me if someone comments", and the call still answers watching: true.
  • A watch that died is indistinguishable from a watch with nothing to report, so a real missed notification looks like quiet.

Observed repeatedly in one working session: eight PRs merged while their watches were active, and none produced a wake on the merge itself. Every one was noticed second-hand — usually because the user said "merged", once because an unrelated review comment happened to fire the watch. After each, list_thread_pull_requests reported the PR merged with watching: false and the transcript showed no transition.

Steps to reproduce

  1. Open a PR.
  2. In a thread, call watch_pull_request with that PR's URL; it returns watching: true.
  3. Merge the PR (from anywhere — the merge itself does not need to happen in the thread).
  4. Observe that no wake is delivered to the thread.
  5. Call list_thread_pull_requests: the PR is state: "merged", watching: false, and the thread contains no record of the transition.

Version

0.1.9-nightly.20261110.4452 (desktop app, local server same version).

Environment

macOS 26.5.2, arm64, T3 Code Nightly desktop app with its local server. Provider in the watched thread: OpenCode. The PRs were on a self-hosted Gitea, reached through the linked environment — the watch, not the forge, is what is being reported.

Evidence

watch_pull_request's own description enumerates the wake conditions and omits merges and closes; list_thread_pull_requests is the only surface that reports the terminal state, and it reports it as watching: false rather than as an event. The transcript side of the pattern is an absence: nothing is emitted at retirement.

None found on the watch event set. Merge-adjacent behaviour exists in the sidebar auto-settle settings, but that is about thread lifecycle, not about notifying the agent.

Fix applied or workaround

The agent falls back to polling list_thread_pull_requests after a merge, then reads git log for the merge commit — exactly the round trip a merge wake would remove.

Requested behaviour, smallest useful cut first:

  1. Wake on terminal transitions. Include merged and closed in the watch's event set, delivered like comments and reviews.
  2. Carry the merge facts. PR number and URL, state, merged_at, merged_by, merged_sha, head branch, base branch, and whether the branch was deleted.
  3. Never retire silently. Deliver one terminal wake, then mark the watch unwatched; if delivery is impossible, still append a structured event recording the retirement and its reason.
  4. Coalesce bursts: several PRs commonly merge within a minute; mid-turn, deliver one digest wake ("2 merged, 1 comment") instead of N wakes that may be dropped.
  5. Backlog digest on reconnect: track lastNotifiedAt per watched PR and replay the delta after a restart, because watches persist but the events do not.
  6. Auto-watch on link_pull_request: "linked but not watched" is invisible until a merge goes unnoticed.
  7. CLI parity: a t3 watch <url> that behaves like the MCP tool, so non-T3 harnesses can use the same notification path instead of polling.

Acceptance criteria: merging a watched PR delivers a wake carrying the fields in (2); closing delivers state: closed; after a terminal wake watching is false and the transcript says why; two merges in one turn yield one digest wake; a watch that survives a restart replays merges missed while offline; existing events are unchanged.

Filed by

Filed by an agent (OpenCode) on behalf of the user, following the T3 Code triage playbook.

  1. This is the same problem as #25160, so I'm closing it in favour of that one. If it is different, say how and it will be reopened.

  2. juliusmarminge closed this

Sign in to join this conversation.