Repository navigation
fix(agents): name Gateway storage failures in run-failure copy - #139409
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed September 5, 2026, 6:48 PM ET / 22:48 UTC. ClawSweeper reviewWhat this changesThe PR adds specific Gateway storage-error guidance to live run failures, recorded chat errors, and logs, while preventing provider retries and credential rotation for recognized storage failures. Merge readiness✅ Ready for maintainer review Keep open: the diagnostic gap remains on current main and the latest release, and the proposed repair has no identified blocking defect. The maintainer-authored PR is also protected from automated closure. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw converts agent runtime failures into operator-facing chat messages and lifecycle logs. This change carries recognized storage diagnostics through that conversion and uses the same guidance when displaying recorded assistant errors. flowchart TD
A[Runtime errors] --> C[Storage error classification]
B[Recorded assistant errors] --> C
C --> D{Recognized storage failure}
D -->|Yes| E[Fixed recovery guidance]
D -->|No| F[Existing error handling]
E --> G[Chat display and lifecycle logs]
D -->|Yes| H[Stop provider retries]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +29, Tests +119, Docs +19. Total +167 across 15 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep storage diagnosis in the shared failure-copy path, preserve transcript bytes and provider-body redaction, and handle the separate reclamation concurrency redesign independently. Do we have a high-confidence way to reproduce the issue? Yes, from source: an empty assistant error containing database is locked reaches generic failure copy on main. The PR reports failing-before copy cases; this review did not execute a runtime reproduction. Is this the best way to solve the issue? Yes. Reusing the shared renderer and recognizing bounded storage facts repairs the diagnostic gap without adding configuration, rewriting stored transcripts, or redesigning database ownership. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c1ca45ce8653. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
48e387a to
dcae326
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
* origin/main: (95 commits) perf(build): avoid unrelated gateway artifact scans (#127757) fix(update): deliver terminal progress after long updates (#139289) fix(ui): show session hover cards for local chat URLs (#139384) perf(ui): reuse unchanged transcript key snapshots (#139400) fix(ui): make subagent sessions view-only (#139381) fix: open agent state on SQLite builds without extensions (#139487) perf(skills): detach cached metadata from source strings (#139478) fix(ui): show primary user in multi-agent profile hero (#136736) perf(sessions): stop decoding the session row four times per SQLite entry patch (#136361) refactor(exec): share package-manager option scans (#139482) fix(ci): authorize frozen mobile release candidates (#139441) fix: avoid session deletion slowdown in large session stores (#139467) perf(gateway): reuse node invocation idle timers (#139354) fix(auth): preserve selected profiles across plugin scopes (#139413) fix(discord): retain voice input until transcription completes (#139484) fix(agents): name Gateway storage failures in run-failure copy (#139409) fix: keep subagent checks responsive in large session stores (#139450) fix(memory): index notes when optional embeddings cannot start (#139463) fix: refresh pending approvals when reopening chat (#139457) fix(tooling): preserve Git hook choices during install (#139461) ...
…law#139409) * fix(agents): name Gateway storage failures in run-failure copy * test(agents): follow failover controller after rebase
Problem
Chat runs ending with an internal SQLite error displayed only
⚠️ Agent run failed (model: …)., leaving operators without a cause or next step. The persisted assistant error could containdatabase is lockedwith empty content and no error code, while both the live failure copy and history projection hid that diagnosis.Solution
Classify native SQLite codes before runtime errors are flattened, and recognize exact known SQLite messages in legacy assistant rows. Render fixed storage guidance through the shared failure-copy owner so the chat banner, persisted-row display projection, and lifecycle log name the same failure. Preserve the existing redacted raw-error preview and keep arbitrary provider bodies out of the user-facing copy.
Recognized storage failures terminate without automatic run replay or provider credential rotation. Consolidate the existing repetitive runtime-copy branches into a lookup without changing their wording or precedence. This PR does not change database schema, writer ownership, busy timeouts, or configuration.
Impact
Operators now see the storage cause and an actionable next step for busy/locked, full, read-only, I/O, and transcript writer ownership failures. The existing banner's Details control reveals the full guidance when the summary is truncated. Existing recorded error rows gain the same display guidance without rewriting transcript bytes.
Production LOC: +102 −73 (net +29). The +29 exception to the neutral-LOC budget is explicitly approved: this adds a new Gateway storage failure classification that reaches the banner, persisted-row projection, and lifecycle log. Consolidating the existing runtime-copy branches partially funds it (the formatter is net −38 lines); the remaining growth carries the classification and typed error through those boundaries. Tests: +121 −2 (net +119). Docs: +19 −0.
Evidence
node scripts/run-vitest.mjs src/agents/failover src/agents/embedded-agent-runner/run/assistant-failure src/gateway/chat-display-projection ui/src/pages/chat/chat-gateway src/agents/embedded-agent-subscribe.handlers.lifecycle.test.ts src/agents/embedded-agent-helpers/error-text src/llm/stream.sync-host.test.ts— 345 passing test executions across six shards.node scripts/run-vitest.mjs src/agents/failover/*.test.ts src/gateway/chat-display-projection.provider-owner.test.ts— 882 passing test executions across three shards. Explicit file expansion covers failover tests skipped by the directory filter above.node scripts/check-changed.mjs— passed, including core/test typechecking, formatting, lint, and repository guards.pnpm docs:listandgit diff --check— passed.Follow-up: reclamation lock cycle
An isolated probe reproduced a synchronous transcript append failing with
database is lockedat the existing 5000 ms busy timeout.The owner chain is
session-manager-persistence.ts→ synchronous transcript append → canonical writer, competing withsession-accessor.sqlite-archive.worker.ts→ reclamation →session-accessor.sqlite-reclamation-commit.ts.Reclamation holds
BEGIN IMMEDIATEwhile waiting for main-thread commit authorization; the synchronous append blocks that main thread waiting for the same write lock.The append failed, then reclamation reported expired commit authorization; this proves a reachable cycle, not attribution of historical runs or a large-database checkpoint failure.
Reclamation also performs separate post-commit truncating checkpoints and unbounded incremental vacuum, which need bounded maintenance ownership.
The proposed design keeps archive preparation off-thread but commits reclamation through the existing canonical writer with synchronous authority validation and bounded page maintenance.
That persistent-store concurrency change requires explicit maintainer approval, including a decision on bounded deletion latency, and is intentionally not implemented here.
Release-note: Show actionable Gateway storage failure reasons in chat run errors, recorded assistant error displays, and lifecycle logs without exposing provider response bodies.