Skip to content

fix: keep warnings out of terminal failure notices - #187883

Merged
shakkernerd merged 2 commits into
mainfrom
guest-failure-diagnostics
Oct 30, 2026
Merged

shakkernerd merged 2 commits into
mainfrom
guest-failure-diagnostics

Conversation

@shakkernerd

@shakkernerd shakkernerd commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Closes #187862

What Problem This Solves

A terminal run error can reach the session recorder with its actionable cause intact, yet leave only warnings in the stored diagnostic. The recorder kept the first 512 characters, and its diagnostic preparation also used a display formatter that can replace errors with friendly copy or retain only a 600-character prefix. Those losses prevent technical consumers from seeing the original cause. Normal notices had the opposite problem: generic failures could expose raw warning or provider diagnostic text.

User Impact

Normal chat history now uses existing classified guidance or a concise neutral notice. The private diagnostic retains redacted opening and terminal context within its existing 512-character budget. Storage, uncertain-completion and established missing-answer guidance are preserved, and unknown failures make no claim about recovery or retry safety.

This changes presentation and diagnostic selection, not execution or retries. It preserves the session row's existing 160-character presentation policy, hides private diagnostics from normal history, and excludes terminal notices from model context. Errors already missing a cause cannot recover it through this change.

Why This Change Was Made

Technical diagnostics now use canonical error coercion, internal-text stripping and secret redaction before the existing UTF-16-safe head-and-tail truncation. This preserves actual Error.message values and avoids the display formatter's earlier information loss. The normal notice separately uses the existing failure-copy owner. A narrow internal rendering argument lets this caller omit generic raw provider-format excerpts while preserving specialized guidance and existing callers' detailed defaults.

Regression coverage exercises lifecycle persistence, real database workers, WebSocket history and display projection. The existing lifecycle setup moves into a test-support file to keep the test file within the enforced line limit; all cases retain their original registered database-worker runtime. The allocation accounts for the resulting 102 net test lines, including support code; no coverage is removed. No schema, configuration or migration is required.

Evidence

On unchanged production, the lifecycle reproduction had four failing regression assertions and 32 passing controls. Its stderr is 482 characters and its wrapped message is 535, so the incoming cause survives the upstream preview and is lost at this recorder. A separate real WebSocket dispatch path reproduced two failures when an Error carried a longer warning prefix. A generic HTTP 400 lifecycle case also reproduced raw provider detail in the projected notice while its private cause survived.

Changed-file formatting and lint, refreshed type discovery, and the affected compiler checks passed. The candidate has 277 qualified passing cases across 20 files: the latest recorder correction passed 79 cases in seven files, and 198 cases across 13 unchanged copy-renderer consumers retain their earlier passes. The earlier full set of seven selected type groups is supplemented by recompilation of the production and test graphs affected by the final import and fixture extraction.

The missing-answer regression also failed through terminal resolution and SQLite persistence before the correction. The existing owner’s exact matcher now preserves both established notices, including the side-effect warning; the same real lifecycle case and both recorder variants pass. Automated source review found no actionable P0–P2 issues.

Independent engineering review is complete with no actionable findings. An additional 29 history-visibility cases passed, and the requested four-file classifier/context check passed 51 cases on the published head. Hosted checks pass. Both synthetic-history browser cases pass, including one notice after reload.

The live isolated Gateway scenario also passed: an actual guest request encountered an intentionally failing sandbox setup command, reached the production recorder, and remained visible after a native browser reload. Before the fix, the notice included the harmless setup marker (61 characters); afterward it contained only the 35-character neutral copy. The canonical receipt retained the 25-character private diagnostic, display and model-context-exclusion flags remained set, and guest history contained exactly one notice without private error details. The private-field exclusion already worked before this change and is preserved.

The live consumer was c2de59dce82bc79bac10771a968446e7e152e657, containing the complete patch plus separately qualified runtime changes; all 12 changed PR paths matched eeea442 byte-for-byte. This short-input case proves the real request-to-recorder-to-reload lifecycle. Long-prefix preservation is covered separately by the production-path red/green regressions above. Neither establishes the historical cause of a live provider startup failure.

Visual evidence

Open preview

Before After
Before: terminal notice exposes the harmless sandbox setup failure marker After reload: one concise terminal failure notice without the setup marker

