Repository navigation
fix(gateway): disk-full write requests return raw SQLite worker errors - #176832
Conversation
Reuse storage failure classification and guidance at the Gateway RPC boundary. Preserve native causes for queued worker failures and keep unknown write outcomes nonretryable without changing worker retirement or transaction settlement. Regression proof uses real WAL SQLITE_FULL through the worker broker; the original boundary exposed internal outcome-unknown text instead of recovery guidance.
|
🦞👀 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 replaces raw disk-full worker errors in Gateway RPC responses with existing recovery guidance while preserving write-outcome retry safety. Example: A sessions.create request encounters SQLITE_FULL after dispatch to the SQLite worker.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR: it addresses a current Gateway diagnostic defect with a focused change, and source review found no actionable introduced bug. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherAuthenticated Gateway RPC handlers use worker-owned storage; failures cross the broker and Gateway error renderer before becoming client response frames. flowchart LR
A[RPC client] --> B[Authenticated dispatcher]
B --> C[Request handler]
C --> D[SQLite worker broker]
D --> E[SQLite database]
D --> F[Storage error classifier]
F --> G[Gateway error response]
G --> A
Technical reviewBest possible solution: Use the existing storage classifier and recovery-copy owner at the RPC boundary while preserving uncertain-write refusal and transaction ownership. Do we have a high-confidence way to reproduce the issue? Current-main source exposes formatted worker failures at the dispatcher boundary, and the PR supplies a bounded real-SQLite reproduction with reported red/green assertions; no target code was executed during this review. Is this the best way to solve the issue? The patch is a small complete diagnostic fix: it retains native causes at their producer and reuses existing classification, copy, and unknown-outcome detection without adding another recovery mechanism. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 35aa52a55da8. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +18, Tests +112, Docs +2. Total +132 across 10 files. Added test files: 1. View PR surface stats
Review metrics
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 18, 2026, 10:57 PM ET / October 19, 2026, 02:57 UTC. |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
Reuse storage failure classification and guidance at the Gateway RPC boundary. Preserve native causes for queued worker failures and keep unknown write outcomes nonretryable without changing worker retirement or transaction settlement. Regression proof uses real WAL SQLITE_FULL through the worker broker; the original boundary exposed internal outcome-unknown text instead of recovery guidance.
Align the plugin subagent persistence regression with f0e683c (#176832). That PR intentionally makes Gateway clients receive disk-full guidance and structured SQLITE_FULL details instead of raw broker text. Its body states: "Retry semantics are unchanged: unknown dispatched writes stay nonretryable and queued, unexecuted writes stay retryable." Keep every no-dispatch, no-registration, paused-owner adoption, and subsequent successful retry assertion. Assert the structured disk-full code and queued failure retryability, and require the original storage cause in the warning. The unclassified adoption failure still retains its specific diagnostic. No production behavior changes. Current main reproduces the exact hourly message mismatch. Replacing only the shared error formatter with its pre-#176832 version makes the unchanged case pass, confirming the intended copy change as the cause. Validation: pnpm test src/gateway/server-methods/agent.test.ts src/gateway/error-shape.test.ts --maxWorkers=1 passed 412 tests in 193.64s Vitest time. Targeted gateway-methods tsgo, typed core and boundary lint, formatting, whitespace checks, and independent P2 autoreview passed.
Align the plugin subagent persistence regression with 1603942 (openclaw#176832). That PR intentionally makes Gateway clients receive disk-full guidance and structured SQLITE_FULL details instead of raw broker text. Its body states: "Retry semantics are unchanged: unknown dispatched writes stay nonretryable and queued, unexecuted writes stay retryable." Keep every no-dispatch, no-registration, paused-owner adoption, and subsequent successful retry assertion. Assert the structured disk-full code and queued failure retryability, and require the original storage cause in the warning. The unclassified adoption failure still retains its specific diagnostic. No production behavior changes. Current main reproduces the exact hourly message mismatch. Replacing only the shared error formatter with its pre-openclaw#176832 version makes the unchanged case pass, confirming the intended copy change as the cause. Validation: pnpm test src/gateway/server-methods/agent.test.ts src/gateway/error-shape.test.ts --maxWorkers=1 passed 412 tests in 193.64s Vitest time. Targeted gateway-methods tsgo, typed core and boundary lint, formatting, whitespace checks, and independent P2 autoreview passed.
What Problem This Solves
When the state volume fills, Gateway write requests such as
sessions.createfailed with a raw internal broker message:UNAVAILABLE/SqliteWorkerError: SQLite worker stopped before its result was received: database or disk is full: code=outcome-unknown. It named no next step, while a turn failing on the same full disk already showed "OpenClaw could not write local session data because the disk is full. Free some disk space and try again." Found by the stability campaign with the state directory on a deliberately filled 3 GB APFS volume (main 7ef2a23).User Impact
Clients now get
UNAVAILABLEwith the existing disk-full recovery guidance anddetails.code: "SQLITE_FULL"instead of internal broker text. Retry semantics are unchanged: unknown dispatched writes stay nonretryable and queued, unexecuted writes stay retryable.Why This Change Was Made
Gateway write requests such as
sessions.createexposed raw SQLite workeroutcome-unknownerrors when the state volume filled. They now returnUNAVAILABLEwith the existing disk-full recovery guidance anddetails.code: "SQLITE_FULL", reusing the storage classifier and copy owner.ENOSPCis classified by that same owner. Queued worker failures retain their native cause so classification survives wrappers.Unknown dispatched writes remain nonretryable; queued, unexecuted writes remain retryable. Worker retirement, transaction settlement, recovery, durable state, and replay are unchanged. Non-storage messages and existing request-error metadata retain their prior behavior.
The worker does not retire on every
SQLITE_FULL. It retires when settlement cannot establish a usable native connection. Nested automatic rollback can remove its savepoint; the transaction owner deliberately fences that handle to prevent later autocommit after a caught failure (#139700). Healthy pre-commit automatic rollback is already handled separately (#157241). Definite job rollback or keeping such workers alive needs an owning recovery decision, outside this fix.Evidence
Coordinator live proof used the state directory on a filled 3 GB APFS volume. Stock main
7ef2a23236aareturned:The candidate (main
0211fa29bf49+ this PR + #176831) returned:Separately tracked F82: an outcome-unknown agent write on a full disk can wedge that agent's shared-state lease until restart (
Shared-state cleanup is waiting for accepted operations to settle). This reproduces on stock main. Its raw text is a non-SQLITE_FULLerror, intentionally not reclassified by this PR; lease recovery is outside this fix.Validation: the real WAL worker/broker fixture reproduces the reported error using
max_page_count, without filling the host disk or calling a model. Temporarily reverting only the four production changes makes both Gateway assertions fail with the original internal messages; restoring the fix makes both pass. The broker test also proves preserved native causes, unchanged outcome classification, no retained failed row, and a successful write after reopening.All tests ran individually with
OPENCLAW_VITEST_RUNTIME=node TMPDIR=/private/tmp/oc-W92 pnpm test <file> --maxWorkers=1:src/gateway/server/ws-connection/authenticated-request-dispatch.storage.test.tssrc/infra/sqlite-worker-broker.test.tssrc/infra/sqlite-worker-broker-reply.test.tssrc/infra/sqlite-worker-broker-reply.cleanup.test.tssrc/gateway/error-shape.test.tssrc/gateway/server/ws-connection/authenticated-request-dispatch.metrics.test.tssrc/agents/embedded-agent-helpers/provider-runtime-failure.test.tssrc/agents/embedded-agent-helpers/error-text.test.tssrc/gateway/chat-display-projection.test.tsCore types (
pnpm tsgo:core), targeted core oxlint, touched-file oxfmt,git diff --check, and Madge all pass; Madge reports zero cycles. Cold worker compilation, artifact verification, and the first router import dominate wall time. The new Gateway file's assertions take 42.2 s including cold initialization; the second case takes 4.6 s. Real worker settlement plus the authenticated response boundary is the required contract; a mocked worker error would miss it.Both isolated Codex reviews are scoped-clean through P2. Production delta is +28/-10 (net +18), needed to connect existing classification and rendering while retaining outcome safety; tests/fixtures/routing are +113/-1. No new runtime module, dependency, schema, protocol schema, or configuration option.
Health probes are unchanged: liveness is intentionally independent of free capacity, readiness has no owned disk-pressure signal, and session disk budgets measure retained bytes rather than filesystem free space. Disk-aware readiness remains a separate follow-up.
CI attribution for native landing
Exact-head PR CI 39191184139, attempt 1 has one non-aggregate failure: check-test-types. It reports
extensions/codex/src/app-server/native-subagent-monitor.parent-retention.test.ts(37,5): TS2353, becausecompletionDeliveryRetryDelaysMsdoes not exist inMonitorOptions.The same diagnostic fails in scheduled main CI 39191176869, attempt 1, at main
a8771a5a154c67f26b5ab7e0002672ad0bfac8bd, the baseline used by this PR's tested merge. These extension inputs are untouched by this PR. The PR failure table compared the older main run 39186683798, where the job passed; direct job-log comparison against the contemporaneous completed scheduled run establishes this as inherited. The failed aggregateopenclaw/ci-gatefollows that single job. Native inherited-failure admission retains the red status and exact-head evidence.