Repository navigation
fix(gateway): a chat accepted on a full disk vanishes without a terminal event - #176998
Conversation
Emit a guarded terminal chat error when mandatory run admission fails before the setup error owner exists. Reuse the existing storage classifier and user guidance for nested admission and transcript-write errors, while preserving expected refusal and cleanup behavior. A real SQLite-worker regression covers successful session creation followed by startup or transcript failure, with no persisted user message or claimed message sequence. No retry, schema, or recovery semantics change.
|
🦞👀 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: 08b4461513
ℹ️ 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".
| expect(context.broadcast).toHaveBeenCalledWith( | ||
| "chat", | ||
| expect.objectContaining({ | ||
| sessionKey: key, | ||
| state: "error", | ||
| errorMessage: expect.stringContaining( | ||
| "OpenClaw couldn't save your conversation because the disk is full", | ||
| ), | ||
| }), | ||
| expect.anything(), |
There was a problem hiding this comment.
Exercise the real Gateway broadcast path
This assertion only observes the vi.fn() broadcaster supplied by createDirectChatContext, so it bypasses the session-subscription and authorization filters in createGatewayBroadcaster. For a session-scoped Control UI client, the terminal event is emitted before sessions.create returns, making delivery to the provisional session subscription the behavior that must be proved; this test could remain green while every real client drops the event. Cover this with an isolated wire Gateway, an explicit non-main session subscription, and a post-publication read or turn instead of treating the producer callback as delivery.
AGENTS.md reference: src/gateway/AGENTS.md:L55-L57
Useful? React with 👍 / 👎.
|
Codex review: needs maintainer review before merge. What this changesThis PR publishes a terminal chat error when storage failure prevents initial-turn admission and reuses existing storage guidance for transcript failures. Example: sessions.create commits a new session, then SQLite returns SQLITE_FULL while admitting its initial message.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review The storage-failure allowlist resolves the prior authorization-refusal finding. No actionable defects remain in the reviewed head; this useful fix should proceed through the remaining CI gate. Priority: P1 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherGateway session creation delegates its initial message to chat admission; storage failures now reach the existing guarded chat broadcaster while RPC responses retain session and persistence outcomes. flowchart TD
A[Session creation request] --> B[Committed session]
B --> C[Chat work admission]
C --> D[Storage error classification]
D --> E[RPC failure response]
D --> F[Guarded terminal broadcaster]
F --> G[Authorized session clients]
Technical reviewBest possible solution: Keep storage-failure publication in the existing admission and terminal owners while preserving RPC-only refusals and truthful persistence receipts. Do we have a high-confidence way to reproduce the issue? Current-main source exposes the RPC-only failure path, and the coordinator records the matching APFS ENOSPC reproduction; this read-only review executed no target code. Is this the best way to solve the issue? The patch is a focused repair using existing classifiers, source guards, and terminal delivery rather than introducing retries, another lifecycle owner, or persistence changes. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4d86a5965c24. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +38, Tests +402, Docs +1. Total +441 across 7 files. Added test files: 1. View PR surface stats
Review metrics
LabelsLabel changes: No label 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 HistoryReview history (3 earlier review cycles)
Reviewed October 19, 2026, 5:43 AM ET / 09:43 UTC (Revision 4). |
Cover SQLite iterator reads in the real-worker fault injector so Bun exercises the same admission failure as Node. Emit the current turn's terminal error even when the disk-full refusal allows a later retry, preserving the shared error classifier's retry hint.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Please review exact head |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…nal event (openclaw#176998) * fix: report initial turns that fail when storage is full Emit a guarded terminal chat error when mandatory run admission fails before the setup error owner exists. Reuse the existing storage classifier and user guidance for nested admission and transcript-write errors, while preserving expected refusal and cleanup behavior. A real SQLite-worker regression covers successful session creation followed by startup or transcript failure, with no persisted user message or claimed message sequence. No retry, schema, or recovery semantics change. * fix(gateway): finish retryable disk-full initial turns Cover SQLite iterator reads in the real-worker fault injector so Bun exercises the same admission failure as Node. Emit the current turn's terminal error even when the disk-full refusal allows a later retry, preserving the shared error classifier's retry hint. * fix(gateway): keep expected admission refusals non-terminal * fix(gateway): limit admission terminal errors to storage failures
What Problem This Solves
Fixes silent initial turns after session creation when storage admission or transcript persistence fails, while keeping ordinary refused requests from broadcasting a spurious terminal chat error.
User Impact
Disk-full startup and persistence failures end visibly with existing disk-full guidance. Busy sessions, authorization changes, startup refusals, validation failures, and unclassified admission errors keep their existing RPC-only responses. No user-message receipt is claimed without persistence evidence.
Why This Change Was Made
Admission terminal publication now uses an allowlist: existing classified storage failures or canonical SQLite worker unknown outcomes. The prior expected-refusal types and throw-site changes are removed. Existing source-owned terminal guards and settlement remain in place. There are no retries, schema, durability/recovery, or authorization-policy changes; #176902 remains the separate recovery fix.
Evidence
a43161d210e4is also scoped-clean: no accepted/actionable findings.Follow-up
a43161d210e4a9cb5dceed4387a1d2f84f875445removes 44 net production lines (+126/-170), tests +96/-10. Entire PR versus merged base: production +43/-5, tests +411/-9, docs +1/-0. Production growth is the guarded terminal handoff and shared storage-error presentation; only three production modules differ from base.Coordinator live proof
The coordinator placed the state directory on a 3 GB APFS volume filled to
ENOSPC. Stock main7ef2a23236aaand main plus #176902 both returned a session key fromsessions.createfor the built-in agent with a message (initialTurnabout 3.8 s), then produced no persisted user message, terminal event, or watchdog; the client waited over 200 s.With main
77bd4c3f7ae3plus #176902 (now merged as16f2c2e9fb16) and this PR, the same create ended with a visible terminal chat error within 3.6 s. Further creates on both tested runtimes were refused immediately with: "OpenClaw couldn't save your conversation because the disk is full. Free up space on the computer running OpenClaw before continuing." After freeing space, both runtimes answered again without restart (4.0 / 4.6 s).Known limitation
In the first failing-create window, the terminal text can read "Session actor requires reconciliation before another command" rather than the disk-full copy. This is a follow-on refusal after an outcome-unknown write; this PR does not change that outcome or claim a definite write result. Copy improvement remains a follow-up.
The automated regression observes the public handler's terminal broadcaster callback, not the real subscription/authorization delivery path. The coordinator's live proof above supplies the observed client-visible terminal outcome; it is distinct from the automated test's coverage.
Current candidate
Head
a43161d210e4a9cb5dceed4387a1d2f84f875445contains the merged #176902 prerequisite. The storage allowlist replaces the superseded refusal typing and addresses the prior provider-review and operator-authority findings. Caller revocation, role changes, provider-review busy, startup admission, and unclassified failures remain RPC-only. Genuine storage failures retain the source-guarded terminal handoff, including retryable read failures. The lander’s fresh isolated P2 autoreview is scoped-clean. The fourth ClawSweeper round completed on this exact head with no findings and marked it ready for maintainer review. Exact-head CI run 39230119367, attempt 1, completed successfully. The interrupted native review checkout was recovered by restoring its single empty file from the journal’s exact target blob and verifying the blob hash. Native landing completed on this unchanged, reviewed head asef53bbce161d5f27ba64f3bf410ee06b09a960b8.