Repository navigation
chore(postgres): verify final-delivery crash recovery - #196781
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 maintainer review before merge. What this changesAdds PostgreSQL Gateway crash-before-ACK coverage and moves existing final-receipt safety cases into SQLite/PostgreSQL conformance. Example: The Gateway records receipt accepted-final, then dies before acknowledging its queued delivery.
Review scores
ProductKind: Test only · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR adds distinct crash-recovery coverage, and the reviewed head has no actionable source findings. Priority: P3 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherOutbound recovery consumes queued payloads and persisted session receipts, invokes the transport when necessary, and acknowledges completed queue custody through database workers. flowchart TD
A[Seed queued final output] --> B[Gateway recovery]
B --> C[Synthetic HTTP transport]
C --> D[Persist PostgreSQL receipt]
D --> E[Hold ACK and kill Gateway]
E --> F[Cold Gateway restart]
F --> G[ACK without another send]
Technical reviewBest possible solution: Retain the focused crash test and shared safety matrix, with successful exact-head conformance establishing acceptance. Do we have a high-confidence way to reproduce the issue? This PR addresses a coverage gap rather than claiming a reproduced production defect; no target code was executed during this read-only review. Is this the best way to solve the issue? The smallest complete approach is to extend the existing Gateway suite and reuse the safety matrix through canonical engine fixtures, which this diff does. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 0c5c4754c33d. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceTests +298, Other +4. Total +302 across 3 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes: No label 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 HistoryReview history (3 earlier review cycles)
Reviewed November 10, 2026, 2:40 PM ET / 19:40 UTC (Revision 4). |
|
@clawsweeper re-review Please review exact head |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Please review exact head |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Please review exact head |
|
🦞👀 Re-review progress:
|
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
* chore(postgres): verify final-delivery crash recovery * chore(postgres): match crash recovery allocation to added tests * fix(test): serialize PostgreSQL Gateway process recovery proof * fix(test): prepare PostgreSQL crash fixture without an extra Gateway * fix(test): prepare crash recovery through startup preflight
What Problem This Solves
PostgreSQL recovery lacked whole-Gateway crash coverage between a committed final-delivery receipt and queue acknowledgement.
User Impact
No production behavior, SQLite schema/version, migrations, persisted formats, or runtime config/defaults change. This qualifies queued-output recovery; it does not establish end-to-end agent RPC delivery or remote exactly-once acceptance.
Why This Change Was Made
Use real Gateway processes and workers, a synthetic transport, and independent PostgreSQL reads to hold ACK before execution, verify the durable receipt, SIGKILL the Gateway, and require successful ACK after cold restart without another send. Existing startup preflight prepares the empty store; an independent native PostgreSQL query requires its webhook migration completion before seeding. Parent workers drain before ownership passes to each real Gateway. Restart advances only the Gateway clock past the queue lease, so platform lease reclaim is outside this proof.
Extends worker ACK-response-loss coverage to a full Gateway crash before ACK executes. Move the existing 20 safety cases into canonical SQLite/PostgreSQL conformance instead of duplicating them. Production LOC delta is zero; the allocation grants exactly the +298 test LF bytes.
Evidence
Earlier qualification of the same delivery/crash/recovery boundary, with an additional empty Gateway process used for preparation:
That task-owned Testbox qualification also passed catalog/schema parity, targeted formatting, lint and affected Gateway/infra test type graphs. Canonical discovery selects the new matrix exactly once.
CI at the earlier head exposed a PR-caused 90-second timeout in the new three-boot case under concurrent PG17 infra load; its subsequent isolated PG16 Gateway module passed all eight cases. The exact stalled phase remains unknown. Auto-merge was retired before repair.
An intermediate preparation variant entered the full parent-side bootstrap helper and failed on PG17 and PG16: runtime secrets discovery attempted a synchronous PostgreSQL metadata read. The helper had not adopted the preflight plugin cache as the real CLI does; this establishes fixture caller-contract misuse, not a demonstrated production defect.
Latest repair
7209846fe5dbbfda03381db0ecb83445cd43529dprepares only through the real migration preflight, awaits its transferred plugin-cache disposal, drains parent resources, independently verifies persisted completion, and installs both the returned snapshot and engine selection before seeding. Both real delivery/recovery processes and every receipt, queue, SIGKILL, ACK, no-resend assertion and deadline remain. An attempted registry transfer exposed overlapping CLI/infra ownership in watch/full-suite checks; those routing/planner changes are fully reverted in the final diff.Fresh independent review of the latest correction reports zero actionable findings (0.90 confidence); primary and bounded lifecycle review checked preflight ownership, cache disposal, engine handoff and resource drains directly. Exact-head ClawSweeper review also reports zero findings. Its rank-up item is completed PostgreSQL qualification and affected static checks.
Current-head formatting, lint/types, privacy and diff checks pass. The test-line ratchet fails on 128 inherited lines: exact CI base
0c5c4754c33dd9a9e7f4eb4493d4472d458a4609contains 6,635,176 test LF against a 6,635,048 ceiling. This PR adds 298 LF with an exact 298 grant, producing 6,635,474 / 6,635,346 and preserving the same 128 debt. Independent direct base counting and the CI merge arithmetic agree. The checker and scalar baseline are unchanged; the fetched tested merge71ceb29ef658841dd1aaffcc59693b928138932dhas the expected parents and matches a recomputed merge tree. This is attributed inherited debt, not a green check; no extra grant or global ratchet change is included.The runtime rank-up item is complete in exact-head CI: all three PG17 conformance shards passed, and the entire PG16 Gateway module passed all eight tests. The new crash case took 55.541 seconds under concurrent PG17 load and 36.914 seconds on PG16, within the unchanged 90-second deadline. The completed attempt has 31 successful jobs, 28 skipped jobs, and only the inherited ratchet failure plus its downstream aggregate. Native inherited-failure admission retains that red result and its exact baseline attribution; no unrelated budget grant is added. The final preflight preparation variant was not separately run on PG18. Focused Testbox allocations queued and were stopped before executing, contributing no new runtime proof.
Separate audit findings remain for subsequent review:
src/infra/database-port-recovery.ts:21). Source confirms rejection before initial manifest publication; live command reproduction is pending. Accepting those values changes the recovery-format contract and remains embargoed even without a SQLite schema bump.