Skip to content

fix(ui): steer messages jump into the middle of an active run, then disappear - #165535

Merged
steipete merged 2 commits into
mainfrom
steipete/steer-always-bottom
Oct 5, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/steer-always-bottom

Conversation

@steipete

@steipete steipete commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: a steer message sent during an active run shows up in the middle of the transcript (above tool activity and text that were already visible), then disappears before its saved copy arrives.

User Impact

User impact: a steer moves once from the queue to the bottom of the transcript when delivery starts and stays there until its saved copy replaces it. Everything that was already visible stays above it, new output appears below it, and that order survives history refreshes, reconnects, pane remounts, and reloading a finished run, including when a streamed answer spans the steer.

Why This Change Was Made

Three independent defects produced the reported behavior:

  • Live placement (Control UI). Already-visible tool rows without a paired text segment never received the steer boundary in chat-thread-build.ts, so timestamp placement reordered tool -> answer -> steer into answer -> steer -> tool. When a steer is delivered, every live tool of that run that is already visible is now closed before it (closeToolStreamBoundary in tool-stream-state.ts), tools that start afterward record the steer as their lower boundary, and the thread builder prefers those recorded boundaries; stream reconciliation keeps them through history and terminal reconciliation.
  • Persisted order (Codex harness). The native event projector excluded unfinished assistant items from the pre-steer snapshot, so text streamed before the steer was saved after it, combined with the continuation. The projector now captures the already-streamed prefix at steer delivery, persists it before the steer, and persists only the continuation afterward (event-projector-steering.ts). The transcript mirror tracks committed segments per candidate so a changed completion identity, raw completions, repeated steering, and partial-write retries cannot drop or duplicate the continuation. Existing transcript tables and columns; no schema change.
  • Disappearance (Control UI). Accepting queued custody or input consumption retired the optimistic steer display before the canonical transcript copy existed. Dispatched steers are now retained through the existing submission owner until their transcript receipt replaces them exactly once, including across cache remounts; cancelled or stopped inputs still retire immediately, and failed sends still hand Retry to the outbox row.

Evidence

Mocked Control UI e2e (dark theme, 1200x900): an active run with visible Read activity and streamed text, then the steer "take over vince's work too" is delivered. Fixture data only; the throwaway capture test was not committed. "Before" ran the same capture with origin/main production files.

Before, live (steer lands above the already-visible Read activity):

before live

After, live (steer at the bottom):

after live

Before, after history refresh (wrong order persists):

before refresh

After, after history refresh (order survives):

after refresh

Regression tests (each failed on origin/main before the fix), pnpm test <file> --maxWorkers=1:

Test Passed Wall time
ui/src/pages/chat/chat-steer-order.test.ts (new) 2 9.8s
ui/src/pages/chat/chat-queue-steer-lifecycle.test.ts (new) 4 16.0s
ui/src/pages/chat/chat-send-handoff.test.ts 6 10.9s
extensions/codex/src/app-server/event-projector-snapshot.test.ts 17 91.2s
extensions/codex/src/app-server/run-attempt.steering.test.ts 13 204.3s
extensions/codex/src/app-server/transcript-mirror.test.ts 40 63.9s

Wall times are from a heavily loaded host; the new UI tests are pure state/projection tests (no real timers, no Gateway boot). The native steering cases reuse the existing suite fixture.

Gates: pnpm tsgo:ui, pnpm tsgo:extensions, oxfmt and oxlint on touched files, git diff --check. Independent Codex autoreview: scoped-clean.

Limits: proof uses mocked Gateway/native events plus real SQLite persistence; no live provider run. Docs updated in docs/web/control-ui/chat.md.

Landing CI follow-up

