Repository navigation
fix(gateway): retry unstarted chat sends across restarts - #173389
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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
|
Codex review: needs maintainer review before merge. What this changesThis PR preserves retryable restart refusals and lets existing native chat outboxes resend unstarted messages with their original IDs. Example: The message “survive the restart” waits for session admission when the Gateway restarts.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it repairs a current restart-recovery gap, has established maintainer direction, and introduces no discrete correctness or security defect found in this review. Priority: P1 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherAuthenticated chat requests pass through Gateway preparation and session admission before execution; existing client outboxes retain rejected input and reconcile accepted or uncertain sends through receipts and history. flowchart TD
A[Chat client outbox] --> B[Authenticated request dispatch]
B --> C[Request preparation]
C --> D[Session admission]
D --> E[Agent execution]
C --> F[Retryable restart refusal]
D --> F
F --> A
E --> G[Receipts and history]
Technical reviewBest possible solution: Preserve authoritative pre-execution restart refusals and let the existing route-bound outboxes retry unchanged message IDs. Do we have a high-confidence way to reproduce the issue? Current-main source shows discarded restart metadata and terminal pending-admission abort receipts; the PR reports before/after Gateway regressions, but no target code was executed during this read-only review. Is this the best way to solve the issue? The patch repairs the refusal and admission owners while preserving explicit Stop, uncertain-delivery reconciliation, original routes, and existing retry budgets. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 9c0abff89adf. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +21, Tests +225, Docs +13. Total +259 across 12 files. Added test files: 0. View PR surface stats
Review metrics
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 Reviewed October 15, 2026, 2:45 PM ET / 18:45 UTC. |
|
Landed as fbc9fad under the authorized unrelated-infrastructure exception, with exact reviewed head CI run 38789484402, attempt 1 has one underlying failure: iPad screenshots passed all four app tests, then unchanged simulator discovery reported Tested merge The other 76 checks passed, including security, affected Gateway lanes, Android tests/lint/native-access checks, iPhone screenshots, PostgreSQL conformance, and shared-kit analysis. Independent review was clean. No CI rerun was requested. Swift behavioral regressions compiled but were not executed by this CI plan; shipped-client restart/reconnect proof remains a gap. Apple live attachment sends still restore the draft for manual retry. |
…3389) * fix(gateway): retry unstarted chat sends across restarts * style(android): format restart retry handling
What Problem This Solves
Fixes unstarted chat messages becoming terminal failures when a Gateway restart interrupts request preparation or queued session admission.
User Impact
Control UI and native chat outboxes retain the original message ID and retry eligible rejected sends when the Gateway is available again. Explicit Stop stays terminal. Apple live sends with attachments still restore the draft for manual retry; already queued attachments use outbox recovery.
Why This Change Was Made
Request-entry shutdown already threw a retryable error, but WebSocket dispatch discarded its metadata. Pending chat admission also wrote a successful terminal abort receipt despite never starting execution. Preserve the structured pre-execution restart refusal and let the existing outbox own retry. Reuse request-entry validation for credential-barrier waiters instead of maintaining a second shutdown response.
Active main-session agent/embedded work already checkpoints through the existing recovery owner before shutdown cancellation. No second recovery store, schema change, generic replay of uncertain RPC writes, or drain-budget extension is introduced.
Evidence
Deploy drain counters overlap and include internal recovery work; they cannot measure unique lost user requests. The expected loss for the tested, authoritative pre-execution rejection cases is zero after successful reconnect, versus terminal failure before. A production-wide lost-items reduction remains unquantified. This is a requested correctness fix, not a latency benchmark; the drain budget remains unchanged. Production LOC: +23 net across seven files. This growth supplies the missing pre-execution error contract and native retry classification; the duplicate credential-barrier shutdown response is deleted, and existing outbox/recovery owners are retained.
Final local proof: request-entry 13/13 (76.15s), affected credential-barrier cases 2/2 after consolidation (49.04s), queued-admission 15/15 (46.43s), Control UI reconnect/backoff retry cases 2/2 (7.80s), changed-file core lint and formatting, Swift parser/SwiftFormat, and
git diff --check. Gateway tests use the real kernel/lifecycle ownership; compiler preparation dominates wall time. Broad checks use PR CI; no Testbox/Crabbox leases or production mutations were used.PR CI evidence
Final head:
32cc7e7e80bfb120523852fab39950552e52efbf; CI run 38789484402, attempt 1. Affected Gateway lanes, all three Android test variants, Android ktlint, both Android native-access configurations, iPhone screenshots, core typechecks, and both shared-kit compilation scans passed. All other executed validation checks passed, including PostgreSQL conformance and the shared-kit analysis intersection. The CI gate is red solely because of the attributed simulator-inventory failure below; security checks passed.Initial-head CI found three Kotlin newline violations. The follow-up commit changes whitespace only; both changed files passed ktlint 1.8.0 locally and independent review, and final-head CI confirms the correction. The first run also had HTTP 504 failures downloading WebRTC and OpenGrep, plus a Watch simulator-creation failure. No CI reruns were requested.
The final-head iPad screenshot job 116610932878 passed all four app screenshot tests, then failed with
No available Apple Watch simulators found.The repository failure classifier reportsunknown: No matching job on main, with no Vitest failures to rerun. Manual attribution identifies a runner simulator-inventory failure:apps/ios/fastlane/Fastfileis identical in tested main parent4d50e81f6c9e23dd16bc34984c0f644783771badand tested merge08a73bd924975e552ca3d4899cd730effe73b530(blobbf48f6e9a4234ab2d844faa05ddab0433de8df90). The CI workflow and iOS project definition also match byte-for-byte. The failure occurs in unchanged simulator discovery after app tests succeed, before any Watch test executes. This is source-and-log attribution, not a claim that an equivalent main CI job ran.Apple live attachment sends still require manual draft retry, and Swift behavioral regressions were compiled but not executed by this PR's CI plan. Production-wide lost-item counts remain unknown.