Skip to content

fix: retain refusal guidance in terminal failure notices - #188462

Merged
steipete merged 1 commit into
mainfrom
codex/refusal-reason-in-failure-notice
Oct 30, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/refusal-reason-in-failure-notice

Conversation

@steipete

@steipete steipete commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes bare terminal failure notices when the provider refuses a request or stops chat as a precaution, leaving users without the reason or next step.

User Impact

Refusal notices retain their category and ask users to revise the request. Precaution notices tell users to review the findings in chat before continuing. Warnings and raw diagnostics remain private.

Why This Change Was Made

The raw-cause fallback removed by #187883 also carried already-safe refusal guidance. The terminal notice recorder now recognizes only the canonical refusal and precaution display forms owned by the shared formatter. This is presentation only: classification, retries, native thread identity, and provider-review authority are unchanged. #188056 changed clone-retry expectations, not this production path.

Unknown or warning-prefixed diagnostics retain the existing concise fallback. Existing saved notices are not rewritten. There are no config, dependency, schema, or migration changes.

Evidence

The unchanged Gateway product regression was red on base 4f9b2a0f1a2a2dafaa1fa9dbdf29310480f5b10b: bio, cyber, and misalignment failed solely because their summaries became the bare notice; retryable recovery passed. A git log -p -S search of the removed fallback in src/sessions/session-run-error.ts identifies 82ba1ed1074f05b92285258771988efe69a417f5 as the removal.

The product proof uses isolated Gateways and a synthetic app-server fixture, with no live provider or user state. It verifies terminal outcomes, durable chat history, later-turn behavior, review blocking, retry counts, and native thread reuse.

Proof Result
nice -n 5 env OPENCLAW_VITEST_RUNTIME=bun node scripts/run-vitest.mjs test/e2e/qa-lab/runtime/gateway-codex-refusal-product-proof.e2e.test.ts --maxWorkers=1 Base: 3 failed / 1 passed (326.35s Vitest). Fixed: 4 passed (201.96s Vitest; 552.46s including typed runtime build). Uses the repository-pinned Bun fork.
Same product proof with OPENCLAW_VITEST_RUNTIME=node, plus src/gateway/session-lifecycle-run-failure.test.ts, src/sessions/session-run-error.test.ts, and src/shared/assistant-error-format.test.ts 4 product cases and 62 unit/lifecycle cases passed; 261.56s total. Product file: 170.54s. Existing lifecycle coverage proves warning-prefixed diagnostics stay private.
Bun notice/formatting unit tests (src/sessions/session-run-error.test.ts and src/shared/assistant-error-format.test.ts, same wrapper and worker limit) 25 passed; 6.44s total.
node scripts/run-tsgo.mjs -p tsconfig.core.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core.tsbuildinfo Passed.
node scripts/run-format.mts --check src/sessions/session-run-error.ts src/shared/assistant-error-format.ts docs/plugins/codex-harness/runtime-behavior.md Passed.
node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json src/sessions/session-run-error.ts src/shared/assistant-error-format.ts Passed.
Line-cap and max-lines ratchets against the base; git diff --check Passed; no budget or baseline changes.

The product E2E remains unchanged as the red-on-base regression: net test growth is zero. The simplification pass retains one notice owner and restores no raw-error fallback: production +14 net lines, docs +5.

Isolated Codex autoreview of the complete candidate against the base completed with no actionable P0–P2 findings. The initial review attempt stopped at its temporary-directory safety preflight; the supported macOS private temp directory resolved that without weakening isolation. The local ClawSweeper checkout was unavailable because of unrelated modifications, so this uses the documented autoreview fallback and the ready PR's hosted review.

Exact-head CI completed for 948083c6f259b2136b70c47691a65a2a7047a2aa: run 41079526581. Required openclaw/ci-gate is FAILURE. The four failed jobs are Control UI E2E shards 1, 2, 3, and 6; 56 other checks passed and 53 were skipped. No CI rerun requested.

The failed-job classifier alone is insufficient for attribution, so I compared exact tests, annotations, and synthetic diagnostic artifacts against completed main run 41071928241, head fa286a72d3624be71e65165404ef66eb013b24d2:

Failed PR job Evidence / disposition
UI 2/7 Confirmed inherited: settings-loading-skeletons.e2e.test.ts, “renders both Agent Tools data loads as skeletons,” times out waiting for the request at line 160 on both PR and main. Artifacts show the same Agent Tools route with no selected agent.
UI 6/7 Confirmed inherited failures in catalog-request-admission.e2e.test.ts:130 (initial fixture tool never visible) and session-context-breakdown.e2e.test.ts:140 (files category never visible), also present on main. The PR additionally fails the context test's line 125 request-count assertion; that specific assertion has not been reproduced on main.
UI 1/7 Unclassified: chat lifecycle error-first case times out at line 695 waiting for the sidebar error-attention marker. Matching scheduled-main shard passed. The exact case and then the entire file passed locally on the unchanged starting-main base.
UI 3/7 Unclassified: boot-composer case reads a null bounding box at line 33. Matching scheduled-main shard passed. The exact case and then the entire file passed locally on the unchanged starting-main base.

Local baseline checks used detached 4f9b2a0f1a2a2dafaa1fa9dbdf29310480f5b10b, Node, isolated browser fixtures, and one worker:

nice -n 5 env OPENCLAW_VITEST_RUNTIME=node node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/chat-run-lifecycle.e2e.test.ts ui/src/e2e/chat-boot-composer.e2e.test.ts --maxWorkers=1 --testNamePattern 'clears shared session activity when chat error arrives first|accepts typing before the Gateway and route are ready'
# 2 passed, 16 skipped; 24.83s Vitest
nice -n 5 env OPENCLAW_VITEST_RUNTIME=node node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/chat-run-lifecycle.e2e.test.ts ui/src/e2e/chat-boot-composer.e2e.test.ts --maxWorkers=1
# 18 passed; 54.30s Vitest

Those passing replays do not establish that the unclassified failures are inherited. The PR changes no UI source or fixtures, but that alone is not a replacement for reproduction. I am stopping with CI unresolved; I have not changed UI tests, requested reruns, relaxed gates, or merged. The branch remains ready for coordinator review, with the refusal regression green under Bun and Node as recorded in the PR body.

Restore canonical provider refusal categories and precaution next steps after
#187883 removed the raw-cause fallback. Keep warning and diagnostic text private;
refusal classification, retries, and provider-review authority stay unchanged.

Retain the existing product regression: three failures on the base, all four
cases passing under Bun and Node with zero test-line growth.
@clawsweeper

clawsweeper Bot commented Oct 30, 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 30, 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-30T15:20:29.788235Z 948083c PR opened
ℹ️ 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 extensions: codex size: XS labels Oct 30, 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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. 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 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR preserves canonical provider refusal categories and precaution guidance in terminal failure notices.

Example: A request ends with a provider refusal categorized as bio.

  • Before: Your request couldn't be completed.
  • After: Your request couldn't be completed: The provider refused this request (category: bio). Revise the request and try again.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A useful, focused repair with no identified correctness defect and substantial reported regression coverage, supported by harness evidence rather than changed-path runtime captures.
Proof confidence 🦐 gold shrimp (3/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A provider refusal leaves only a bare failure notice, hiding its category and the next action.
Reason: The maintainer-authored direction restores established guidance with a focused presentation change and preserves the predecessor’s privacy contract.

Regression provenance

Regression provenance — verified: source commit 82ba1ed1074f by Shakker; canonical PR #187883 (blame-to-merge-commit).

Merge readiness

✅ Ready for maintainer review

Keep open: this PR repairs a current loss of actionable refusal guidance through the existing formatting and transcript owners; no concrete patch defect was found.

Priority: P2
Reviewed head: 948083c6f259b2136b70c47691a65a2a7047a2aa

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Supply runtime output or before/after Control UI captures showing refusal and precaution notices surviving chat-history reload; existing regression results are reported red on base and green on head.
Agent review details

How this fits together

Provider failures pass through shared error formatting into the Gateway session recorder, which persists a display-only notice for chat history alongside a private diagnostic.

flowchart TD
A[Provider failure] --> B[Shared refusal formatter]
B --> C[Session failure recorder]
C --> D[Canonical display notice]
C --> E[Private diagnostic]
D --> F[Transcript storage]
E --> F
F --> G[Chat history projection]
Loading

Technical review

Best possible solution:

Retain the narrow canonical-copy matcher in the shared formatter and reuse the existing recorder without restoring raw diagnostics.

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

Current-main source sends canonical refusal text to the neutral fallback, matching the existing Gateway regression and the body’s reported base failures; this read-only review ran no target code.

Is this the best way to solve the issue?

The patch is the smallest complete repair: preserve actionable canonical copy through the existing owners while keeping warning-prefixed and unknown diagnostics private.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Terminal failure notice fallback changes intended behavior with a stated reason (82ba1ed: Keep raw warnings and provider diagnostics out of normal history while preserving safe specialized guidance.)
  • Shared refusal display owner keeps the original intent (5265b86: Keep refusal display independent of runtime policy and avoid importing agent execution dependencies into Gateway presentation.)
  • Precaution guidance keeps the original intent (48f664c: Explain provider precaution stops and require review through the existing continuation authority.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 5265b86 adds src/shared/assistant-error-format.ts:49 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 5265b861336b; files: src/shared/assistant-error-format.ts)
  • Shakker: Raw commit 82ba1ed adds src/sessions/session-run-error.ts:50 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 82ba1ed1074f; files: src/sessions/session-run-error.ts)
  • Vincent Koc: Raw commit 397b0d8 adds src/shared/assistant-error-format.ts:8 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 397b0d85f571; files: src/shared/assistant-error-format.ts)