The first CI attempt at 6f0094d03ab4 exposed a stale UI E2E expectation: after a failed steer ACK, the already-visible prefix remains above the Retry/Discard row and the continuation appears below it. Both fragments remain visible. The assertion now checks the continuation separately and retains the original draft, active-response, and Stop-target checks. The focused two-case E2E passes with --maxWorkers=1 (18.52s wall time; 4.961s test time). The original CI failure took 33.35s in that case before its 30s locator timeout. No production behavior changed in this follow-up.

The same run also failed three cases in extensions/codex/src/app-server/run-attempt-thread-cleanup.test.ts: the confirmed indeterminate-turn case and both terminal-cleanup cancellation cases expected no thread/unsubscribe. These failures are inherited from main: commit 4c34d8eeadfc (#165487) changed required subscription cleanup to use the resource cleanup authority. The test and cleanup owner are unchanged by this PR. Running the original five-file CI selection with two workers reproduced exactly three failures and 42 passes on both the PR and clean main 2795ad9d0e03 (157.41s and 232.85s, respectively). Main's cleanup source is unchanged from the tested CI base 6b37a39aa104. This is failure attribution, not passing CI.

The correction is published as f953e34d63f6 and its independent Codex autoreview is scoped-clean. Exact-head CI 37305321004 passed the affected UI E2E shard and security-fast. Its only root failure is the same three inherited cleanup assertions; openclaw/ci-gate failed downstream and the successful fail-fast monitor cancelled 23 jobs. Final job conclusions: 14 successful, 2 failed, 23 cancelled, 22 skipped. Landing uses the native inherited-failure admin exception with the exact tested merge, baseline reproduction, failure logs, and exhaustive cancellation attribution. Cancelled coverage remains unrun. No CI rerun was requested.

Keep dispatched steers visible once until their canonical transcript copy
arrives, including queued custody, retries, history refreshes, and pane
remounts. Preserve the causal order of live tools and streamed text through
terminal reconciliation.

Persist native assistant prefixes before steering and save only subsequent
text afterward. Track committed segments per mirror candidate so changed
completion identities, repeated steering, and partial-write retries cannot
lose or duplicate the continuation. Reuse the existing transcript schema
and app submission owner.

Cover the queue-strip action, cached projection recovery, stream ordering,
and native transcript persistence with focused regressions.
@clawsweeper

clawsweeper Bot commented Oct 5, 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 docs Improvements or additions to documentation app: web-ui App: web-ui extensions: codex size: XL labels Oct 5, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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 Oct 5, 2026
@clawsweeper

clawsweeper Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 5, 2026, 7:55 AM ET / 11:55 UTC (Revision 2).

ClawSweeper review

What this changes

The PR keeps steering messages below already-visible chat output, retains their display until saved copies arrive, and persists Codex assistant text separately before and after steering.

Merge readiness

✅ Ready for maintainer review

The repair remains necessary on current main. No blocking correctness defect was identified in the pinned patch or its E2E follow-up.

Priority: P2
Reviewed head: f953e34d63f6c9ec44a7eafc240a62c89329a666

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair across the necessary owners, supported by inspected visual evidence and meaningful lifecycle and persistence regressions.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: Verified repository-admin authorship exempts the ordinary external-contributor proof gate. Inspected browser before/after screenshots demonstrate live and refreshed UI ordering with a mocked Gateway; native persistence has supplemental real-SQLite regression coverage, without a live provider run. Existing transcript formats and readers remain compatible.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Verified repository-admin authorship exempts the ordinary external-contributor proof gate. Inspected browser before/after screenshots demonstrate live and refreshed UI ordering with a mocked Gateway; native persistence has supplemental real-SQLite regression coverage, without a live provider run. Existing transcript formats and readers remain compatible.
Evidence reviewed 10 items Current main still needs the repair: At fetched main, collectCompletedAssistantMessages excludes unfinished assistant items from steering snapshots, and reconcileChatInputCustody unconditionally retires local submissions on custody or consumption receipts.
Introduced production behavior: The pinned introduced delta records tool boundaries, retains dispatched steering display through the existing submission owner, and advances assistant cutoffs per committed mirror candidate. Reviewed against merge-base a1ce6fb, rather than endpoint drift.
Inspected visual evidence: Inspected all four downloaded screenshots. Before images place the Read activity below the steer; after images show Read activity and existing assistant text above the steer, both live and after refresh. The captured PR body explicitly identifies mocked Gateway fixtures and no live provider run.
Findings None None.
Security None None.

How this fits together

The Control UI combines live agent output, pending user messages, and saved conversation history. The Codex plugin translates native events into that history, so both owners must preserve the same message order.

flowchart TD
  A[User steers active chat] --> B[Retained user message]
  C[Live text and tools] --> D[Recorded steering boundary]
  B --> D
  E[Codex native events] --> F[Transcript persistence]
  F --> G[Saved message receipt]
  D --> H[Ordered chat transcript]
  G --> H
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +314, Tests +1005, Docs 0. Total +1319 across 26 files.

View PR surface stats
Area Files Added Removed Net
Source 18 471 157 +314
Tests 7 1052 47 +1005
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 26 1524 205 +1319

Review metrics

Metric Value Why it matters
Production versus regression coverage production net +314 lines; tests net +1005 lines The production growth has a stated justification covering live placement, display custody, and persisted assistant segmentation.

Stored data model

Persistent data-model change detected: serialized state: extensions/codex/src/app-server/event-projector-steering.ts, unknown-data-model-change: extensions/codex/src/app-server/event-projector-steering.ts. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Technical review

Best possible solution:

Keep one submission display owner and one transcript persistence owner, with explicit causal boundaries preserving conversation order.

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

Yes, source establishes the current-main mechanisms, and the supplied before screenshots show the ordering failure. This review did not execute a failing reproduction.

Is this the best way to solve the issue?

Yes, the patch repairs the existing display and persistence owners, preserves their reconciliation contracts, and adds regressions for distinct lifecycle and persistence failures.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This repairs a bounded chat-ordering and temporary-disappearance defect without evidence of a core outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Verified repository-admin authorship exempts the ordinary external-contributor proof gate. Inspected browser before/after screenshots demonstrate live and refreshed UI ordering with a mocked Gateway; native persistence has supplemental real-SQLite regression coverage, without a live provider run. Existing transcript formats and readers remain compatible.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. Verified repository-admin authorship exempts the ordinary external-contributor proof gate. Inspected browser before/after screenshots demonstrate live and refreshed UI ordering with a mocked Gateway; native persistence has supplemental real-SQLite regression coverage, without a live provider run. Existing transcript formats and readers remain compatible.

Evidence

What I checked:

  • Current main still needs the repair: At fetched main, collectCompletedAssistantMessages excludes unfinished assistant items from steering snapshots, and reconcileChatInputCustody unconditionally retires local submissions on custody or consumption receipts. (extensions/codex/src/app-server/event-projector-assistant.ts:364, 5449de6efa13)
  • Introduced production behavior: The pinned introduced delta records tool boundaries, retains dispatched steering display through the existing submission owner, and advances assistant cutoffs per committed mirror candidate. Reviewed against merge-base a1ce6fb, rather than endpoint drift. (extensions/codex/src/app-server/event-projector-steering.ts:65, f953e34d63f6)
  • Inspected visual evidence: Inspected all four downloaded screenshots. Before images place the Read activity below the steer; after images show Read activity and existing assistant text above the steer, both live and after refresh. The captured PR body explicitly identifies mocked Gateway fixtures and no live provider run. (6f0094d03ab4)
  • Re-review continuity: The only change since the earlier reviewed head replaces the concatenated-text locator with a continuation locator. The original prefix visibility, draft preservation, and exact Stop-target assertions remain. The previous completed review recorded no findings. (ui/src/e2e/chat-send-ack-ownership.e2e.test.ts:120, f953e34d63f6)
  • Existing-state compatibility: Segmentation uses the existing arbitrary mirror-identity and idempotency-key contracts, without schema changes or rewriting existing rows. The SQLite regression reads an already-committed prefix, retries it alongside a new segment, and verifies exactly one copy of each segment and the final continuation. (extensions/codex/src/app-server/transcript-mirror.test.ts:1359, f953e34d63f6)
  • Affirmative Codex dependency boundary: The changed native projector consumes item/agentMessage/delta and agentMessage completion events; the harness documentation assigns native execution to Codex and visible transcript mirroring to OpenClaw. This establishes the dependency-contract inspection requirement. (extensions/codex/src/app-server/event-projector-assistant.ts:87, f953e34d63f6)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Galin Iliev: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (1 earlier review cycle)
  • reviewed 2026-10-05T11:04:26.097Z sha 6f0094d :: needs maintainer review before merge. :: none

Keep failed-ACK ownership coverage aligned with the dispatched steer boundary. The existing prefix remains visible above the Retry row, while the continuation renders below it and Stop retains the original run target.
@steipete
steipete merged commit c108ae6 into main Oct 5, 2026
93 of 120 checks passed
@steipete

steipete commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

@steipete
steipete deleted the steipete/steer-always-bottom branch October 5, 2026 12:05
steipete added a commit that referenced this pull request Oct 5, 2026
c108ae6 (#165535) intentionally stopped retiming materialized stream
text because causal user intervals own placement and retiming reorders
live tools. The old synthetic timestamp expectation caused the two UI
reds in hourly 37312031958; the later injected-note fix is unrelated.

Keep the strict original timestamp and message/cleanup assertions, and
assert the actual rendered prompt/reply order under disagreeing clocks.
Share repeated rendering setup locally so every case and assertion fits
within the existing line cap. Production behavior is unchanged.

Validation: before/after in the failing file; all 85 cases in both runner
configurations; five Linux repetitions; full root UI (1,477 files) and UI
package (1,647 files) configs on Testbox. Types, formatting, normal and
boundary lint, and P2 passed. Check-changed's three production and eight
full-tree unused-export findings reproduced identically without the patch;
all other changed checks passed on Linux. No new skips or baseline changes.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 6, 2026
…isappear (openclaw#165535)

* fix(ui): keep steer messages below already-visible run output

Keep dispatched steers visible once until their canonical transcript copy
arrives, including queued custody, retries, history refreshes, and pane
remounts. Preserve the causal order of live tools and streamed text through
terminal reconciliation.

Persist native assistant prefixes before steering and save only subsequent
text afterward. Track committed segments per mirror candidate so changed
completion identities, repeated steering, and partial-write retries cannot
lose or duplicate the continuation. Reuse the existing transcript schema
and app submission owner.

Cover the queue-strip action, cached projection recovery, stream ordering,
and native transcript persistence with focused regressions.

* test(ui): expect continuation below failed steer

Keep failed-ACK ownership coverage aligned with the dispatched steer boundary. The existing prefix remains visible above the Retry row, while the continuation renders below it and Stop retains the original run target.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 6, 2026
c8d7c87 (openclaw#165535) intentionally stopped retiming materialized stream
text because causal user intervals own placement and retiming reorders
live tools. The old synthetic timestamp expectation caused the two UI
reds in hourly 37312031958; the later injected-note fix is unrelated.

Keep the strict original timestamp and message/cleanup assertions, and
assert the actual rendered prompt/reply order under disagreeing clocks.
Share repeated rendering setup locally so every case and assertion fits
within the existing line cap. Production behavior is unchanged.

Validation: before/after in the failing file; all 85 cases in both runner
configurations; five Linux repetitions; full root UI (1,477 files) and UI
package (1,647 files) configs on Testbox. Types, formatting, normal and
boundary lint, and P2 passed. Check-changed's three production and eight
full-tree unused-export findings reproduced identically without the patch;
all other changed checks passed on Linux. No new skips or baseline changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation extensions: codex P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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