Repository navigation
fix(postgres): explain connection loss and canceled queries - #181576
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e2d138cdb3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5a7f7f2a0a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Codex review: needs changes before merge. What this changesThis PR preserves PostgreSQL connection-loss and cancellation outcomes through workers, tools, chat, history, and scheduled-run error messages. Example: PostgreSQL cancels a chat database operation with SQLSTATE 57014.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 5 items remain Keep this PR open: the maintainer-approved repair addresses a current storage-error gap, but five actionable defects remain before merge. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherNative database errors cross worker and session-actor boundaries into agent execution; shared classification and rendering produce Gateway responses, chat guidance, and cron summaries. flowchart TD
A[PostgreSQL operation] --> B[Worker error transport]
B --> C[Session actor and native owner]
C --> D[Agent and tool execution]
D --> E[Shared storage classification]
E --> F[Chat and history guidance]
E --> G[Cron terminal summary]
Technical reviewBest possible solution: Keep the existing classification and lifecycle owners, release unlaunched admissions on every new error exit, and complete the wrapper and consumer-test cutover. Do we have a high-confidence way to reproduce the issue? Current-main source shows the missing cancellation provenance and outcome classification, and the PR records real PostgreSQL fault reproduction; this read-only review ran no target code. Is this the best way to solve the issue? Preserving typed outcomes through the existing owners is the smallest complete approach, but the new exceptional exits must settle their admission bookkeeping and all consumers must follow the cutover. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 054f11c8cc68. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +181, Tests +1020. Total +1201 across 56 files. Added test files: 4. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. 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 23, 2026, 7:25 AM ET / 11:25 UTC. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a1b3aa9ef0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8657c98cd1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5eede8c604
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a6b81da844
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6af367671d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8b61acb917
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@clawsweeper re-review The actionable findings are repaired on d59f498, including local outcome-hook failures, rollback provenance, skipped streamed-batch admission, broker aggregate hydration, and primary aggregate uncertainty guidance. The unsupported throwing-prototype edge case was explicitly declined in its thread. All reviewed threads have replies and are resolved. The final complete Codex review is clean through P3 across three passes. Final real-Gateway PostgreSQL and SQLite live qualifications passed, including all 48 faulted PostgreSQL turns, cron termination, native cancellation, fresh recoveries, and unchanged PIDs. All temporary probes were restored. Final-head CI is still running; landing waits for the required checks and all three PostgreSQL conformance logs. |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…vers (#181806) #181576 used Promise.withResolvers in agent-core's tool-batch launcher, but the package declaration build compiles against the repo's ES2023 lib, so pnpm build failed on main with TS2550 and produced no artifacts. Capture the resolver from a plain promise instead (the executor runs synchronously, and only resolve is used); behavior is identical and the package lib target stays unchanged.
…#181576) * fix(postgres): explain connection loss and canceled queries * fix(storage): separate canonical worker error ownership * fix(build): include worker error owner in PR wrapper * test(gateway): assert outcomes for uncertain write RPCs * fix(agents): release unstarted calls after storage failures * fix(agents): release canceled calls when settlement fails * fix(storage): inspect cancellation markers without getters * fix(agents): preserve tool outcomes through diagnostic inspection * fix(postgres): explain known rollback outcomes * fix(agents): retain primary outcomes through accepted work cleanup * fix(agents): publish storage guidance with terminal error payloads * fix(agents): retain outcomes through hooks and error projections * fix(agents): honor storage outcomes before transient recovery * fix(agents): release batches skipped after predecessor failure * fix(storage): hydrate canonical aggregate outcomes at broker * fix(storage): retain primary aggregate uncertainty guidance * fix(postgres): retain successful settlement and rollback outcomes
…vers (openclaw#181806) openclaw#181576 used Promise.withResolvers in agent-core's tool-batch launcher, but the package declaration build compiles against the repo's ES2023 lib, so pnpm build failed on main with TS2550 and produced no artifacts. Capture the resolver from a plain promise instead (the executor runs synchronously, and only resolve is used); behavior is identical and the package lib target stays unchanged.
What problem this solves
PostgreSQL connection loss during chat or cron could surface an opaque operation/cleanup aggregate, a bare native-owner error, or a generic assistant failure. Native SQLSTATE 57014 cancellation could also become a provider error and allow model continuation.
Supersedes #179316. Prerequisites already merged: #181472 fixes implicit first-chat admission through symlinked state paths; #181546 documents timeout precedence; #181661 fixes the independently reproduced admission/recovery liveness bugs. Archive-alias work remains separate in #181554.
Root causes and fix
Canonical outcomes were lost at native-owner wrapping, worker hydration, the actor's name/message-only projection, and terminal flattening. Cleanup aggregates could obscure the operation's primary failure. Preserve canonical identity through these boundaries and use the existing shared guidance owner for chat, RPC, history, and cron.
unavailableoutcomes accurately explain a confirmed rollback, that nothing from that operation was saved, and that the user can retry.No new public code, protocol shape, configuration option, observer reclassification, timeout, or retry/at-most-once policy. Existing progress/result helpers moved into their owning outcome/stream modules; no parallel presentation owner remains.
Evidence
Final head
e30dfccfa102passed the complete live gate with a realpnpm openclaw gateway run, a real model, and local Homebrew PostgreSQL 17.11 with pgvector 0.8.7; no Docker.agent.wait. All 144 checked error surfaces had guidance; no opaque aggregate, bare native-owner-loss, or raw settlement headline.pg_cancel_backend: 1/1 passed with cancellation guidance and correlated native SQLSTATE 57014. Earlier fixed8 qualification passed both 3/3.Owning-boundary regressions were RED before the repairs and GREEN afterward. The registered real-PG test terminates/cancels actual transcript-worker writes and checks typed outcomes and guidance through production chat/cron adapters (RED 2 / GREEN 2). Separate regressions cover confirmed-rollback presentation, whole-graph uncertainty, native cancellation provenance, ordinary failures, and no-replay assistant recovery. The last admission repair was RED with zero releases, then GREEN alongside 110 SDK/core controls. Types, lint, formatting, line-cap and import-cycle checks passed.
Actual-broker regressions were RED for canonical aggregate hydration and primary-outcome presentation, then GREEN with 89 transport/codec tests and 45 surface tests. Regressions for successful sibling finalization, canceled pre-execution hooks, and canonical
unavailabletransport were also RED, then GREEN with 101 agent-loop/SDK tests and 57 codec tests. Aggregate retry exclusion and ordinary provider behavior remain unchanged. The final committed-branch review is clean through P3 across all three passes. All three final-head PostgreSQL conformance shards executed and passed: 1,130 tests passed, with 37 existing conditional skips. Each raw shard log was inspected;outcome-surfaces.postgres.test.tsexecuted both termination and cancellation cases successfully in shard 1. Final-head CI run.Production/runtime: 30 files, +1071/-536 (net +535), including one wrapper-inventory entry. Tests: 33 files, +2246/-146; one append-only PG registration. No healthy-path SQL or database request is added; no timing claim.
Investigation notes
The fixed2 stall was observed once (16/16 on one wave), not reproduced in exact fixed1/fixed2 replays or 48+ later turns. A later multi-wave stall reproduced on unmodified main and was traced to the admission/writer cycle fixed separately in #181661. Its repaired live gate passed 48/48 terminal faults, all recoveries, SQLite controls, and all three PostgreSQL conformance shards.
The macOS provisioner timeout was unrelated, macOS-only, and pre-existing. Its timeout was not increased. Selector misses, an earlier synthetic-marker mismatch, and an intermediate missing cancellation payload remain recorded as failed proof attempts; each qualifying result above came from a fresh complete replay.