Real guest request, terminal failure and cued reload

after-proof.mp4

Visual verification

  • Baseline: 193be43 (preserved live failure capture)
  • Exact head: c2de59dce82bc79bac10771a968446e7e152e657
  • Scenario: Submit an owned guest request through the isolated Gateway while its sandbox setup command intentionally fails, inspect the recorded notice, and reload the conversation.
  • Runtime/build: Served build 2026.10.9-c2de59dce82b-2026-10-29T23-49-33.532Z; all 12 PR paths match eeea442 byte-for-byte.
  • Visible notice: 61 characters including setup marker before; 35-character neutral copy after
  • Canonical run-failure receipt: Exactly one; private 25-character diagnostic retained
  • Guest history after reload: One neutral notice; private diagnostic absent, preserving existing exclusion
  • Capture conditions: 1280 × 720 browser; matching 970 × 662 crop; dark theme; same owned fixture and setup fault; fresh sessions have different titles
  • Real Gateway request reached the production failure recorder, persisted one display-only notice, and remained visible after native reload.
  • The combined live source contains the complete PR patch plus separately qualified runtime work; it is not the PR head.
  • Private diagnostic retention and model-context exclusion were verified from selected canonical receipt fields.
  • This short setup failure proves the live lifecycle; long-prefix retention has separate production-path red/green coverage.
  • The 9.60-second recording preserves capture timing at 25 fps. Submission and reload cues use the recorded action times.
  • Only the first two frames have an opaque privacy mask over model controls; the failure notice and actual transitions remain visible.

Complementary synthetic-history comparison

This comparison uses actual baseline and fixed recorder payloads with the same UI bundle, including the warning-prefixed input. It supplements the live setup-failure proof above.

Open preview

Before After
Baseline terminal notice with the long diagnostic behind collapsed Details Fixed terminal notice showing concise neutral copy

Fixed notice persists after the cued conversation reload

after.webm

Visual verification

  • Baseline: 620e1fb (retained recorder payload; unchanged UI source)
  • Exact head: eeea442f50fc6024e4ba5ddac29ca450f16c8bb2
  • Scenario: Render the actual baseline and fixed recorder payloads through synthetic Gateway history, then reload the conversation.
  • Runtime/build: Control UI bundled at eeea442; shared index SHA-256 3afb1ca609b89c891a425008a2a7e7fe1435aca2322de1ffa4521b6ba9bfacf7; Chromium 156.0.8078.4
  • Notices after reload: 1 in each variant
  • Hidden diagnostic: Excluded from normal history projection
  • Capture conditions: 1160 × 850; dark theme; same route and synthetic input; Details collapsed
  • Both browser cases passed on the fixed source tree
  • Before payload came from the baseline production recorder; after payload was recaptured at the fixed head
  • Both variants used the same UI bundle and index digest
  • Reload is visibly cued; notice count remains one
  • This is synthetic Gateway history rendering, not a live provider crash reproduction

@clawsweeper

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

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime agents Agent runtime and tooling size: S labels Oct 29, 2026
@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. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. 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 29, 2026
@clawsweeper

clawsweeper Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

The PR preserves bounded terminal error diagnostics while showing classified guidance or a concise neutral failure notice.

Example: A terminal error contains 50 repetitions of "warning: " before "fatal: startup owner unavailable".

  • Before: The saved 512-character diagnostic cuts off the cause, and the visible notice includes warning text.
  • After: The saved diagnostic retains opening and terminal context, while history shows "Your request couldn't be completed."

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused repair with supplied live behavior evidence, persistence-boundary regressions, successful checks on the reviewed head, and no remaining findings.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Inspected before/after screenshots show the real isolated Gateway setup failure changing from a raw diagnostic notice to neutral copy; the body records persistence and native reload on a consumer qualified against all changed PR paths, supplemented by long-prefix lifecycle and WebSocket red/green 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 failed turn can show repeated warnings while its saved diagnostic omits the useful terminal cause.
Reason: The deterministic loss is repaired within existing owners and limits, and the maintainer-authored direction deliberately keeps unknown failures neutral.

Merge readiness

✅ Ready for maintainer review

This PR fixes a current diagnostic-loss bug through the existing owners, and no actionable findings remain.

