Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs changes before merge. What this changesThe PR bounds Signal shutdown draining with a progress-aware 30-second idle window and blocks late replies after delivery retirement. Example: An accepted Signal receive remains unfinished when the operator restarts the channel.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial Merge readiness⛔ Needs changes before merge - 1 item remains Keep this PR open: it addresses a current shutdown hang, but the previously reported ingress-owner retirement defect still blocks safe channel restart. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe Signal monitor receives signal-cli events, durably queues them, dispatches inbound turns, and drains ingress and reply work before completing channel shutdown. flowchart TD
A[Signal CLI events] --> B[Signal monitor]
B --> C[Durable ingress queue]
C --> D[Inbound handler]
D --> E[Reply transport]
B --> F[Bounded task drain]
F --> G[Ingress disposal and daemon exit]
Technical reviewBest possible solution: Coordinate the bounded callback drain with the existing shared ingress owner's settlement-safe disposal before reporting Signal shutdown complete. Do we have a high-confidence way to reproduce the issue? Current main's unbounded teardown is source-reproducible, and the contributor supplies a production-monitor trace of bounded return; this review executed no target code. Is this the best way to solve the issue? The progress-aware timeout and transport retirement checks are useful, but timing out the caller does not complete the shared ingress ownership lifecycle. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 133b8ec1d5b2. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +109, Tests +562. Total +671 across 10 files. Added test files: 3. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (4 earlier review cycles)
Reviewed October 21, 2026, 1:22 AM ET / 05:22 UTC (Revision 5). |
46d99a1 to
9dd1437
Compare
Extract createSignalMonitorTaskRunner and return after 30s with no in-flight progress so gateway stop cannot hang on a stuck receive. Keep main createSignalNativeReplyIdPlan. Signed-off-by: Sebastien Tardif <[email protected]>
Race ingress stop with the 30s idle window so a hung attachment fetch or handler delivery cannot hide waitForIdle. Log leftover work and leave the in-flight reply running so accepted claims are not dropped. Signed-off-by: Sebastien Tardif <[email protected]>
c701039 to
d027270
Compare
|
Production-boundary proof on tip
The 15s tool-result idle workaround is gone. #142775 owns that synchronization. Not tested: a real signal-cli phone session. Production @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
Knip production unused-export scan rejected the exported SIGNAL_MONITOR_IDLE_TIMEOUT_MS. Tests keep a local 30s constant. Signed-off-by: Sebastien Tardif <[email protected]>
Bound ingress stop and waitForIdle with a shared progress-aware idle window, then wait for observed daemon exit. Drain accepted work before stopping the transport on non-abort teardown. Signed-off-by: Sebastien Tardif <[email protected]>
|
Teardown repairs on tip
Live production monitor plus native SSE (isolated [ 233ms] REPLY dispatchReplyFromConfig entered; holding unfinished reply
[ 235ms] QUEUE before abort claims=1 pending=0 ids=["number:+15550001111",1]
[ 236ms] STOP abort signaled
[30239ms] ERR signal waitForIdle made no progress within 30000ms; continuing teardown with 1 task(s) still in flight and ingress stop pending
[30239ms] DONE monitorSignalProvider returned after 30239ms (abort at 235ms)
[30240ms] QUEUE after return claims=1 pending=0
PROOF_OK returned_after_abort_ms=30004 leftover=1Not tested: a real signal-cli phone session, and same-account restart while the old handler is still alive. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Keep the Signal idle-timeout runner and the retirement handoff. Run the shutdown-bound monitor test on the database-worker fork pool, because shared-state admission requires the host thread. Wait up to 10s for durable admit to reach the reply. A hung attachment RPC stays rejectable so ingress stop can finish after the idle fence. Signed-off-by: Sebastien Tardif <[email protected]>
The media-read test declared an inner retired binding. Current oxlint rejects that with no-shadow. The local flag tracks the media read. Signed-off-by: Sebastien Tardif <[email protected]>
The retirement check still runs before every send. The abort check stays on the durable send, where it already lived on main. Checking it before a block reply dropped the send when the test stream aborted after ingress looked idle. Signed-off-by: Sebastien Tardif <[email protected]>
|
This pull request has been automatically marked as stale due to inactivity. |
|
This pull request has been automatically marked as stale after 7 days without qualifying human activity. |
|
Closing due to inactivity. |
What Problem This Solves
Fixes an issue where operators stopping the Gateway or restarting the Signal channel could wait forever when a Signal receive never finished. Teardown used to await ingress stop (admission, pump, and active deliveries) before the task-runner idle window. A hung attachment fetch or handler delivery never started that window, so
gateway stopand channel restart never returned.Why This Change Was Made
The Signal monitor already tracks receive and reply work so teardown can drain. The runner in
extensions/signal/src/monitor/task-runner.tsstill returns after 30 seconds with no task or ingress-stop completing. Ingress stop shares that progress-aware window, so a delivery that finishes at 25s resets the deadline for later work. Observed daemon exit stays outside that window: a stuck signal-cli cannot report the channel complete while it still owns the port or config lock. On non-abort teardown, accepted work drains before the daemon is stopped. Leftover receive/reply work is logged and left running. Accepted ingress claims stay in the queue. The 15-second tool-result idle workaround is gone; #142775 now owns that synchronization.User Impact
Operators can stop the Gateway or restart Signal even when one inbound receive or reply is stuck. After that idle drain gives up, a later text chunk or a send that finished loading an attachment does not call signal-cli. An allowed send still does.
Evidence
Live
node/tsxagainst productionmonitorSignalProviderplus the native Signal HTTP SSE client, after the daemon-exit and progress-aware drain repair. A local fake signal-cli accepted the SSE connection, emitted onereceiveevent, and helddispatchReplyFromConfigas an unfinished reply. After abort, receive-work drain returned at 30004ms, logged leftover tasks and pending ingress stop, and kept the durable claim. Releasing the reply after return did not drop the accepted message.Head
2dc45ba5a4ca8a9b489762ba630c1f85497bc3b2merges current main and keeps that idle fence and the send handoff. The shutdown-bound monitor tests passed on that tree: hung reply returns after the idle window, an accepted attachment claim stays queued, and teardown does not finish while daemon stop is still pending.The signal-cli and chunk transcripts below are from parent
b4f81417f4c5397ccaaf793d469e3a6e9c8e376e, which this merge still contains. That head passes the retirement check through the send handoff. A local JSON-RPC peer accepted the first 4-character chunk ofabcdefghijand did not receiveefghorijafter retirement. A media read that retired the caller produced no RPC. signal-cli 0.14.8 on127.0.0.1:8765answered an allowed send withMethod requires valid account parameter. The same send after a media read retired the caller withsignal delivery retired before sendand did not receive that account error.Real behavior proof
Behavior or issue addressed: After the Signal monitor idle drain gives up, later chunks and a send that finished loading media do not call signal-cli. An allowed send still reaches it. Teardown still returns after the 30 second idle window and keeps the accepted claim.
Real environment tested: macOS, Node v26.10.0, signal-cli 0.14.8, head b4f8141. Local JSON-RPC peer at 127.0.0.1, and signal-cli's HTTP daemon at 127.0.0.1:8765 with no registered account.
Exact steps or command run after this patch: Start signal-cli 0.14.8 with
daemon --http 127.0.0.1:8765 --receive-mode manual. Call productionsendMessageSignalonce with the handoff allowed, then again after a media read marks the caller retired. Separately, call productiondeliverRepliesagainst a local JSON-RPC peer with a 4-character chunk limit.Evidence after fix: terminal output copied below.
Observed result after fix: The first chunk
abcdwas sent.efghandijwere not. A media read that marked the caller retired produced zero RPC requests. signal-cli answered the allowed send with Method requires valid account parameter. The retired media send stopped with signal delivery retired before send.What was not tested: A registered phone account and a same-account restart while the old handler is still alive. Production getAttachment HTTP still uses a 10-second client deadline, so a live RPC hang cannot last the full 30-second window. signal-cli was not started again on the merge commit.
Related
a0fb7fb04547, 2026-05-10)