Repository navigation
fix(signal): publish terminal status on permanent SSE rejection - #136178
Conversation
runSignalSseLoop's catch block treated every reconnect failure identically, always publishing lifecycle:'recovering' and retrying forever -- including a 401 status-carrying rejection that means the signal-cli daemon permanently rejects the account (unregistered or unlinked identity), not a transient network blip. Discriminate the 401 case, publish the shared channelBlockedPatch terminal status with an actionable re-link message, and stop the retry loop instead of looping on the generic recovering status forever.
The prior wording asserted the account was unregistered/unlinked as the sole cause of a 401 SSE rejection. signal-cli's own HTTP daemon does not document 401 as exclusively an account-registration signal, and a daemon run behind an operator's own auth proxy could return the same status for a misconfigured proxy credential. Cover both plausible causes instead of asserting one.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs changes before merge. Reviewed September 2, 2026, 4:50 AM ET / 08:50 UTC. ClawSweeper reviewWhat this changesThe PR makes a native Signal SSE 401 publish a terminal blocked channel status with operator recovery guidance instead of retrying indefinitely. Merge readinessKeep open: the PR addresses a real Signal status gap and supplies credible boundary-level before/after evidence, but its new terminal decision derives protocol state from a formatted error message rather than a structured client result. Priority: P2 Review scores
Verification
How this fits togetherThe Signal plugin opens an SSE event stream to the Signal daemon and reports connection lifecycle to the Gateway. The Gateway retains terminal channel status so health checks and operators see that manual recovery is required. flowchart LR
A[Signal daemon] --> B[Native SSE client]
B --> C[Signal reconnect loop]
C --> D{HTTP failure status}
D -->|401| E[Blocked channel status]
D -->|other failure| F[Retrying status]
E --> G[Gateway health and operator]
F --> G
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +19, Tests +23. Total +42 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Carry the native SSE HTTP status in a typed error or result at the client boundary, then retain the existing 401 blocked-status behavior and generic retry handling for non-401 failures. Do we have a high-confidence way to reproduce the issue? Yes—current source proves that native non-2xx SSE responses become generic errors and enter the retry path, and the PR body includes a before/after production-entry-point harness trace for a 401 and transient control. Is this the best way to solve the issue? No—the terminal 401 policy is appropriate and reaches the correct Gateway status owner, but formatting an Error message as the status protocol is weaker than carrying the status structurally from the native client. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against fae30c7106b6. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What 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
|
…regex
sse-reconnect.ts detected the 401 terminal case by regex-parsing
client.ts's formatted `Signal SSE failed (${status} ${statusText})`
Error.message. A wording or wrapping change in the producer would
silently break the match and route a permanent rejection back into
the infinite retry path.
client.ts now throws SignalSseRejectionError, carrying the HTTP
status as a typed field; sse-reconnect.ts reads it directly. Mirrors
the WhatsApp channel's own precedent (session-errors.ts getStatusCode
reads a structured status field, never regex on message text).
Addresses ClawSweeper findings 3f796596872acbd1 / 611efac52d052c28 on
PR openclaw#136178.
# Conflicts: # test/scripts/ci-linux-git.test.ts
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Thanks @masatohoshino! Proof: A production Signal channel against a protocol-real HTTP 400 SSE endpoint made one request, stopped reconnecting, and published blocked terminal status. An HTTP 503 control kept reconnecting and remained recovering.
|
Reuse the gateway CLI fixture cleanup from #136469 (667ce2b) and the landed startup-recovery queue assertions from #136473 (564e544). These address independent lint and shared-worker test failures while preserving all process, state, cancellation, and survivor assertions. Keep Vincent Koc's scanner implementation and original PR ancestry unchanged. The new commit also refreshes pull-request CI against main's authenticated checkout repair from #136178.
Remove the temporary copies of the CLI fixture and startup queue test fixes. Main now owns the CLI suite split in aef65cc and queue assertions in #136473. Keeping the earlier fixture cleanup here conflicts with main's new shared test support and health suite. Restore the cumulative PR tree exactly to Vincent Koc's reviewed 4a35cef without replacing his ancestry. The merge then retains main's canonical test repairs and authenticated checkout fix from #136178.
…claw#136178) ## What Problem This Solves The native Signal Server-Sent Events (SSE) client retried every non-success HTTP response forever. Operators saw a generic recovering status even when the daemon had definitively rejected the request and needed a configuration fix. ## Why This Change Was Made The native client now preserves the HTTP status in a typed `SignalSseRejectionError` instead of leaving reconnect policy to parse error text. The reconnect owner publishes the shared blocked terminal status for permanent 4xx responses and settles after one attempt. HTTP 408, 425, and 429 remain retryable. Network errors, stream ends, 5xx responses, receive-handler failures, managed-daemon exits, and the container WebSocket transport retain their existing recovery policy. This matches signal-cli v0.14.7: its native event endpoint returns permanent 400, 404, 405, and 421 request rejections, while handler failure returns 500. ## User Impact `openclaw channels status` now shows a stopped, blocked Signal account with a terminal disconnect and recovery guidance after a permanent native SSE rejection. Transient failures still reconnect automatically. ## Evidence - Current main `1e38dfcc25c77a2412aaa0f8b344c76a4cf85714`: a production Signal channel against a local HTTP 400 SSE endpoint made eight requests and remained `running: true`, `lifecycle: "recovering"`, without a terminal flag. - Repaired head `3c1793b688151c3ca5b5421546b053706eedcf68`: the same product path made one request and reported `running: false`, `lifecycle: "blocked"`, `terminalDisconnect: true`, and `healthState: "terminal-disconnect"`. - Transient control on the repaired head: after `channels.start`, an HTTP 503 endpoint received six requests and status remained `running: true`, `lifecycle: "recovering"`, without a terminal flag. - Regression provenance: the new real-server test fails on current main because the permanent case reconnects a second time; the 503 control passes. - Focused tests: `node scripts/run-vitest.mjs extensions/signal/src/client.test.ts extensions/signal/src/client-adapter.test.ts extensions/signal/src/sse-reconnect.test.ts extensions/signal/src/sse-reconnect.real-server.test.ts` — 37 passed. - Checks: Oxfmt, Oxlint, conflict markers, import cycles, extension import boundaries, max-lines, assertion safety, coercion helpers, deprecated API use, and test-temp reporting passed. - CI repair: run `33621364324` completed its bundled and guard checks, then failed because three comparison-base fetches ran after authenticated checkout discarded its token. Those bases now arrive in the authenticated checkout; 419 focused workflow/Git-owner tests and the workflow guard passed. - Upstream contract: https://github.com/AsamK/signal-cli/blob/b01b6b370dc063599a1a2b9fde0f5ff4e2d78fe8/src/main/java/org/asamk/signal/http/HttpServerHandler.java#L169-L241 ## Test Audit The real-server regression crosses the production reconnect loop, client adapter, native HTTP client, and protocol endpoint. It adds no test-only production seam. The prior mocked 401-only test was removed because it could prove the mock without proving the changed boundary. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
The native Signal Server-Sent Events (SSE) client retried every non-success HTTP response forever. Operators saw a generic recovering status even when the daemon had definitively rejected the request and needed a configuration fix.
Why This Change Was Made
The native client now preserves the HTTP status in a typed
SignalSseRejectionErrorinstead of leaving reconnect policy to parse error text.The reconnect owner publishes the shared blocked terminal status for permanent 4xx responses and settles after one attempt. HTTP 408, 425, and 429 remain retryable. Network errors, stream ends, 5xx responses, receive-handler failures, managed-daemon exits, and the container WebSocket transport retain their existing recovery policy.
This matches signal-cli v0.14.7: its native event endpoint returns permanent 400, 404, 405, and 421 request rejections, while handler failure returns 500.
User Impact
openclaw channels statusnow shows a stopped, blocked Signal account with a terminal disconnect and recovery guidance after a permanent native SSE rejection. Transient failures still reconnect automatically.Evidence
cb75c1a820cdb521c3f6e38d1bf431c518442b43: a production Signal channel against a local HTTP 400 SSE endpoint made eight requests and remainedrunning: true,lifecycle: "recovering", without a terminal flag.3c1793b688151c3ca5b5421546b053706eedcf68: the same product path made one request and reportedrunning: false,lifecycle: "blocked",terminalDisconnect: true, andhealthState: "terminal-disconnect".channels.start, an HTTP 503 endpoint received six requests and status remainedrunning: true,lifecycle: "recovering", without a terminal flag.node scripts/run-vitest.mjs extensions/signal/src/client.test.ts extensions/signal/src/client-adapter.test.ts extensions/signal/src/sse-reconnect.test.ts extensions/signal/src/sse-reconnect.real-server.test.ts— 37 passed.33621364324completed its bundled and guard checks, then failed because three comparison-base fetches ran after authenticated checkout discarded its token. Those bases now arrive in the authenticated checkout; 419 focused workflow/Git-owner tests and the workflow guard passed.Test Audit
The real-server regression crosses the production reconnect loop, client adapter, native HTTP client, and protocol endpoint. It adds no test-only production seam. The prior mocked 401-only test was removed because it could prove the mock without proving the changed boundary.