Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 41 additions & 1 deletion apps/server/src/orchestration-v2/PullRequestSyncReactor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1253,7 +1253,7 @@ describe("PullRequestSyncReactor", () => {
),
);

it.effect("leaves a settled thread's links unread until the thread is unsettled", () =>
it.effect("reads a settled thread's links once when it settles, then until unsettled", () =>
Effect.scoped(
Effect.gen(function* () {
yield* TestClock.setTime(Date.parse(NOW));
Expand All @@ -1269,6 +1269,46 @@ describe("PullRequestSyncReactor", () => {

yield* Effect.gen(function* () {
const reactor = yield* startAndSweep(fixture);
assert.deepStrictEqual(yield* Ref.get(fixture.summaryCalls), []);

const threadId = ThreadId.make("settled");
const at = DateTime.makeUnsafe(NOW);
yield* Queue.offer(fixture.domainEvents, {
type: "thread.settled",
id: EventId.make("event:settled"),
threadId,
occurredAt: at,
payload: {
createdBy: "user",
creationSource: "web",
id: threadId,
projectId: PROJECT_ID,
title: "settled",
providerInstanceId: ProviderInstanceId.make("codex"),
modelSelection: { instanceId: ProviderInstanceId.make("codex"), model: "gpt-5" },
runtimeMode: "full-access",
interactionMode: "default",
branch: null,
worktreePath: null,
activeProviderThreadId: null,
lineage: { parentThreadId: null, relationshipToParent: null, rootThreadId: threadId },
forkedFrom: null,
createdAt: at,
updatedAt: at,
archivedAt: null,
settledOverride: "settled",
settledAt: at,
lastVisitedAt: null,
deletedAt: null,
},
});
yield* Queue.take(fixture.snapshotReads);
yield* Queue.take(fixture.snapshotReads);
yield* reactor.drain;
assert.deepStrictEqual(
(yield* Ref.getAndSet(fixture.summaryCalls, [])).map((call) => call.number).toSorted(),
[5, 6],
);
for (let index = 0; index < 15; index += 1) yield* sweepAgain(fixture, reactor);
assert.deepStrictEqual(yield* Ref.get(fixture.summaryCalls), []);

Expand Down
3 changes: 3 additions & 0 deletions apps/server/src/orchestration-v2/PullRequestSyncReactor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,9 @@ export const make = Effect.gen(function* () {
ended.add(item.id);
return Effect.andThen(linked, refreshUnmergedLinks(event.threadId));
}
// Settled threads are not swept, so read their links once to settle with fresh status.
case "thread.settled":
return refreshUnmergedLinks(event.threadId);
case "run.updated":
return isTerminalRunStatus(event.payload.status) && closeCommands.delete(event.threadId)
? refreshUnmergedLinks(event.threadId)
Expand Down
2 changes: 1 addition & 1 deletion docs/user/source-control.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ Linking and unlinking are available in the web and desktop clients.
The **Linked pull requests** panel lists every review and groups stacks. Unlink a review from its
row menu. An unlinked stack layer stays out of later syncs. Open linked reviews refresh on the server;
closed reviews refresh periodically so reopening one on the host is detected. Merged reviews refresh
when requested. A settled thread's reviews stop refreshing until you unsettle it. With **Auto-settle merged threads** enabled, a thread can settle after every linked
when requested. Settling a thread refreshes its open and closed reviews once; after that they stop refreshing until you unsettle it. With **Auto-settle merged threads** enabled, a thread can settle after every linked
review is terminal. An open or unsynced link keeps it active.

Ask the agent to watch, monitor, or babysit a pull request and it calls `watch_pull_request`. While
Expand Down
Loading