Skip to content

fix: surface hidden-pane steer failures and demote per-turn gateway log noise - #124560

Merged
steipete merged 5 commits into
mainfrom
steipete/fix-steer-swallow-lognoise
Aug 16, 2026
Merged

steipete merged 5 commits into
mainfrom
steipete/fix-steer-swallow-lognoise

Conversation

@steipete

@steipete steipete commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Related: #124473

What Problem This Solves

Fixes an issue where operators who steered a queued chat message and then navigated to another session would see no outcome at all when the steer failed: three terminal failure branches in the chat steer lifecycle (null transport result, failed queue-row restore, failed queue-row removal) still gated their error surfacing on the pane being visible, parking the error on a queue row nobody was looking at. This is the exact silent-failure invariant #124473 introduced surfaceChatDeliveryFailure() to protect — these three pre-existing branches never got routed through it.

Separately, resolves a problem where three per-turn gateway log lines dominated operator logs at info/warn level with no per-turn diagnostic value (one repeated 42x in a single observed session).

Why This Change Was Made

The steer fix routes all three terminal branches through the canonical surfaceChatDeliveryFailure() helper and deletes the divergent visibility-only branches, so every steer failure ends in a visible outcome (inline when the pane is visible, session-named global toast when not). The logging change demotes the per-turn tool policy removed N tool(s) audit line to debug and deletes the now-dead toolPolicyAuditLogLevel/auditLogLevel plumbing end-to-end (it only existed to lower diagnostic probes to what is now the default), demotes the codex one-shot cleanup teardown line to debug, and makes the static codex trajectory recorder warning fire once per process instead of per attempt. The [model-fetch] info carve-out is intentionally kept — it is a named always-info contract (docs/logging.md, #89648).

User Impact

Operators always get a visible outcome for a failed steer, even after switching sessions — no more silently swallowed terminal failures. Gateway logs at default level lose three lines of per-turn noise while keeping every signal available at debug.

Evidence

  • Regression test (mocked-gateway harness, real-behavior proof for the channel-visible toast path): ui/src/pages/chat/chat-send.test.ts — "surfaces an unconfirmed steer failure globally when the pane is no longer visible". Stash-verified failing pre-fix for the intended reason (visibility gate swallowed the terminal outcome); passes post-fix.
  • Post-rebase focused proof on this head: node scripts/run-vitest.mjs ui/src/pages/chat/chat-send.test.ts extensions/codex/src/app-server/trajectory.test.ts — 297 + 6 tests, all green.
  • Trajectory warn-once behavior covered in extensions/codex/src/app-server/trajectory.test.ts; tool-policy plumbing deletion covered by the updated src/agents/tool-policy-pipeline.test.ts.
  • Production LOC delta: net -11 (steer fix -6, logging refactor -5); test LOC +~40 (regression coverage).
  • UI screenshot: infeasible without new harness work — no existing dev:ui:mock scenario simulates a steer transport failure combined with pane navigation, and repo policy accepts the mock-gateway regression test as real-behavior proof for this channel-visible path.

Opportunistic fixes (called out per Pathfinder rule)

  • check-dependencies flagged the warn-once reset (resetCodexTrajectoryRecorderWarningForTest) as a production unused export — it was a test-only seam. Removed it; the test now gets clean module state via vi.resetModules() + fresh dynamic import.
  • checks-node-compact-large-2 flaked on src/gateway/cron-exit-watchers.test.ts (unrelated to this diff): the 0ms retry timer arms only after async watcher-state persistence, so await delay(5) races it on loaded CI workers. Replaced both fixed-sleep re-arm waits with vi.waitFor on the spawn count; the remaining delay(5) guards a negative assertion where a bounded sleep is the correct shape.
  • ClawSweeper P2 (accepted): the trajectory-recorder warn suppression was process-wide, but the host factory returns null for per-session target-mapping conflicts too — a later distinct session's recorder loss would be silenced. Now dedupes per session (bounded set), with regression coverage for a later distinct session still warning.

ClawSweeper rank-up moves

  • "Tighten the PR description" — applied: Evidence above lists exact validation commands, the stash-verified pre-fix failure, and the LOC delta. Remaining risk: the toast path is proven at the DOM level via the mocked-gateway harness rather than a live served dashboard; the helper it routes through (surfaceChatDeliveryFailure, fix(ui): chat send failures were invisible when the session pane was hidden #124473) is already live-proven, so residual risk is limited to wiring, which the regression test covers.
  • "Live Control UI proof" — skipped per repo policy: channel-visible chat behavior may satisfy the real-behavior-proof gate via the mock-gateway harness regression test covering the changed path (the review's own proof gate marks live proof not applicable for maintainer-authored PRs). No existing dev:ui:mock scenario simulates steer transport failure plus pane navigation; building one is named follow-up work, not a blocker.

Three terminal branches in steer-lifecycle.ts (transport null result,
failed queue-row restore, failed queue-row removal) still gated their
error on itemStillVisible, so a steer that failed after the operator
navigated away parked the error on the queue row with no visible
outcome — the exact invariant #124473 introduced
surfaceChatDeliveryFailure() to protect.

Route all three through the canonical helper and delete the divergent
visibility-only branches. Regression test fails pre-fix
(stash-verified): steer transport failure with the pane hidden now
surfaces the session-named global toast.
Live campaign evidence showed three lines dominating operator logs at
info level with no per-turn diagnostic value:

- 'tool policy removed N tool(s)': the policy pipeline runs on every
  turn, so this repeated 42x in one session. Demote to debug and delete
  the now-dead toolPolicyAuditLogLevel/auditLogLevel plumbing that only
  existed to lower diagnostic probes to the level that is now the
  default (net -13 production LOC).
- 'codex app-server one-shot cleanup checked shared client retirement':
  routine per-attempt teardown detail; demote to debug.
- 'codex trajectory capture requires the SQLite host recorder': static
  config condition warned per attempt; warn once per process.

Skipped: the [model-fetch] info carve-out in model-transport-debug.ts is
a named contract (docs/logging.md, #89648) — always-info by design.
@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime commands Command implementations agents Agent runtime and tooling extensions: codex size: S labels Aug 16, 2026
@steipete
steipete marked this pull request as ready for review August 16, 2026 12:19
@openclaw-barnacle openclaw-barnacle Bot added the maintainer Maintainer-authored PR label Aug 16, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. 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. labels Aug 16, 2026
@clawsweeper

clawsweeper Bot commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 16, 2026, 9:21 AM ET / 13:21 UTC.

ClawSweeper review

What this changes

Routes three hidden-pane queued-steer terminal failures through the shared failure surface and moves repeated tool-policy and Codex cleanup diagnostics below normal log verbosity.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep this PR open: the code follows the canonical visible-failure path and has no source-level blocking finding, but the required live Control UI proof for a queued-steer failure after navigation is absent.

Priority: P1
Reviewed head: 8d9d6d06ec263d5883ef7d2f6e7dcee69c43f51b

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) PR readiness rating was derived from proof quality, review findings, security review, and reviewer confidence.
Proof confidence 🌊 off-meta tidepool Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Evidence reviewed 7 items Current silent-failure gap: Current main retains visibility-only handling for the null transport result, failed restore, and failed removal branches, while the nearby canonical helper already sends hidden-session failures to a named global toast.
Proposed canonical repair: The PR replaces each of those three visibility gates with surfaceChatDeliveryFailure(), preserving the existing inline behavior and reusing the offscreen toast owner.
Existing sibling behavior: Other queued-delivery paths already call the same failure helper for hidden-session terminal failures, supporting one canonical UI failure surface rather than local visibility checks.
Findings None None.
Security None None.

How this fits together

The Control UI queues a steer, sends it through the Gateway, and must visibly report the terminal outcome even if the operator changed sessions. Agent and Codex runtime paths also emit diagnostics that flow into Gateway logs.

flowchart LR
  Operator[Operator steers a queued message] --> Queue[Chat queue]
  Queue --> Gateway[Gateway send]
  Gateway --> Outcome[Terminal outcome]
  Outcome --> FailureSurface[Shared failure surface]
  FailureSurface --> OperatorView[Inline error or global toast]
  AgentTools[Agent and Codex runtime] --> PolicyLog[Policy and cleanup diagnostics]
  PolicyLog --> DebugLogs[Debug log output]
Loading

Before merge

  • Resolve merge risk (P1) - The mocked regression test does not satisfy the repository’s required live Control UI video proof for a queued steer that fails after session navigation, so the real served-dashboard failure surface remains unobserved.
  • Complete next step (P2) - A maintainer-visible live Control UI proof is required before merge; no mechanical code repair is indicated.
Agent review details

Security

None.

PR surface

Source -8, Tests +16. Total +8 across 17 files.

View PR surface stats
Area Files Added Removed Net
Source 11 29 37 -8
Tests 6 79 63 +16
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 17 108 100 +8

Review metrics

Metric Value Why it matters
Production vs test LOC production -8, tests +16 The bug repair is net-negative in production while adding focused regression coverage.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/agents/tool-policy-pipeline.test.ts, vector/embedding metadata: src/agents/tool-policy-audit.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Capture the required live Control UI flow (recommended)
    Use an isolated Gateway and attach a redacted video of a queued steer failing after navigation, with the global toast visible.
  2. Accept mock-only coverage
    A maintainer may explicitly accept the remaining served-dashboard proof gap, knowing the new toast route has not been observed in a live UI session.

Technical review

Best possible solution:

Retain the canonical helper-based repair, then attach a sanitized recording from an isolated live Gateway showing a queued steer, session switch, transport failure, and session-named global toast before merge.

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

Yes, from source: current main gates three queued-steer terminal outcomes on pane visibility, and the PR’s focused harness drives a route switch before a transport failure. I did not execute the reproduction in this read-only review.

Is this the best way to solve the issue?

Yes for the implementation: routing all three branches through the existing shared failure helper is the narrowest owner-boundary repair; live UI evidence is still required before merge.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 243f51d314d1.

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P1: A queued steer can otherwise end with no visible operator outcome after a session switch.
  • merge-risk: 🚨 other: The merge changes a Control UI failure surface, but its required live served-dashboard proof is still missing.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.

Evidence

What I checked:

  • Current silent-failure gap: Current main retains visibility-only handling for the null transport result, failed restore, and failed removal branches, while the nearby canonical helper already sends hidden-session failures to a named global toast. (ui/src/pages/chat/steer-lifecycle.ts:478, 243f51d314d1)
  • Proposed canonical repair: The PR replaces each of those three visibility gates with surfaceChatDeliveryFailure(), preserving the existing inline behavior and reusing the offscreen toast owner. (ui/src/pages/chat/steer-lifecycle.ts:482, 8d9d6d06ec26)
  • Existing sibling behavior: Other queued-delivery paths already call the same failure helper for hidden-session terminal failures, supporting one canonical UI failure surface rather than local visibility checks. (ui/src/pages/chat/chat-send-delivery.ts:352, 243f51d314d1)
  • Logging behavior and callers: Current main emits every tool-policy removal at info by default; the PR makes that audit debug-only and removes the now-unused override through its listed callers. (src/agents/tool-policy-audit.ts:211, 243f51d314d1)
  • Trajectory provenance: The current trajectory-recorder implementation dates to the recorded Aria commit; the PR’s bounded per-session warning dedupe changes only OpenClaw’s internal diagnostic behavior, not an app-server protocol contract. (extensions/codex/src/app-server/trajectory.ts:125, 292ea7a33858)
  • Canonical UI-helper provenance: The shared hidden-pane failure surface was merged in the earlier UI repair, which establishes the intended owner boundary for this follow-up. (ui/src/pages/chat/steer-lifecycle.ts:336, 32ddbb3be23e)

Likely related people:

  • steipete: Merged commit 32ddbb3 established surfaceChatDeliveryFailure() in the affected lifecycle module, and this PR extends that existing owner boundary. (role: introduced shared UI failure surface and recent area contributor; confidence: high; commits: 32ddbb3be23e; files: ui/src/pages/chat/steer-lifecycle.ts, ui/src/pages/chat/chat-send.test.ts)
  • Aria: Blame attributes the current trajectory-recorder creation path to commit 292ea7a, the implementation this PR changes for per-session diagnostic deduplication. (role: current trajectory implementation author; confidence: medium; commits: 292ea7a33858; files: extensions/codex/src/app-server/trajectory.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (4 earlier review cycles)
  • reviewed 2026-08-16T12:25:06.282Z sha 45fd7fe :: needs maintainer review before merge. :: none
  • reviewed 2026-08-16T12:35:25.806Z sha 25d836e :: needs changes before merge. :: [P2] Keep recorder-loss diagnostics scoped to the failing session
  • reviewed 2026-08-16T12:49:31.489Z sha 6129fd3 :: found issues before merge. :: [P2] Scope recorder-loss diagnostics to the failing session
  • reviewed 2026-08-16T13:07:53.282Z sha 8d9d6d0 :: needs maintainer review before merge. :: none

Knip's production unused-export gate rejects
resetCodexTrajectoryRecorderWarningForTest — it was a test-only seam in
production code. Reset the process-wide warn-once flag via
vi.resetModules() + fresh dynamic import in the test instead.
@clawsweeper clawsweeper Bot added merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. 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 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. labels Aug 16, 2026
The 0ms retry timer arms only after async watcher-state persistence, so
'await delay(5)' races it on loaded CI workers (flaked on
checks-node-compact-large-2: spawn called 1 time, expected 2). Replace
both fixed-sleep re-arm waits with vi.waitFor on the spawn count. The
remaining delay(5) guards a negative no-further-spawn assertion after
cancel, where a bounded sleep is the correct shape.
ClawSweeper P2: the host recorder factory returns null for per-session
target-mapping conflicts, not only static config, so a process-wide
warn-once flag silenced a later distinct session's recorder loss. Warn
once per session (bounded set, cleared past 64 entries) so retries stay
quiet but each newly affected session records its loss. Regression
covers a later distinct session still warning.
@clawsweeper clawsweeper Bot added 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: 🦐 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. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 16, 2026
@clawsweeper clawsweeper Bot added the rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. label Aug 16, 2026
@steipete
steipete merged commit 7173aeb into main Aug 16, 2026
225 checks passed
@steipete
steipete deleted the steipete/fix-steer-swallow-lognoise branch August 16, 2026 13:23
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 17, 2026
…og noise (openclaw#124560)

* fix(ui): surface hidden-pane steer terminal failures globally

Three terminal branches in steer-lifecycle.ts (transport null result,
failed queue-row restore, failed queue-row removal) still gated their
error on itemStillVisible, so a steer that failed after the operator
navigated away parked the error on the queue row with no visible
outcome — the exact invariant openclaw#124473 introduced
surfaceChatDeliveryFailure() to protect.

Route all three through the canonical helper and delete the divergent
visibility-only branches. Regression test fails pre-fix
(stash-verified): steer transport failure with the pane hidden now
surfaces the session-named global toast.

* fix(logging): demote per-turn gateway log noise to debug

Live campaign evidence showed three lines dominating operator logs at
info level with no per-turn diagnostic value:

- 'tool policy removed N tool(s)': the policy pipeline runs on every
  turn, so this repeated 42x in one session. Demote to debug and delete
  the now-dead toolPolicyAuditLogLevel/auditLogLevel plumbing that only
  existed to lower diagnostic probes to the level that is now the
  default (net -13 production LOC).
- 'codex app-server one-shot cleanup checked shared client retirement':
  routine per-attempt teardown detail; demote to debug.
- 'codex trajectory capture requires the SQLite host recorder': static
  config condition warned per attempt; warn once per process.

Skipped: the [model-fetch] info carve-out in model-transport-debug.ts is
a named contract (docs/logging.md, openclaw#89648) — always-info by design.

* fix(codex): drop test-only trajectory warn-once reset export

Knip's production unused-export gate rejects
resetCodexTrajectoryRecorderWarningForTest — it was a test-only seam in
production code. Reset the process-wide warn-once flag via
vi.resetModules() + fresh dynamic import in the test instead.

* test(cron): wait for backoff re-arm instead of fixed sleep

The 0ms retry timer arms only after async watcher-state persistence, so
'await delay(5)' races it on loaded CI workers (flaked on
checks-node-compact-large-2: spawn called 1 time, expected 2). Replace
both fixed-sleep re-arm waits with vi.waitFor on the spawn count. The
remaining delay(5) guards a negative no-further-spawn assertion after
cancel, where a bounded sleep is the correct shape.

* fix(codex): scope trajectory recorder warn dedupe to session

ClawSweeper P2: the host recorder factory returns null for per-session
target-mapping conflicts, not only static config, so a process-wide
warn-once flag silenced a later distinct session's recorder loss. Warn
once per session (bounded set, cleared past 64 entries) so retries stay
quiet but each newly affected session records its loss. Regression
covers a later distinct session still warning.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui commands Command implementations extensions: codex gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P1 High-priority user-facing bug, regression, or broken workflow. 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.

1 participant