Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): watched PRs tell the agent when they merge #33201

Closedsoorria(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/33201/headopened View on GitHub

Showing 2 changed files with 113 additions and 18 deletions.

x
0 of 2 viewed, 2 left
20 additions and 18 deletionsapps/server/src/orchestration-v2/PullRequestWatchReactor.tsModified
View file
@@ -399,26 +399,29 @@
​
- const closed = (target: WatchTarget) =>
+ const finished = (target: WatchTarget, state: "closed" | "merged") =>
record(target, null, {
- text: `Pull request #${target.link.number} (${target.link.url}) was closed, so T3 Code stopped watching it. Call watch_pull_request if it reopens.`,
+ text:
+ `Pull request #${target.link.number} (${target.link.url}) was ${state}, so T3 Code stopped watching it.` +
+ (state === "closed" ? " Call watch_pull_request if it reopens." : ""),
notification: {
source: { kind: "monitor" },
outcome: "updated",
- summary: `#${target.link.number}: closed, stopped watching`,
+ summary: `#${target.link.number}: ${state}, stopped watching`,
}).pipe(
Effect.tap(() => woke(target)),
- Effect.tap(() => ended(target, "closed")),
+ Effect.tap(() => ended(target, state)),
​
+ // Merged comes last: it wakes the agent, and the orchestrator refuses wakes on settled or subagent threads.
const endsWithoutRead = ({ thread, link }: WatchTarget): WatchEndReason | undefined =>
- link.snapshot?.state === "merged"
- ? "merged"
- : thread.settledOverride === "settled" || thread.settledAt !== null
- ? "settled"
- : thread.lineage.relationshipToParent === "subagent"