Repository navigation
fix(beam): stop mirroring after service shutdown - #126589
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 23, 2026, 6:08 PM ET / 22:08 UTC. ClawSweeper reviewWhat this changesThis PR makes Beam stop an active session-mirroring scan during plugin shutdown, preventing late catalog results from starting transcript reads or mirror uploads. Merge readinessThe revised Beam lifecycle patch addresses the prior stalled-catalog blocker and has no actionable correctness finding; it remains open for normal maintainer handling because current main and the latest release do not contain the repair. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — execution before step 1 Assertions:
How this fits togetherBeam mirrors selected local session transcripts to a configured receiver. Its background scan reads the active session catalog and delivers uploads, while the plugin-service lifecycle starts and stops that scan during Gateway operation and reload. flowchart LR
A[Active session catalogs] --> B[Beam mirror scan]
C[Plugin stop or reload] --> D[Runner abort]
D --> B
B --> E[Transcript read]
E --> F[Guarded upload]
F --> G[Configured receiver]
D --> H[Joined transport cleanup]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +61, Tests +258. Total +319 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one Beam-owned abort boundary that detaches unabortable catalog work, fences every later side effect, and joins only already-acquired transport cleanup. Do we have a high-confidence way to reproduce the issue? Yes: current main clears only the timer while an already-started catalog promise can continue; the revised service-level test models that exact withheld-list sequence, although this read-only review did not execute it. Is this the best way to solve the issue? Yes: the runner that initiates catalog reads and uploads now owns the terminal abort signal, instead of asking the service caller to compensate for late results. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 977bbe266772. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Land-ready verification for
ClawSweeper's prior P2 and rank-up moves are addressed on this head: shutdown completes while catalog work remains pending, and late catalog settlement cannot start reads or uploads. The refreshed publisher review is still queued, but there are no unresolved head-specific findings. |
|
Merged via squash.
|
* fix(beam): stop mirror work after service shutdown * fix(beam): avoid waiting on stalled catalogs during shutdown * refactor(beam): tighten catalog abort cleanup
AI-assisted: yes
What Problem This Solves
Fixes an issue where disabling or reloading the Beam mirror while a catalog scan was already running could let that scan continue processing local session data after the service had stopped, or leave Gateway reload waiting for a stalled catalog operation.
Why This Change Was Made
The Beam runner owns one abortable active scan and races non-cancellable session-catalog list/read operations against its lifecycle signal, so shutdown completes promptly even when catalog I/O remains pending. Late catalog results cannot resume transcript reads, uploads, or session updates. Guarded network delivery receives the same signal, but shutdown still awaits response-body cancellation and guarded resource release after transport abort. Overlapping timer ticks join the same active scan.
User Impact
Removing mirror consent, stopping the plugin, or reloading its configuration now takes effect promptly as a terminal lifecycle boundary: no later transcript read or mirror delivery begins from the retired service instance, while in-flight network resources are cleaned up before shutdown completes.
Evidence
AssertionError: expected false to be truebecause service shutdown remained pending while the catalog promise was unreleased.node scripts/run-vitest.mjs extensions/beam/src/mirror.test.ts(32 tests passed)node_modules/.bin/oxfmt extensions/beam/src/mirror.ts extensions/beam/src/mirror.test.tsnode scripts/run-tsgo.mjs -p tsconfig.extensions.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/extensions.tsbuildinfonode scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.extensions.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/extensions-test.tsbuildinfonode scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.extensions.json extensions/beam/src/mirror.test.ts extensions/beam/src/mirror.tsgit diff --check