Skip to content

fix: preserve failure causes after repeated warnings - #187779

Closed
roboclaw-bot wants to merge 1 commit into
mainfrom
openclaw/cool-shell-2
Closed

roboclaw-bot wants to merge 1 commit into
mainfrom
openclaw/cool-shell-2

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #155378. This is a small existing-limit fix, not a replacement for @freeqaz-openai's broader diagnostics draft.

What Problem This Solves

Fixes failed-request notices losing their terminal error reason when repeated launcher warnings fill the beginning of the diagnostic.

User Impact

Users retain both initial context and the terminal diagnosis in the saved failure notice. The existing 512-character diagnostic limit and 160-character session-row limit remain unchanged, and redaction still happens before truncation.

This does not repair the host's jemalloc profiling setup or establish why every affected request failed. There are no configuration, schema, permission, retry, or failure-settlement changes.

Why This Change Was Made

Session rows already retain the beginning and end of long errors, while saved failure notices keep only the beginning. Reuse that UTF-16-safe truncation policy for both surfaces instead of introducing another formatter, increasing retention, or suppressing warnings. Short errors and specialized storage-failure guidance remain unchanged.

Evidence

  • Before the production change, the focused Gateway regression run failed three assertions: the allocator-warning tail, the long Unicode-context tail, and the redacted upload-failure tail were missing from the saved notice. The session row already retained the cause.
  • After the fix, pnpm test src/gateway/session-lifecycle-run-failure.test.ts src/sessions/session-run-error.test.ts --maxWorkers=1 passed 43 tests across the Gateway lifecycle/persistence and session-error owner suites. This exercises the real lifecycle writer and persisted failure report, not a precomputed summary.
  • Test wall times: Gateway file 66.27 s, owner unit file 1.66 s, combined wrapper 71.09 s. The newly added allocator scenario took 464 ms; most Gateway wall time was compiler preparation and the existing persistence scenarios. CI timings are not yet available.
  • Production typecheck (tsconfig.core.json), focused repository lint on the three TypeScript files, pinned formatter check, staged test-line ratchet, and staged diff check passed. Command-local logs and exit receipts were inspected because the host bridge intermittently failed during post-command finalization with the same jemalloc warning.
  • Independent AutoReview was attempted against local changes based on 92d61ac49882c9c8c815cf5d24dbe145a47f4238 at its default P0 scope. Review is incomplete: the reviewer command was terminated after repeated jemalloc warnings exhausted its bounded output capture (exit 143, output-limit flag set). There is no clean review verdict. Independent review and broad CI remain outstanding; the requester has asked to open the PR for review.
  • Simplification: reuse the existing error-summary owner; no new state, configuration, or parallel policy. Net production growth is four lines; the twelve net regression-test lines extend existing persistence cases and have their own matching allocation record.
  • No live-host profiling repair or live model/Gateway/browser end-to-end run was performed. The original incident's full failing operation remains unverified; the narrower diagnostic-loss defect has red/green persistence-boundary proof.
Incident report and operator follow-up

On 2026-10-29, repeated Team webchat errors showed only:

<jemalloc>: failed to open "/var/tmp/jeprof/gw.<pid>.<sequence>.u<sequence>.heap"

The reported payload was exactly 512 characters and matched a prefix-only cut through the repeated warnings. An independent tiny exec command returned exit code zero with both expected stdout/stderr markers while its captured output also contained 17 fresh profile-open warnings. Warnings therefore do not, by themselves, prove that jemalloc caused the request failure.

An inspected sandbox Node process had neither jemalloc environment settings nor a jemalloc mapping, although warnings appeared before its output. The emitting executable in the host-side launch/bridge chain still needs to be identified. The profile directory was absent inside the sandbox; this does not establish its existence or permissions on the host or in a service-private filesystem namespace.

The operator should inspect the actual emitting process's profiling configuration and hooks. Disable unintended profiling, or provision a private service-writable profile directory in the correct namespace with bounded retention if profiling is intentional. Keep jemalloc itself if it is deliberately used as the allocator. Do not create a world-writable profile directory or treat a sandbox-only directory as a host fix.

The same warning flood reproduced an actual helper failure during independent AutoReview: the helper exceeded its bounded output capture and was terminated. This establishes one failure mechanism in this investigation, not the retrospective cause of every reported request failure.

Correlate one actual failed request with the complete Gateway/helper error, process identity, exit status or signal, and effective profiling configuration. This separates profiling-caused failures from unrelated failures hidden behind profiler output.

Work sessions

Worked on by

Worked on by:
- @TheAngryPit

Co-authored-by: TheAngryPit <[email protected]>
OpenClaw-Publication: 64c3bead-82bc-41c1-a9d3-67222724163c
@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 size: XS labels Oct 29, 2026
@roboclaw-bot
roboclaw-bot marked this pull request as ready for review October 29, 2026 16:12
@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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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 changes before merge.