Priority: P2
Reviewed head: eeea442f50fc6024e4ba5ddac29ca450f16c8bb2

Before merge

None.

Findings

None.

Agent review details

How this fits together

Gateway lifecycle and dispatch failures enter the shared session recorder, which writes a private diagnostic and a display-only transcript notice consumed by history readers.

flowchart TD
  A[Terminal run failure] --> B[Shared session recorder]
  B --> C[Sanitize and redact diagnostic]
  C --> D[Bounded private diagnostic]
  C --> E[Existing failure copy owner]
  D --> F[Transcript storage]
  E --> F
  F --> G[History display projection]
Loading

Technical review

Best possible solution:

Land the shared recorder repair with diagnostic bounds, specialized guidance, and existing privacy and lifecycle contracts preserved.

Do we have a high-confidence way to reproduce the issue?

Current main deterministically drops the supplied terminal cause through prefix-only diagnostic truncation; the linked report and PR supply production-path red/green results, while this read-only review verified the source path.

Is this the best way to solve the issue?

The change repairs the information loss at its producer, reuses the existing truncation and copy owners, preserves session-row presentation, and avoids adding state, configuration, or a competing formatter.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against cffc912d42dd.

Provenance checked

  • Bounded terminal diagnostics keeps the original intent (779e6cf: Preserve terminal diagnoses in bounded session-row errors after nested workspace-transfer wrappers.)
  • Diagnostic sanitation and session-row formatting changes intended behavior with a stated reason (a302730: The formatting extraction retained display-oriented sanitation; the PR explains why technical diagnostics must bypass its replacement and prefix truncation while session rows retain it.)
  • Generic provider-format excerpts changes intended behavior with a stated reason (cc030e6: Preserve a bounded, redacted provider rejection instead of misleading generic recovery advice; this PR omits generic excerpts only for terminal notices, preserving specialized guidance and other callers' defaults.)
  • Durable terminal failure notices keeps the original intent (2a77ac9: Persist a visible outcome when a turn fails before replying so reload does not leave an apparently unanswered request.)
  • Storage failure guidance keeps the original intent (80347a9: Use friendly storage guidance for transcript notices and a separate plain summary for length-limited session rows.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Current main still loses terminal context: Current main truncates the sanitized diagnostic to its first 512 UTF-16 units and embeds that value in generic visible notices. (src/sessions/session-run-error.ts:33, cffc912d42dd)
  • Focused repair through existing owners: The recorder separates diagnostic preparation from presentation, reuses the existing UTF-16-safe head-and-tail policy, and preserves suppression, context exclusion, deduplication, and write-authority checks. (src/sessions/session-run-error.ts:36, eeea442f50fc)
  • Regression coverage reaches persistence and projection: Lifecycle cases cover terminal-cause retention, redaction, Unicode boundaries, provider-detail exclusion, and missing-answer guidance; the WebSocket dispatch case separately covers an Error with a long warning prefix. The PR reports these regressions failing before the fix and passing afterward; this review ran no target code. (src/gateway/session-lifecycle-run-failure.test.ts:634, eeea442f50fc)
  • Live before-and-after evidence inspected: The downloaded before screenshot shows LAB_A1_SETUP_FAILURE in the notice; the after screenshot shows one neutral notice. The body and author comment describe a real guest request, production recorder persistence, and native reload on combined revision c2de59dce82bc79bac10771a968446e7e152e657, with all changed PR paths reported byte-identical to the reviewed head. The combined commit was unavailable locally and GitHub comparison returned 404. Captured context sourceRevision: ac15d788eaa0f6893d0f2ef63561692592b5406deaadd091ee5fb8670fec9cfe. Sources: fix: keep warnings out of terminal failure notices #187883 (comment) and the embedded before/after images. (eeea442f50fc)
  • Video inspection infrastructure limitation: The prepared manifest records "ffprobe failed: spawnSync ffprobe ENOENT" for the live recording; the web fallback failed with "Cache miss". The separately inspected screenshots remain usable evidence. (eeea442f50fc)
  • Successful checks on the reviewed head: The CI gate succeeded at https://github.com/openclaw/openclaw/actions/runs/40964433324/job/123774931235; combined commit statuses also report successful CI, dependency review, and security-sensitive review. GitHub reports the PR mergeable and clean. (eeea442f50fc)

Likely related people:

  • Peter Steinberger: Raw commit 80347a9 adds src/sessions/session-run-error.ts:42 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 80347a9bb5eb; files: src/sessions/session-run-error.ts)
  • Vincent Koc: Raw commit d0b48d6 adds src/agents/failover/assistant-request-failure-copy.ts:66 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d0b48d63efb8; files: src/agents/failover/assistant-request-failure-copy.ts)

