Skip to content

fix(gateway): a chat accepted on a full disk vanishes without a terminal event - #176998

Merged
steipete merged 5 commits into
mainfrom
codex/stab-disk-full-initial-turn
Oct 19, 2026
Merged

steipete merged 5 commits into
mainfrom
codex/stab-disk-full-initial-turn

Conversation

@steipete

@steipete steipete commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

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

  • New real-admission caller-revocation and role-change regressions failed before the fix (2 failed / 7 skipped), then passed on both Node and Bun without terminal publication. Provider-review busy remains non-terminal.
  • All seven required suites passed individually on Node and Bun (87 tests each); five Node consumer suites passed (168 tests). Total: 342 passing tests across 19 invocations.
  • Real-worker SQLITE_FULL admission/transcript tests passed on both runtimes, requiring native errors, terminal disk-full copy, a created session, no user receipt, and settled work.
  • Core and affected test types, touched-file lint/format, whitespace, and madge (zero cycles) passed. W96’s isolated P2 autoreview was scoped-clean. The lander’s fresh isolated P2 review of exact head a43161d210e4 is also scoped-clean: no accepted/actionable findings.
  • Earlier coordinator APFS proof observed a terminal in 3.6s versus silence beyond 200s; this predates the follow-up. Current tests use real owners/workers and a mock broadcaster; exact-head CI run 39230119367 completed successfully; fresh authenticated wire proof is not claimed. Known unknown-write reconciliation wording limitations are unchanged.

Follow-up a43161d210e4a9cb5dceed4387a1d2f84f875445 removes 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 main 7ef2a23236aa and main plus #176902 both returned a session key from sessions.create for the built-in agent with a message (initialTurn about 3.8 s), then produced no persisted user message, terminal event, or watchdog; the client waited over 200 s.

With main 77bd4c3f7ae3 plus #176902 (now merged as 16f2c2e9fb16) 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 a43161d210e4a9cb5dceed4387a1d2f84f875445 contains 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 as ef53bbce161d5f27ba64f3bf410ee06b09a960b8.

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

clawsweeper Bot commented Oct 19, 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T09:31:22.658330Z a43161d New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime size: M labels Oct 19, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +194 to +203
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(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 19, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 19, 2026
@clawsweeper

clawsweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

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

  • Before: The session exists, but the client can wait indefinitely without a terminal chat event.
  • After: The client receives a terminal error explaining that storage is full, without a fabricated message receipt.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Focused, correct repair with reported live transport evidence and meaningful regression coverage; the supplied live run predates the final refinement.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The coordinator reports a real Gateway client receiving a terminal error under APFS ENOSPC and successful requests after space was freed; this predates the final allowlist refinement, whose storage path is supported by real-worker regressions and whose new refusal behavior has admission regressions.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A newly created conversation can accept an initial message and then remain silent when storage prevents it from starting.
Reason: Visible failure is an established conversation contract, and the maintainer-approved scope preserves expected refusals and unknown-write semantics.

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
Reviewed head: a43161d210e4a9cb5dceed4387a1d2f84f875445

Before merge

None.

Findings

None.

Agent review details

How this fits together

Gateway 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]
Loading

Technical review

Best 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

  • Admission failure settlement changes intended behavior with a stated reason (5e1ffe9: Worker-backed retry comparison retained original input identity and existing refusal settlement; the new callback fills the missing storage terminal path without changing those decisions.)
  • Dispatch error presentation and lifecycle keeps the original intent (refactor(gateway): extract chat dispatch errors #106743: The extraction preserved error broadcast, deduplication, persistence ordering, and cleanup ownership; this patch retains that lifecycle and adds shared storage guidance.)
  • Exclusive-admission regression coverage keeps the original intent (36e277d: The session controller owns active and queued work; expanded tests retain physical-store isolation and verify ordinary busy refusals remain non-terminal.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +38, Tests +402, Docs +1. Total +441 across 7 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 3 43 5 +38
Tests 3 411 9 +402
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 455 14 +441

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +43/-5; tests +411/-9 Production growth adds a guarded terminal handoff and shared storage presentation; tests cover distinct persistence, refusal, and authority boundaries.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: Storage exhaustion can leave an accepted initial chat silently unfinished, breaking a core conversation workflow.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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 (3 earlier review cycles)
  • reviewed 2026-10-19T06:25:46.316Z sha 08b4461 :: needs changes before merge. :: [P2] Make the admission fault fixture work under pinned Bun
  • reviewed 2026-10-19T07:02:20.021Z sha cd5b317 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-19T08:33:31.451Z sha 71c8c35 :: needs changes before merge. :: [P2] [P2] Classify ordinary operator-authority refusals before broadcasting

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

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 19, 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-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 19, 2026
@clawsweeper clawsweeper Bot removed clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 19, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 19, 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. labels Oct 19, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Please review exact head a43161d210e4a9cb5dceed4387a1d2f84f875445. The prior refusal denylist is replaced by a storage-failure allowlist, with caller-revocation and role-change regressions. The PR body now reflects the final candidate and preserves the coordinator’s live APFS evidence and accepted copy limitation.

@clawsweeper

clawsweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 19, 2026
@steipete
steipete merged commit ef53bbc into main Oct 19, 2026
162 checks passed
@steipete
steipete deleted the codex/stab-disk-full-initial-turn branch October 19, 2026 09:57
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 20, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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