Skip to content

test(postgres): cover interrupted Cron work across Gateway crashes - #195955

Merged
vincentkoc merged 3 commits into
mainfrom
test/postgres-inflight-crash-proof-20261109
Nov 9, 2026
Merged

vincentkoc merged 3 commits into
mainfrom
test/postgres-inflight-crash-proof-20261109

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Related: #195748

What Problem This Solves

The physical PostgreSQL Gateway crash test covers completed retained Cron jobs but misses a provider-accepted run that has not finished when the Gateway dies.

User Impact

Adds regression proof for the existing restart behavior: retain one visible interrupted outcome with its acknowledged public run ID, disable the uncertain overdue one-shot, and do not replay its payload. Runtime behavior, SQLite schemas/versions, recovery formats, config, and recovery policy are unchanged.

Why This Change Was Made

Extend the existing SIGKILL case with one held provider response and verify its running receipt before killing the actual Gateway owner. Public RPCs intentionally hide scheduler-private fields; join receipts to persisted job state on both store and job keys to prove receipt identity and recovery cleanup. Reuse the same restart and automatic-scheduler probe. Public history and physical PostgreSQL rows each require exactly one interrupted outcome with the original public run ID. Only the first unfinished response is held, so a duplicate can finish and fail counts without starving the probe. The 90-second deadline and cleanup stay unchanged.

Evidence

  • Head fe6cab218a9fb6e98556825399ddf6c2353394a2: focused physical proof passed on PostgreSQL 16.15 (24.429s), 17.11 (20.681s), and 18.6 (24.861s). One selected case passed per version; six unchanged cases were intentionally skipped per version. All three task containers were removed.
  • Proof used Node 26.12.1, repository-pinned pgvector image digests, and local amd64 Docker PostgreSQL containers. Both fsync and synchronous_commit were on for every server. The SQLite anchor stays unchanged across restart.
  • Separate owner-contract/correction review and fresh P0-P3 autoreview at 5e59b66463dde4718b878e31c4f3afd0fc65bf98 of the complete branch against 518e8a7d43f32499276f8b60526f2e0b54e150fd: scoped-clean, no actionable findings. Public projection, recovery and row-codec owner source was supplied intact to the reviewer.
  • Hosted type-aware lint found a redundant default type argument in createDeferred<void>(). Head 5e59b66463dde4718b878e31c4f3afd0fc65bf98 removes only <void>; the helper defaults to void, so runtime proof above is reused. The exact focused type-aware Oxlint path now passes.
  • Formatting, whitespace, line-cap ratchet and normal signed commit hooks passed. Exact +105 test-line allocation; shared scalar unchanged.
  • Local proof follows an unavailable Testbox attempt: hydration timed out, no payload executed, and its task-owned allocation is confirmed stopped. Exact-head PR CI completed successfully at 5e59b66463dde4718b878e31c4f3afd0fc65bf98: all three full PG17 conformance shards, the PG16 Gateway suite, and all other selected jobs passed (24 successful jobs; planned skips are not counted as passes).
  • Exact-head ClawSweeper review has no findings or before-merge actions. Its pending hosted-proof concern is resolved by the successful run above; head unchanged since that review.
  • This covers accepted unfinished provider work. It does not claim lost-COMMIT-acknowledgment or already-sent external-message exactly-once proof. Existing worker recovery tests retain repeated-recovery coverage.

Production LOC delta: 0. Tests: +107/-2 (net +105), extending the existing case without a new test, fixture, boot or runtime hook.

@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.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S labels Nov 9, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review November 9, 2026 12:35
@vincentkoc
vincentkoc enabled auto-merge (squash) November 9, 2026 12:39
@vincentkoc
vincentkoc disabled auto-merge November 9, 2026 12:43
@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: 🦐 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. 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 extends the Gateway crash test to verify recovery of provider-accepted, unfinished Cron work.

