Repository navigation
fix(server): refresh open PRs on settled threads and dedupe lane-ended alerts - #209
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
…cac-916-settled-pr-refresh-dedupe-alert # Conflicts: # apps/server/src/orchestration-v2/ThreadEventAlerts.test.ts # apps/server/src/orchestration-v2/ThreadEventAlerts.ts
Independent review: refresh open pull requests on settled threads and dedupe the lane-ended alertVerdict: clean. There are no important or critical findings, only two nits. I ran one full fresh-context pass at head What I checked
Limits: I did not run a live fleet check that stale snapshots for settled lanes actually move to merged or closed after deploy. That is deployment verification, outside source review. {
"reviewed_base": "caf9ebeb0cae23bee584f7b0acf3856fb6f6cada",
"reviewed_head": "d1330429f200d24d943d5627cbd8aa3fbb7ebd01",
"reviewer": "Claude Opus 5.5 (claude-opus-5-5), Claude Code via T3 Code",
"author_session": "unknown (not supplied to reviewer; PR authored by the fix/cac-916 lane)",
"reviewer_session": "claude-code:1ce947a7-a925-4ad9-9480-540d9757dd21 / t3:mcp:launch:ae4e3f2396ca8fac0a8135d199c6823786d4f627326313bf80447b306fd60c2d",
"fresh_context": true,
"review_kind": "full",
"round_id": "t3:mcp:launch:ae4e3f2396ca8fac0a8135d199c6823786d4f627326313bf80447b306fd60c2d",
"intent": [
"closura-agent-config#916 item 1: refresh open links on settled threads until terminal",
"closura-agent-config#916 item 2: dedupe lane-ended per thread and open-PR set, not per run",
"closura-agent-config#916 item 3: fresh state at delivery (skip settled threads with no open PR; re-read PR state)"
],
"prior_findings": [],
"findings": [
{
"id": "F1",
"severity": "nit",
"outcome": "open",
"file": "apps/server/src/orchestration-v2/ThreadEventAlerts.ts",
"line": 218,
"summary": "Item 3 of the controlling issue is only partly built. Settling now clears the remembered lane-ended signatures, and settled threads raise no new findings. But a run-ended alert still trusts the stored pull request snapshot rather than rereading it at delivery, and an alert already in the outbox is not withdrawn on settle. The PR body still says 'Closes' the issue. Keep the issue open for item 3 and optional item 4, or change 'Closes' to 'Addresses'."
},
{
"id": "F2",
"severity": "nit",
"outcome": "open",
"file": "apps/server/src/orchestration-v2/PullRequestSyncReactor.ts",
"line": 393,
"summary": "Open or unsynced links on settled threads are reread every 15 minutes with no age limit, including ones in the 'missing' set. Abandoned open pull requests and deleted repositories keep costing a host read each interval for as long as the link exists. This is acceptable now (the issue asked for it), but a cap such as no reads after N days settled would bound GitHub API use as settled lanes pile up."
}
]
}Review by Claude Opus 5.5 (Claude Code, via T3 Code). This is an automated technical review, not human approval. |
{
"reviewed_base": "caf9ebeb0cae23bee584f7b0acf3856fb6f6cada",
"reviewed_head": "d1330429f200d24d943d5627cbd8aa3fbb7ebd01",
"reviewer": "Gemini 4 Carbon (High), Antigravity",
"author_session": "mcp:launch:3e368848c32c998138e477993eaa5d4c7584ac27d683359da7aec7c0fa424e92",
"reviewer_session": "mcp:launch:4d799ee525ad7dcffd2251244b224bf13140cb26c41e7b6d9d98f3140bc2f74c",
"fresh_context": true,
"review_kind": "full",
"round_id": "mcp:launch:4d799ee525ad7dcffd2251244b224bf13140cb26c41e7b6d9d98f3140bc2f74c",
"intent": [
"nullStack65/closura-agent-config issue #916 item 1: keep sweeping open pull request links on settled threads until terminal",
"nullStack65/closura-agent-config issue #916 item 2: dedupe lane-ended alerts per thread and open-PR set across runs and clear on settle",
"nullStack65/closura-agent-config issue #916 item 3: re-read pull request state before delivering lane-ended alerts rather than trusting a stale snapshot"
],
"prior_findings": [],
"findings": [
{
"id": "F1",
"severity": "important",
"outcome": "fixed",
"file": "apps/server/src/orchestration-v2/ThreadEventAlerts.ts",
"line": 225,
"summary": "Deduplicating completed open-PR lane-ended findings by `open-prs:...` while `threadEventAlert` stamps `runId: shell.latestRunId` and `ModelAlertReactor.currentAlert` checks `alertIsStale(shell, alert.runId)` drops all alerts when a second run completes before the first run's outbox entry is delivered (e.g. during `busyWatcherHold`): Run 2 is skipped via `state.reported`, Run 1's queued alert is dropped as superseded by `run:2`, and `afterDrop` leaves `open-prs:...` in `state.reported` permanently.",
"check": "fixed in 018491d20c2d: open-PR lane-ended alerts skip run staleness and a dropped undelivered report is forgotten"
},
{
"id": "F2",
"severity": "important",
"outcome": "fixed",
"file": "apps/server/src/orchestration-v2/ModelAlertReactor.ts",
"line": 1151,
"summary": "nullStack65/t3code pull request #209 closes nullStack65/closura-agent-config issue #916 without implementing requested fix item 3 (re-reading pull request state at delivery rather than trusting a stale snapshot): `currentAlert` evaluates `threadEventStillHolds` only against cached `shell.pullRequests`, so a pull request merged or closed externally within the 1m/5m sync interval (or newly linked with `snapshot: null`) still delivers a false `lane-ended` open-PR wake.",
"check": "fixed in 018491d20c2d: delivery rereads open links from the host (cache bypassed) and re-judges"
},
{
"id": "F3",
"severity": "nit",
"outcome": "fixed",
"file": "apps/server/src/orchestration-v2/PullRequestSyncReactor.ts",
"line": 884,
"summary": "Comment `// Settled threads are not swept, so read their links once to settle with fresh status.` is now stale after `isDue` started sweeping open/unsynced links on settled threads on `SLOW_SYNC_INTERVAL_MS`; also `ThreadEventAlerts.ts:219` can use `threadPullRequestKeyOf(link)` for canonical case-insensitive host/repository keys.",
"check": "fixed in 018491d20c2d: comment updated; signature uses threadPullRequestKeyOf"
}
]
}Independent Review Summary (
|
… state at delivery F1: an open-PR lane-ended report is shared by every run with the same open pull requests, so a newer run no longer marks its queued alert stale (the re-judge still drops it once the lane runs again, fails, or the open set changes), and a dropped undelivered report is forgotten so the next run end can report it. F2: before delivering an open-PR lane-ended alert, reread its open links from the host (cache bypassed) and re-judge against those states, so a pull request merged or closed within the sync interval no longer sends a false wake. A failed read keeps the stored snapshot. Also: fix the stale settled-thread comment and key the signature with threadPullRequestKeyOf. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Focused re-check: refresh open pull requests on settled threads and dedupe the lane-ended alertVerdict: the re-check is clean. All three findings from the Gemini review round, which covered head Scope: Findings
Not blocking: no reactor-level test drives Checks at head {
"reviewed_base": "caf9ebeb0cae23bee584f7b0acf3856fb6f6cada",
"reviewed_head": "d1330429f200d24d943d5627cbd8aa3fbb7ebd01",
"rechecked_head": "018491d20c2d59e856896df10ccdace09703ddbd",
"reviewer": "Claude Opus 5.5 (claude-opus-5-5), Claude Code via T3 Code",
"author_session": "mcp:launch:3e368848c32c998138e477993eaa5d4c7584ac27d683359da7aec7c0fa424e92",
"reviewer_session": "claude-code:0c935e85-ca60-4b0f-932c-93337bb2c37c",
"fresh_context": true,
"review_kind": "focused_recheck",
"round_id": "mcp:launch:4d799ee525ad7dcffd2251244b224bf13140cb26c41e7b6d9d98f3140bc2f74c",
"intent": [
"nullStack65/closura-agent-config issue #916 item 1: keep sweeping open pull request links on settled threads until terminal",
"nullStack65/closura-agent-config issue #916 item 2: dedupe lane-ended alerts per thread and open-PR set across runs and clear on settle",
"nullStack65/closura-agent-config issue #916 item 3: re-read pull request state before delivering lane-ended alerts rather than trusting a stale snapshot"
],
"prior_findings": ["F1", "F2", "F3"],
"findings": [
{
"id": "F1",
"severity": "important",
"outcome": "confirmed",
"file": "apps/server/src/orchestration-v2/ThreadEventAlerts.ts",
"line": 225,
"summary": "Deduplicating completed open-PR lane-ended findings by `open-prs:...` while `threadEventAlert` stamps `runId: shell.latestRunId` and `ModelAlertReactor.currentAlert` checks `alertIsStale(shell, alert.runId)` drops all alerts when a second run completes before the first run's outbox entry is delivered (e.g. during `busyWatcherHold`): Run 2 is skipped via `state.reported`, Run 1's queued alert is dropped as superseded by `run:2`, and `afterDrop` leaves `open-prs:...` in `state.reported` permanently.",
"check": "confirmed at 018491d20c2d by the range-diff since d1330429f200: currentAlert passes runId null to stillCurrent for open-prs lane-ended alerts (ModelAlertReactor.ts:1185-1186), the re-judge still gates live/failed/changed-set, and afterDrop forgets an undelivered open-prs signature via forgetDroppedOpenPrReport (ModelAlertReactor.ts:394-405, 670); new ModelAlertReactor.test.ts case passes; 181/181 focused tests pass",
"rechecked_head": "018491d20c2d59e856896df10ccdace09703ddbd"
},
{
"id": "F2",
"severity": "important",
"outcome": "confirmed",
"file": "apps/server/src/orchestration-v2/ModelAlertReactor.ts",
"line": 1151,
"summary": "nullStack65/t3code pull request #209 closes nullStack65/closura-agent-config issue #916 without implementing requested fix item 3 (re-reading pull request state at delivery rather than trusting a stale snapshot): `currentAlert` evaluates `threadEventStillHolds` only against cached `shell.pullRequests`, so a pull request merged or closed externally within the 1m/5m sync interval (or newly linked with `snapshot: null`) still delivers a false `lane-ended` open-PR wake.",
"check": "confirmed at 018491d20c2d: withHostPrStates (ModelAlertReactor.ts:1208-1234) rereads open/unsynced links via PullRequestService.summary with bypassCache true and re-judges on withPullRequestStates (ThreadEventAlerts.ts:124-134); a merged/closed link leaves the open set so the signature no longer matches and the alert drops; PullRequestService is provided around ModelAlertReactor.layer in server.ts:1017-1021; typecheck exit 0",
"rechecked_head": "018491d20c2d59e856896df10ccdace09703ddbd"
},
{
"id": "F3",
"severity": "nit",
"outcome": "fixed",
"file": "apps/server/src/orchestration-v2/PullRequestSyncReactor.ts",
"line": 884,
"summary": "Comment `// Settled threads are not swept, so read their links once to settle with fresh status.` is now stale after `isDue` started sweeping open/unsynced links on settled threads on `SLOW_SYNC_INTERVAL_MS`; also `ThreadEventAlerts.ts:219` can use `threadPullRequestKeyOf(link)` for canonical case-insensitive host/repository keys.",
"check": "fixed at 018491d20c2d: comment rewritten (PullRequestSyncReactor.ts:884) and openPrSignature uses threadPullRequestKeyOf (ThreadEventAlerts.ts:248)",
"rechecked_head": "018491d20c2d59e856896df10ccdace09703ddbd"
}
]
} |
{
"reviewed_base": "caf9ebeb0cae23bee584f7b0acf3856fb6f6cada",
"reviewed_head": "d1330429f200d24d943d5627cbd8aa3fbb7ebd01",
"rechecked_head": "018491d20c2d59e856896df10ccdace09703ddbd",
"reviewer": "Gemini 4 Carbon (High), Antigravity",
"author_session": "mcp:launch:3e368848c32c998138e477993eaa5d4c7584ac27d683359da7aec7c0fa424e92",
"reviewer_session": "mcp:launch:2c5bfccb5d3ed84d3051037db76d950aea1bb5ec959f597b50a9fefc75bce621",
"fresh_context": true,
"review_kind": "focused_recheck",
"round_id": "mcp:launch:4d799ee525ad7dcffd2251244b224bf13140cb26c41e7b6d9d98f3140bc2f74c",
"intent": [
"nullStack65/closura-agent-config issue #916 item 1: keep sweeping open pull request links on settled threads until terminal",
"nullStack65/closura-agent-config issue #916 item 2: dedupe lane-ended alerts per thread and open-PR set across runs and clear on settle",
"nullStack65/closura-agent-config issue #916 item 3: re-read pull request state before delivering lane-ended alerts rather than trusting a stale snapshot"
],
"prior_findings": [
"F1",
"F2",
"F3"
],
"findings": [
{
"id": "F1",
"severity": "important",
"outcome": "confirmed",
"file": "apps/server/src/orchestration-v2/ThreadEventAlerts.ts",
"line": 225,
"summary": "Deduplicating completed open-PR lane-ended findings by `open-prs:...` while `threadEventAlert` stamps `runId: shell.latestRunId` and `ModelAlertReactor.currentAlert` checks `alertIsStale(shell, alert.runId)` drops all alerts when a second run completes before the first run's outbox entry is delivered (e.g. during `busyWatcherHold`): Run 2 is skipped via `state.reported`, Run 1's queued alert is dropped as superseded by `run:2`, and `afterDrop` leaves `open-prs:...` in `state.reported` permanently.",
"check": "confirmed at 018491d20c2d via git range-diff since d1330429f200 and Node v26.13.1 checks: currentAlert passes runId null to stillCurrent for open-prs lane-ended alerts (ModelAlertReactor.ts:1185-1186), re-judge drops live/failed/settled/changed-set alerts, and afterDrop clears undelivered open-prs signatures via forgetDroppedOpenPrReport (ModelAlertReactor.ts:394-405, 670); vp lint, vp run --filter t3 typecheck, and 181/181 focused orchestration tests passed",
"rechecked_head": "018491d20c2d59e856896df10ccdace09703ddbd"
},
{
"id": "F2",
"severity": "important",
"outcome": "confirmed",
"file": "apps/server/src/orchestration-v2/ModelAlertReactor.ts",
"line": 1151,
"summary": "nullStack65/t3code pull request #209 closes nullStack65/closura-agent-config issue #916 without implementing requested fix item 3 (re-reading pull request state at delivery rather than trusting a stale snapshot): `currentAlert` evaluates `threadEventStillHolds` only against cached `shell.pullRequests`, so a pull request merged or closed externally within the 1m/5m sync interval (or newly linked with `snapshot: null`) still delivers a false `lane-ended` open-PR wake.",
"check": "confirmed at 018491d20c2d via git range-diff since d1330429f200 and Node v26.13.1 checks: withHostPrStates (ModelAlertReactor.ts:1208-1234) rereads open and unsynced links via PullRequestService.summary with bypassCache: true and recoverTransientFailure: false, falling back to stored state on non-interrupt failures, and re-judges on withPullRequestStates (ThreadEventAlerts.ts:123-134); vp lint, vp run --filter t3 typecheck, and 181/181 focused orchestration tests passed",
"rechecked_head": "018491d20c2d59e856896df10ccdace09703ddbd"
},
{
"id": "F3",
"severity": "nit",
"outcome": "fixed",
"file": "apps/server/src/orchestration-v2/PullRequestSyncReactor.ts",
"line": 884,
"summary": "Comment `// Settled threads are not swept, so read their links once to settle with fresh status.` is now stale after `isDue` started sweeping open/unsynced links on settled threads on `SLOW_SYNC_INTERVAL_MS`; also `ThreadEventAlerts.ts:219` can use `threadPullRequestKeyOf(link)` for canonical case-insensitive host/repository keys.",
"check": "confirmed fixed at 018491d20c2d: comment updated in PullRequestSyncReactor.ts:884 and openPrSignature uses threadPullRequestKeyOf in ThreadEventAlerts.ts:248",
"rechecked_head": "018491d20c2d59e856896df10ccdace09703ddbd"
}
]
}Focused Re-check (
|
Addresses
nullStack65/closura-agent-config#916:Changes
PullRequestSyncReactor.ts: Keep sweeping open/unsynced pull request links (snapshot === null || snapshot.state === "open") on settled threads onSLOW_SYNC_INTERVAL_MS(15m) until they reach a terminal state (mergedorclosed), so PRs merged/closed after settle do not stay stuck as"open". Terminal (closed/merged) links on settled threads are not swept.ThreadEventAlerts.ts:lane-endedalerts by the sorted open-PR set (open-prs:<sorted-keys>) instead ofshell.latestRunId, preventing repeated alerts across completed runs of the same lane."lane-ended"inKINDS_BY_TRIGGER.settledso settling a thread clears/re-evaluateslane-endedstate.PullRequestSyncReactor.test.ts(62/62 passing) and added unit tests inThreadEventAlerts.test.ts(48/48 passing) covering settled open-link slow-cadence refresh, open-PR-set deduplication across runs, and settle clearing.Closes nullStack65/closura-agent-config#916
Deploy: fleet