PR surface

Source +14, Docs +5. Total +19 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 15 1 +14
Tests 0 0 0 0
Docs 1 5 0 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 20 1 +19

Review metrics

Metric Value Why it matters
Production versus test changes Production +15/-1; tests +0/-0 Small production growth recognizes safe display forms while retaining the existing end-to-end regression without additional scaffolding.

Labels

Label changes:

  • add P2: Missing refusal explanations and next steps cause user confusion, while execution and provider enforcement remain intact.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Missing refusal explanations and next steps cause user confusion, while execution and provider enforcement remain intact.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add a redacted runtime capture of refusal and precaution guidance persisting through chat-history reload.

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 30, 2026, 11:33 AM ET / 15:33 UTC.

@steipete

Copy link
Copy Markdown
Contributor Author

Exact-head CI completed for 948083c6f259b2136b70c47691a65a2a7047a2aa: run 41079526581. Required openclaw/ci-gate is FAILURE. The four failed jobs are Control UI E2E shards 1, 2, 3, and 6; 56 other checks passed and 53 were skipped. No CI rerun requested.

The failed-job classifier alone is insufficient for attribution, so I compared exact tests, annotations, and synthetic diagnostic artifacts against completed main run 41071928241, head fa286a72d3624be71e65165404ef66eb013b24d2:

Failed PR job Evidence / disposition
UI 2/7 Confirmed inherited: settings-loading-skeletons.e2e.test.ts, “renders both Agent Tools data loads as skeletons,” times out waiting for the request at line 160 on both PR and main. Artifacts show the same Agent Tools route with no selected agent.
UI 6/7 Confirmed inherited failures in catalog-request-admission.e2e.test.ts:130 (initial fixture tool never visible) and session-context-breakdown.e2e.test.ts:140 (files category never visible), also present on main. The PR additionally fails the context test's line 125 request-count assertion; that specific assertion has not been reproduced on main.
UI 1/7 Unclassified: chat lifecycle error-first case times out at line 695 waiting for the sidebar error-attention marker. Matching scheduled-main shard passed. The exact case and then the entire file passed locally on the unchanged starting-main base.
UI 3/7 Unclassified: boot-composer case reads a null bounding box at line 33. Matching scheduled-main shard passed. The exact case and then the entire file passed locally on the unchanged starting-main base.

Local baseline checks used detached 4f9b2a0f1a2a2dafaa1fa9dbdf29310480f5b10b, Node, isolated browser fixtures, and one worker:

nice -n 5 env OPENCLAW_VITEST_RUNTIME=node node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/chat-run-lifecycle.e2e.test.ts ui/src/e2e/chat-boot-composer.e2e.test.ts --maxWorkers=1 --testNamePattern 'clears shared session activity when chat error arrives first|accepts typing before the Gateway and route are ready'
# 2 passed, 16 skipped; 24.83s Vitest
nice -n 5 env OPENCLAW_VITEST_RUNTIME=node node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/chat-run-lifecycle.e2e.test.ts ui/src/e2e/chat-boot-composer.e2e.test.ts --maxWorkers=1
# 18 passed; 54.30s Vitest

Those passing replays do not establish that the unclassified failures are inherited. The PR changes no UI source or fixtures, but that alone is not a replacement for reproduction. I am stopping with CI unresolved; I have not changed UI tests, requested reruns, relaxed gates, or merged. The branch remains ready for coordinator review, with the refusal regression green under Bun and Node as recorded in the PR body.

@steipete
steipete merged commit 6a550b0 into main Oct 30, 2026
142 of 150 checks passed
@steipete
steipete deleted the codex/refusal-reason-in-failure-notice branch October 30, 2026 15:51
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

docs Improvements or additions to documentation extensions: codex P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XS 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