Example: The provider accepts “Report the unfinished one-shot result.” before the Gateway receives SIGKILL.

  • Before: The crash test covers only a completed retained one-shot.
  • After: The test also requires one interrupted outcome with the acknowledged run ID, a disabled uncertain one-shot, and exactly one provider request.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused patch has no identified defect; execution confidence currently rests on reported integration runs while hosted conformance remains pending.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored test-only PR is outside the ordinary contributor proof gate; its reported PostgreSQL runs exercise CLI-started Gateways, a held HTTP provider response, owner SIGKILL, persisted interruption, and replacement scheduling, with no independent execution claimed by this review.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: A PostgreSQL recovery regression affecting accepted unfinished Cron work could escape the existing completed-job crash test.
Reason: The maintainer-authored direction protects a distinct persistence and process-lifecycle boundary while preserving existing behavior and reusing established fixtures.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it adds useful PostgreSQL process-crash coverage beyond current main, preserves the existing recovery policy, and has no actionable review findings.

Priority: P3
Reviewed head: 5e59b66463dde4718b878e31c4f3afd0fc65bf98

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Successful focused execution is maintainer-reported rather than supplied as raw output; exact-head hosted PostgreSQL conformance is still running.
Agent review details

How this fits together

The PostgreSQL conformance suite sends authenticated Cron RPCs through CLI-started Gateway processes and checks provider requests, public history, and persisted recovery state.

flowchart LR
  T[Conformance test] --> G[Gateway process]
  G --> P[PostgreSQL state]
  G --> H[HTTP provider fixture]
  T --> K[SIGKILL owner]
  K --> R[Replacement Gateway]
  R --> P
  R --> V[History and scheduler assertions]
Loading

Technical review

Best possible solution:

Retain the focused extension of the existing crash scenario using the current recovery owner and unchanged runtime contracts.

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

Source inspection confirms the current-main coverage gap; this test-only PR does not establish a failing production behavior, and no target code was executed during review.

Is this the best way to solve the issue?

The change uses the smallest existing composition that exercises physical Gateway death, PostgreSQL receipts, public recovery history, and replacement scheduling.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 280e1de139e7.

Provenance checked

  • Completed-job process-crash coverage keeps the original intent (c90763e: Exercise actual owner-PID SIGKILL and replacement scheduling while preserving acknowledged completion without replay.)
  • Provider fixture and durable completion assertions keeps the original intent (7fde96d: Prove retained one-shot completion through authenticated Gateway RPC, real agent execution, public history, and physical PostgreSQL rows.)
  • Replacement scheduler probe keeps the original intent (df13b6b: Prove that a replacement scheduler dispatches a distinct automatic job while the completed retained job stays disabled.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: Raw commit c90763e adds src/gateway/server-database-engine.postgres.test.ts:354 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: c90763e8396b; files: src/gateway/server-database-engine.postgres.test.ts)
  • Peter Steinberger: Raw commit 79e502f adds src/gateway/server-database-engine.postgres.test.ts:49 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 79e502fa80e7; files: src/gateway/server-database-engine.postgres.test.ts)

PR surface

Tests +105, Other +4. Total +109 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 107 2 +105
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 4 0 +4
Total 2 111 2 +109

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 LOC Production +0/-0; tests +107/-2 The additional assertions cover accepted unfinished work across physical process death without another Gateway boot, fixture, or production hook.

Labels

Label changes:

  • add P3: This strengthens regression coverage without changing runtime behavior or establishing a current production failure.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This strengthens regression coverage without changing runtime behavior or establishing a current production failure.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦞 diamond lobster.
  • 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.

Reviewed November 9, 2026, 7:58 AM ET / 12:58 UTC.

@vincentkoc
vincentkoc merged commit 11a13b6 into main Nov 9, 2026
126 checks passed
@vincentkoc
vincentkoc deleted the test/postgres-inflight-crash-proof-20261109 branch November 9, 2026 13:16
@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
…penclaw#195955)

* test(postgres): cover interrupted Cron work across Gateway crashes

* test(postgres): bind private Cron receipts through persisted state

* test(postgres): omit the default deferred type argument
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S 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