PR surface

Source +36, Tests +102, Other +2. Total +140 across 12 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 3 63 27 +36
Tests 8 215 113 +102
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 12 280 140 +140

Review metrics

Metric Value Why it matters
Production versus test changes Production +63/-27; tests and support +215/-113 Production growth separates diagnostics from display copy while reusing existing owners; test growth covers distinct persistence, dispatch, redaction, and context boundaries, including relocation of existing setup.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #187862
Summary: The linked issue establishes recorder-side diagnostic loss; the related PRs address overlapping portions or broader diagnostic presentation.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P2: Lost failure causes and verbose notices complicate troubleshooting without changing execution, retries, or service availability.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster 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.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

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 (2 earlier review cycles)
  • reviewed 2026-10-29T20:41:47.959Z sha 009cd33 :: needs changes before merge. :: [P2] Preserve actionable copy for the known incomplete-turn outcome | [P2] Update the subagent consumer test for head-and-tail diagnostics
  • reviewed 2026-10-29T22:40:18.838Z sha eeea442 :: needs maintainer review before merge. :: none

Reviewed October 29, 2026, 8:35 PM ET / October 30, 2026, 00:35 UTC (Revision 3).

@shakkernerd

Copy link
Copy Markdown
Contributor Author

Preserved the runtime's existing missing-answer notice and side-effect warning, and updated the subagent checks for bounded opening-and-terminal diagnostics. Unknown failures keep neutral copy because their input does not establish a safe next action. The before/after presentation and reload evidence is now in the PR body.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 29, 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: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. 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. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 29, 2026
@clawsweeper clawsweeper Bot added the status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. label Oct 29, 2026
@shakkernerd shakkernerd self-assigned this Oct 29, 2026
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Added the real Gateway failure-to-reload proof requested by the review. An actual guest request hit an owned sandbox setup failure, produced one canonical failure receipt, and still showed one neutral notice after native reload. The private diagnostic remained retained and excluded from guest history. The PR body now includes inspected before/after captures and the cued recording, with the combined runtime identity and byte-for-byte qualification of all 12 PR paths. This short-input live case complements the existing long-prefix production-path regressions.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 30, 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. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 30, 2026
@shakkernerd
shakkernerd merged commit 82ba1ed into main Oct 30, 2026
195 of 196 checks passed
@shakkernerd
shakkernerd deleted the guest-failure-diagnostics branch October 30, 2026 00:43
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Fixed: terminal failure notices now stay concise while retaining redacted diagnostic causes.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 30, 2026
Keep redacted terminal causes in bounded run diagnostics while showing concise failure notices and preserving known recovery guidance.

Refs openclaw#187862.
steipete added a commit that referenced this pull request Oct 30, 2026
)

#187883 removed the raw-error fallback from terminal failure notices, which also dropped canonical provider refusal and precaution guidance: users saw a bare "Your request couldn't be completed." instead of the refusal category and next step. The session run-failure owner now recognizes the canonical refusal/precaution copy and keeps it, while warning diagnostics stay out of terminal notices.

CI: only Control UI e2e shards failed; the changed modules are not imported by the UI and the UI e2e suites run against a mocked Gateway.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 31, 2026
…claw#188462)

openclaw#187883 removed the raw-error fallback from terminal failure notices, which also dropped canonical provider refusal and precaution guidance: users saw a bare "Your request couldn't be completed." instead of the refusal category and next step. The session run-failure owner now recognizes the canonical refusal/precaution copy and keeps it, while warning diagnostics stay out of terminal notices.

CI: only Control UI e2e shards failed; the changed modules are not imported by the UI and the UI e2e suites run against a mocked Gateway.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor 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.

[Bug]: Long warning prefixes hide the cause in terminal run failure notices

1 participant