What this changes

This PR preserves the beginning and terminal cause of long failure notices within the existing 512-character limit.

Example: Twenty allocator warnings precede “Cloud workspace reconciliation exceeds the 25000 entry limit.”

  • Before: The saved notice contains only warnings and loses the terminal diagnosis.
  • After: The saved notice retains initial warning context and the terminal diagnosis.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful, focused production change with persistence-boundary evidence, but an unchanged consumer expectation causes two confirmed CI failures.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored bot PR is outside the ordinary contributor proof gate; its supplied evidence exercises the real lifecycle writer and saved receipts through an in-process test fixture.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Saved failure notices can show only repeated launcher warnings and omit the actual terminal diagnosis.
Reason: The maintainer-authored direction restores useful diagnostics through an existing formatter without expanding configuration, retention limits, or settlement behavior.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep open: this PR fixes a current diagnostic-loss bug, but two subagent regression cases still expect the replaced truncation behavior and fail CI.

Priority: P2
Reviewed head: 33854059956e433a0e9462dc8ce5aa7159039b6c

Before merge

  • Update the subagent receipt tests for the shared truncation policy (P2) - Changing this shared writer also changes notices emitted by persistSubagentSessionTiming. Its existing regression still compares details.error with reason.slice(0, 512) in src/agents/subagents/registry/subagent-registry.session-failure.test.ts:78. For the existing long “Repository base ref is missing” fixture, both error and timeout cases now receive head-and-tail text instead, and checks-node-changed-3 reports both assertion failures. Update that consumer test to independently verify the intended bounded diagnostic and terminal context, then run it alongside the touched suites.

Findings

  • [P2] Update the subagent receipt tests for the shared truncation policy — src/sessions/session-run-error.ts:32-33

Tests

  • Missing end-to-end proof: The body explicitly reports no shipped Gateway or browser run showing a warning-flood failure notice after saving and reloading history.
Agent review details

How this fits together

Gateway lifecycle and subagent settlement pass failure diagnostics to the shared session-error writer, which redacts and bounds text before appending a saved conversation notice.

flowchart TD
 A[Gateway lifecycle failure] --> C[Shared session error writer]
 B[Subagent failure settlement] --> C
 C --> D[Redact diagnostic]
 D --> E[Bound head and tail]
 E --> F[Saved transcript notice]
 F --> G[Conversation history]
Loading

Technical review

Best possible solution:

Keep the shared bounded formatter and update the subagent receipt regression to verify the intended output independently.

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

Current main truncates sanitized notices to their first 512 UTF-16 units, necessarily dropping a terminal cause after a longer warning prefix; the body reports matching red/green persistence tests, but this review executed no target code.

Is this the best way to solve the issue?

The patch uses the smallest existing owner for the defect: one shared UTF-16-safe truncation policy preserves terminal causes while keeping redaction, limits, and specialized failure guidance intact.

Full review comments:

  • [P2] Update the subagent receipt tests for the shared truncation policy — src/sessions/session-run-error.ts:32-33
    Changing this shared writer also changes notices emitted by persistSubagentSessionTiming. Its existing regression still compares details.error with reason.slice(0, 512) in src/agents/subagents/registry/subagent-registry.session-failure.test.ts:78. For the existing long “Repository base ref is missing” fixture, both error and timeout cases now receive head-and-tail text instead, and checks-node-changed-3 reports both assertion failures. Update that consumer test to independently verify the intended bounded diagnostic and terminal context, then run it alongside the touched suites.
    Confidence: 1

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Terminal-cause truncation keeps the original intent (779e6cf: Preserve terminal workspace-transfer diagnoses within the existing session-row error limit.)
  • Lightweight session-error formatting owner keeps the original intent (a302730: Separate formatting from transcript persistence to narrow runtime and fixture imports.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm test src/agents/subagents/registry/subagent-registry.session-failure.test.ts src/gateway/session-lifecycle-run-failure.test.ts src/sessions/session-run-error.test.ts --maxWorkers=1
  • git diff --check
  • Verify checks-node-changed-3 passes for the repaired head.

What I checked:

PR surface

Source +4, Tests +12, Other +2. Total +18 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 15 11 +4
Tests 1 13 1 +12
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 4 30 12 +18

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This repairs lost diagnostic context after failed turns without changing execution or resolving the underlying request failure.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

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.

Reviewed October 29, 2026, 12:28 PM ET / 16:28 UTC.

@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Closing as superseded.

Superseded by #187883. Bounded, redacted head/tail diagnostics retain terminal causes. Current visible notices deliberately use concise failure copy instead of raw warning/error text, so the older visible-message contract should not be restored.

This closes the PR without deleting its branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XS status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant