Skip to content

test(postgres): cover pending-final receipts after ACK reply loss - #196111

Merged
vincentkoc merged 2 commits into
mainfrom
test/postgres-pending-final-ack-loss-20261110
Nov 9, 2026
Merged

vincentkoc merged 2 commits into
mainfrom
test/postgres-pending-final-ack-loss-20261110

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Related: #195955

What Problem This Solves

PostgreSQL qualification lacked proof that a pending-final delivery receipt survives loss of the queue acknowledgement response after the acknowledgement actually commits.

User Impact

No user-visible behavior change. This adds regression coverage; SQLite schema versions, database schemas, recovery formats, configuration, and delivery policies are unchanged.

Why This Change Was Made

The test composes existing delivery, worker-loss, and engine fixtures. It sends once through a synthetic Matrix transport, holds a real successful queue ACK response, terminates that worker, and reopens both stores. It checks the original session, intent, delivery identity and platform receipt, the removed queue row, and two recovery passes without another send. Both physical connection types are asserted.

The existing conformance inventory discovers this file automatically. The redundant concrete-filename planner row was removed after ClawSweeper review; the existing generic database-engine admission case already covers that rule.

Fixture setup uses the canonical agent database path. Only synchronous native inspection is admitted; asynchronous seeding, delivery, and recovery retain the production worker boundary. No production hooks or admission exceptions were added.

Evidence

Candidate: 9587ae8753b18afc4addd5acc16a3beb0b85f814, base: abf7150adb2c029912c2a78fd652a21cc18e4a99. Executed test bytes were compared with the committed candidate.

  • New scenario passed on SQLite and real PostgreSQL 16.15, 17.11, and 18.6. PostgreSQL ran in isolated local containers with fsync and synchronous_commit enabled; PG17 used the cached x86 image under Docker emulation.
  • The canonical PostgreSQL runner also passed its existing catalog, constraint, migration, and trigger-parity preflight for all three versions.
  • Related delivery-completion recovery-safety suite: 20 tests passed.
  • Workflow planner suite: 763 tests passed before the redundant new table row was removed; the existing cases remain unchanged.
  • Canonical conformance --list: new target discovered exactly once.
  • Infra and tooling test types, targeted type-aware lint, formatting, and git diff --check: passed.
  • Test-line ratchet: 6,602,455 lines against 6,602,459 ceiling. Production LOC: 0; test LOC: +132 with its exact allocation; shared baseline unchanged.
  • Final two-file candidate reviewed with local autoreview (GPT-6.1 Sol, P0–P3): no actionable findings. Its captured candidate matches this commit. Local ClawSweeper was unavailable because its runner checkout was dirty.
  • Testbox admission queued without running the payload; its task-owned lease/run was cancelled and settled. Trusted local proof was used instead.

The initial PG executions exposed two fixture-only synchronous reads; both were repaired without weakening the main-thread guard. No production delivery defect is claimed.

This covers committed ACK response loss at the actual worker boundary. Full Gateway process termination after remote platform acceptance remains separate follow-up proof.

@vincentkoc vincentkoc self-assigned this Nov 9, 2026
@clawsweeper

clawsweeper Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 9, 2026
@clawsweeper

clawsweeper Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR adds conformance coverage for pending-final receipts surviving a committed queue acknowledgement whose worker response is lost.

Example: A synthetic Matrix send returns message ID accepted-final, then the queue ACK response is lost.

  • Before: PostgreSQL qualification did not cover this combined receipt-persistence and worker-loss scenario.
  • After: The test requires the original receipt to survive store reopening and two recovery passes without another send.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is focused and has no actionable findings; its validation is production-owner conformance harness execution rather than a shipped-entry-point demonstration.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored test-only PR reports exact-candidate SQLite and physical PostgreSQL execution through real delivery and database workers with a synthetic Matrix transport; full Gateway termination remains explicitly separate.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: PostgreSQL qualification lacked coverage that a delivered final-response receipt survives committed queue ACK response loss.
Reason: The maintainer-authored direction adds a distinct durability check while explicitly keeping full Gateway crash and live-channel guarantees outside its claim.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR adds distinct recovery coverage, and the pinned diff has no actionable findings.

Priority: P3
Reviewed head: 9587ae8753b18afc4addd5acc16a3beb0b85f814

Before merge

None.

Findings

None.

Agent review details

How this fits together

Outbound delivery persists platform evidence in the agent session store before acknowledging queue custody in the state store; recovery consumes the remaining durable queue state.

flowchart TD
  A[Pending final marker] --> B[Outbound delivery]
  B --> C[Synthetic Matrix transport]
  C --> D[Agent session receipt]
  D --> E[State queue acknowledgement]
  E --> F[Worker response loss and reopen]
  F --> G[Recovery without another send]
Loading

Technical review

Best possible solution:

Retain the focused conformance scenario using the existing delivery, engine, and worker-loss owners.

Do we have a high-confidence way to reproduce the issue?

No production defect is claimed; source inspection verifies the injected worker-response-loss path, and this read-only review executed no target code.

Is this the best way to solve the issue?

The test protects receipt-before-ACK ordering and durable receipt retention through existing production owners without adding runtime hooks or duplicating the generic planner case.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 65b12c3500dd.

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: Raw commit 11a13b6 adds src/gateway/server-database-engine.postgres.test.ts:472 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 11a13b63d492; files: src/gateway/server-database-engine.postgres.test.ts)

PR surface

Tests +132, Other +3. Total +135 across 2 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 132 0 +132
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 3 0 +3
Total 2 135 0 +135

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Production versus test growth Production +0; tests +132 One distinct cross-store durability scenario reuses existing fixtures and carries an exact allocation without changing the shared baseline.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.

Label justifications:

  • P3: This is qualification coverage with no claimed runtime defect or user-visible behavior change.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-11-09T16:42:16.096Z sha 3b8bd77 :: needs maintainer review before merge. :: none

Reviewed November 9, 2026, 12:02 PM ET / 17:02 UTC (Revision 2).

@vincentkoc
vincentkoc marked this pull request as ready for review November 9, 2026 16:56
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Please review head 9587ae8753b18afc4addd5acc16a3beb0b85f814. Focused SQLite and PostgreSQL 16.15/17.11/18.6 execution passed, the fixture-only synchronous reads are narrowly admitted, and the redundant planner row is removed. The PR body contains the final proof and process-crash follow-up boundary.

@clawsweeper

clawsweeper Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 9, 2026
@vincentkoc
vincentkoc merged commit dfc053f into main Nov 9, 2026
212 of 217 checks passed
@vincentkoc
vincentkoc deleted the test/postgres-pending-final-ack-loss-20261110 branch November 9, 2026 17:31
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 10, 2026
…enclaw#196111)

* test(postgres): preserve pending-final receipts after ACK reply loss

* test(postgres): keep fixture inspection synchronous
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant