Repository navigation
fix(gateway): wait for recovery readiness in chat fixtures - #186287
Conversation
Join the public startup admission barrier before seeding recovery work. Keep the exactly-once regression assertions unchanged and add content-free recovery admission outcomes for operators.
|
🦞👀 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 waits for startup admission before seeding chat fixtures and logs recovery admission outcomes. Example: A recovery fixture seeds interrupted work with chargedAttempts set to 1.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR repairs a remaining recovery-fixture ordering defect and adds focused diagnostics; no actionable correctness or security finding was identified. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherGateway startup discovers orphaned sessions independently of startupSettled; chat fixtures consume its public admission signal, while chat.send normalizes, validates, and admits requests through existing recovery owners. flowchart LR
A[Gateway startup] --> B[Orphan discovery]
B --> C[Startup admission signal]
C --> D[Chat fixture seeding]
D --> E[Chat send admission]
E --> F[Recovery outcome log]
Technical reviewBest possible solution: Reuse the existing startup admission helper while preserving recovery assertions and keeping diagnostics inside the admission owner. Do we have a high-confidence way to reproduce the issue? Source confirms that startupSettled can finish before orphan discovery; the author reports a controlled reproduction demonstrating the resulting fixture interference, but this read-only review ran no target code. Is this the best way to solve the issue? The fixture change addresses the ordering assumption through an existing public signal, and the diagnostic uses the existing admission owner without adding another recovery path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b5fa1429870a. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +29, Tests +2, Docs +7. Total +38 across 3 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 27, 2026, 4:55 PM ET / 20:55 UTC. |
|
Admin-merging over This also fixes |
…186287) Join the public startup admission barrier before seeding recovery work. Keep the exactly-once regression assertions unchanged and add content-free recovery admission outcomes for operators.
What Problem This Solves
The
chat.sendorphan-recovery regression could observe a second recovery attempt after rejecting stale input. Its fixture awaitedstartupSettled, which intentionally does not join initial orphan recovery, then seeded interrupted work while the startup scan was still pending. That scan could independently recover the fixture row before the rejected request completed.This is the missed chat-fixture migration after #181289 separated startup recovery and #181470 introduced the public startup-readiness helper. Both commits are ancestors of the reported evidence build; the residual race is in this fixture. Production pre-admission already validates conflicting input, session incarnation, permission mode, and tool settings before reconciliation.
User Impact
Recovery tests now seed interrupted work after initial startup recovery settles. Operators gain a content-free recovery admission diagnostic. Runtime recovery and authorization behavior are unchanged.
Why This Change Was Made
Wait for the existing
/startupzadmission signal before returning the chat fixture. Every assertion inserver.chat.orphaned-recovery.test.tsremains unchanged.Add the requested structured
chat.send recovery admissionlog for non-Stop requests carrying main-session recovery custody. It recordsoutcome(rejected,admitted,retried),sessionIdHash, request/source/recovery run IDs, and the incomingchargedAttemptssnapshot. No raw session key or message content is logged. The restart-recovery guide documents the event.Production LOC: +30/−1, net +29, entirely for the requested observability. Fixture LOC: +2; original regression test unchanged. No schema, config, or recovery policy changes.
Evidence
A controlled reproduction delayed the real initial orphan scan until the fixture polled
/startupz, or until after synthetic row seeding when that wait was absent. Both sides ran the original assertions; temporary scheduling instrumentation is not included in the patch.Final committed head
c7c1c96e4450938765b42344ab05d47a48ab5155: 4 files, 62 tests passed withOPENCLAW_VITEST_RUNTIME=node node scripts/run-vitest.mjs src/gateway/server.chat.orphaned-recovery.test.ts src/gateway/server-methods/chat-restart-recovery.worker.test.ts src/gateway/server-methods/chat-send-pre-admission.test.ts src/gateway/server-methods/chat-send-dispatch-errors.test.ts --maxWorkers=1. The unchanged integration case passed in 59.5 seconds; the runner verified an unchanged source snapshot.Changed-file formatting/lint,
pnpm tsgo:core, configured commit content/format/freshness hooks, and test-line ratchet passed (38 lines of headroom; baseline untouched). Earlier cold runs hit the existing 90-second timeout on both base and candidate. One intermediate run was invalidated by a concurrent telemetry edit; only the final unchanged-head run above is claimed as final proof.Independent subagent review (autoreview route unavailable): the helper refused the requested provider route because it did not match operator configuration. Fresh review of the full diff and relevant owners found one P2 issue (Stop incorrectly classified as retry), now fixed. Follow-up P0–P2 review found zero actionable findings. Reviewed snapshot was based on
451ec41c26c67cca7d8a61b7da6b0188cf52249e; the rebase was patch-identical in the affected owners.This is a correctness repair, not a performance claim: CPU/allocation microbenchmarks and Gateway load tests are not applicable. Exact-head CI run 40579180276 is complete. Node test shards, UI E2E, production/test types, docs, guards, source contracts, baseline ratchets, and the other lint lanes passed. The only failing leaf is
check-lint-core-2on inherited UI lint errors; the aggregateopenclaw/ci-gatefails as a consequence. CI is therefore not fully green. This PR is intentionally left unmerged for maintainer handling of the inherited failure.Inherited CI failure
Failed lint job: five
eslint(curly)errors inui/src/pages/new-session/draft-body.browser.test.tsx(31–32) andui/src/pages/chat/chat-content-column.browser.test.tsx(288–289, 362).Both files and
.oxlintrc.jsonare byte-identical between this head and its main parent5010c3e80f8bb2271bbd347d4639218f84f9fac4. Focusedpnpm exec oxlint --threads=1 --config .oxlintrc.json <the two files>reproduces all five errors (exit 1). A separate replay of both files extracted from fresh main6a321ca3a231fd8ab46c50bff26ca63b08160c87, using the same config with--no-ignore, also fails with the same five curly errors (the last chat line is now 364 after an unrelated two-line addition). The PR changes neither file nor lint configuration.The aggregate gate labels this failure “new” because an older matching main job passed, explicitly noting that selected scope was not compared. The identical parent blobs and focused current-main replay above establish the file-level inherited failure independently of that coarse classification.
No CI rerun or unrelated UI modification was made. Independent fallback review, hosted Codex review, and ClawSweeper all report zero remaining actionable findings.