Skip to content

fix(ui): keep streamed replies ordered across steering - #125197

Merged
steipete merged 8 commits into
mainfrom
steipete/mid-stream-steering-order-bug-189a44
Aug 17, 2026
Merged

steipete merged 8 commits into
mainfrom
steipete/mid-stream-steering-order-bug-189a44

Conversation

@steipete

@steipete steipete commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where steering an active Control UI run could move already-visible assistant text below the steered user message, then continue streaming into the middle of the transcript. The ordering could change again when the terminal payload or authoritative history arrived, producing duplicated, missing, or misplaced reply fragments.

Why This Change Was Made

The Gateway's durable transcript order was already correct, but the Control UI stored stable transcript rows and cumulative live assistant text in separate projections without a durable causal boundary. This change records exact-run steering provenance when the user turn is consumed, carries that fact through transcript persistence, and gives live streams, tool boundaries, terminal tails, and history reconciliation one causal ordering model. Ordinary queued follow-ups are explicitly not treated as steering boundaries.

The provenance is owned by the final resolved injection backend rather than optional client request metadata. Durable provenance is added to the exact anchored user row only after transcript commitment is confirmed; unconfirmed acceptance never writes a boundary marker. The implementation is provider-neutral and matches the upstream steering contract: steering acceptance does not preempt the current sampling/tool continuation; the consumed user input becomes the boundary before the next model request.

To keep the Control UI startup budget green, persisted split-layout normalization was also separated from the interactive layout module so settings startup no longer pulls that command surface into the initial bundle.

AI-assisted; the complete code and behavior were independently reviewed and verified.

User Impact

When a user steers while an answer is streaming, everything produced before the steer stays above the user message and everything produced afterward stays below it. The order remains stable across delayed persistence, tools, terminal-only suffixes, multiple steers, reconnect/history reload, textless pre-steer states, later queued turns, leaf-only steering, and unconfirmed transcript commits.

Evidence

Pre-fix regression:

  • node scripts/run-vitest.mjs ui/src/pages/chat/chat-state.test.ts -t 'keeps cumulative assistant output split across an authoritative steer'
  • Failed before the repair with the steer rendered before the already-visible assistant prefix.

Exact head 84e85acb43cf:

  • Full steering producer and transcript suites: 341 tests passed.
  • Rebased chat thread/state conflict surfaces: 226 tests passed.
  • Post-rebase stream/tool reconciliation sweep: 255 tests passed.
  • Queued-user causal ordering sweep: 452 tests passed; both new regressions failed before the repair for the intended ordering reason.
  • Control UI browser E2E lane: all 7 tests passed, including live stream → persisted queued user → consumed steer → terminal history/reload.
  • Core and UI changed gates passed: formatting, typechecks, lint/max-lines, assertion ratchets, dead exports, plugin boundaries, database guards, import cycles, and i18n verification.
  • pnpm ui:build — startup JS gzip 338,387 B, 2,254 B below the current committed baseline plus tolerance; no budget increase.
  • Codex autoreview at P1: confirmation-owned provenance repair clean; post-rebase UI ownership cleanup clean.
  • Exact-head required CI: run 32031696002 completed green.

Earlier comprehensive branch proof:

  • Focused session/Gateway/UI regressions: 660 tests passed.
  • node scripts/run-vitest.mjs test/gateway-steer-fifo.e2e.test.ts -- -t 'finishes a running tool, skips its sequential tail, and injects an exact UI steer once' — 1 passed, 4 skipped; real isolated Gateway + mock provider.
  • OPENCLAW_CAPTURE_UI_PROOF=1 ... chat-flow.active-run-follow-ups.e2e.test.ts -t 'keeps cumulative assistant output ordered across a consumed steer' — 1 passed, 6 skipped.
  • pnpm build completed successfully.
  • The exact curated changed gate was green across core/UI typechecks, lint, dead exports, import cycles, i18n, schema, and repository guards. Remote Testbox/Daytona capacity was unavailable, so trusted-source fallback ran the same curated gate locally.

Sanitized after-state screenshot:

Steering order after repair

Browser recording of the repaired flow:

rebased-steering-order-proof.mp4

The original report screenshot is not attached because it contains private workspace/session identifiers. The failing pre-fix regression above is the sanitized before-proof.

Production LOC: +1746/-726 (net +1020) | Tests: +1403/-39 (net +1364) | Tooling baseline: +3/-3 (net 0).

The positive production delta is the new causal-boundary capability the old model could not represent: producer-owned confirmed-steer provenance plus one canonical stream reconciliation path across live, tool, terminal, projection, and history owners. The change also deletes the previous terminal index special case and consolidates cumulative-tail and segment-pruning logic.

@clawsweeper

clawsweeper Bot commented Aug 17, 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 size: XL labels Aug 17, 2026
@steipete
steipete marked this pull request as ready for review August 17, 2026 09:44
@openclaw-barnacle openclaw-barnacle Bot added the maintainer Maintainer-authored PR label Aug 17, 2026
@steipete
steipete force-pushed the steipete/mid-stream-steering-order-bug-189a44 branch from 0b1f9fe to bb8413a Compare August 17, 2026 09:46
@clawsweeper clawsweeper Bot added merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. proof: 🎥 video Contributor real behavior proof includes video or recording evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. labels Aug 17, 2026
@clawsweeper

clawsweeper Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 17, 2026, 7:25 AM ET / 11:25 UTC.

ClawSweeper review

What this changes

The PR records exact-run steering provenance in Gateway transcript rows and refactors Control UI stream reconciliation to keep streamed output ordered around a steered user turn.

Merge readiness

⚠️ Needs maintainer review before merge - 6 items remain

Keep open: the PR targets a real transcript-ordering defect, but the current head retains two P1 causal-boundary regressions that can misplace active-run output.

Priority: P1
Reviewed head: 528a4ed10a56a22df89bf37492b5b60967af9cc7

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Strong behavior evidence accompanies a substantial fix, but two P1 causal-ordering defects still block merge.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (recording): The PR body provides a sanitized after-state screenshot and browser recording alongside focused Gateway/UI regression evidence for the changed behavior.
Patch quality 🦐 gold shrimp (3/6) 2 actionable review findings remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (recording): The PR body provides a sanitized after-state screenshot and browser recording alongside focused Gateway/UI regression evidence for the changed behavior.
Evidence reviewed 6 items Unconfirmed-steer marker remains durable: The new unconfirmed-result branch requests marker clearing, but the recorder refuses all changes after either persistence path has completed; an aborted steer can therefore retain the UI ordering marker.
Runtime persistence can precede an unconfirmed receipt: The embedded runtime calls persistApproved for a user-message persistence event, while failed cancellation later returns transcriptCommit: unconfirmed; this is the ordering the current clear cannot repair.
Existing unconfirmed regression misses the race: The test returns an unconfirmed receipt without calling the recorder, so it only proves clearing before persistence rather than runtime persistence before the receipt.
Findings 2 actionable findings [P1] Clear persisted provenance after an unconfirmed steer
[P1] Preserve the pre-steer stream ceiling across queued user turns
Security None None.

How this fits together

Gateway accepts a user steer during an active run and persists the user turn; Control UI combines that durable transcript with live stream events. The same causal boundary must govern persistence, tool/terminal events, and rendered chat order.

flowchart LR
A[User steer] --> B[Gateway injection]
B --> C[Transcript persistence]
C --> D[Live stream events]
D --> E[Control UI reconciliation]
E --> F[Ordered chat transcript]
Loading

Before merge

  • Clear persisted provenance after an unconfirmed steer (P1) - When the embedded runtime persists the user turn before returning transcriptCommit: "unconfirmed", this setter is a no-op because the recorder has already persisted. Gateway then aborts the steer while its durable steerTargetRunId remains, so the UI treats an unconfirmed turn as a real ordering boundary. Cover the persisted-before-unconfirmed order and move cleanup to an owner that can uphold it.
  • Preserve the pre-steer stream ceiling across queued user turns (P1) - Late discovery: this boundary assignment was already present at the earlier reviewed head. If an ordinary queued user turn is persisted before a later steer, stamping the steer boundary on the existing active stream makes interval placement put that pre-steer text below the ordinary user. Preserve the existing ceiling or split at the queued user, and add the combined ordering regression.
  • Resolve merge risk (P1) - An unconfirmed steer can remain persisted as a real causal boundary and reorder a transcript even though Gateway aborts that steer.
  • Resolve merge risk (P1) - A later steer can move pre-steer output below an ordinary queued user turn.
  • Resolve merge risk (P1) - The session-sensitive fix has a net production increase of 857 lines while these two lifecycle paths remain incorrect.
  • Complete next step (P2) - This protected maintainer PR has two P1 repair requirements and needs an exact-head follow-up review after the owner resolves them.

Findings

  • [P1] Clear persisted provenance after an unconfirmed steer — src/auto-reply/reply/reply-run-registry.message-injection.ts:236-238
  • [P1] Preserve the pre-steer stream ceiling across queued user turns — ui/src/pages/chat/stream-causal-boundary.ts:419
Agent review details

Security

None.

PR surface

Source +857, Tests +1144, Other 0. Total +2001 across 45 files.

View PR surface stats
Area Files Added Removed Net
Source 31 1528 671 +857
Tests 13 1181 37 +1144
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 3 3 0
Total 45 2712 711 +2001

Review metrics

Metric Value Why it matters
Production versus test delta production +1528/-671 (net +857); tests +1181/-37 (net +1144); tooling +3/-3 The large production increase is only justified if the resulting causal-boundary model correctly covers persistence and queued-turn ordering.

Stored data model

Persistent data-model change detected: serialized state: src/sessions/user-turn-transcript.metadata.ts, serialized state: src/sessions/user-turn-transcript.persistence.test.ts, serialized state: src/sessions/user-turn-transcript.ts, serialized state: src/sessions/user-turn-transcript.types.ts, serialized state: ui/src/pages/chat/chat-gateway.test.ts, serialized state: ui/src/pages/chat/history-merge.ts, and 7 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Repair both causal-boundary paths (recommended)
    Clear or neutralize persisted provenance after an unconfirmed receipt and retain pre-steer output above any prior ordinary queued user, with focused regressions for both orders.

Technical review

Best possible solution:

Make provenance lifecycle and UI interval ownership canonical: remove or neutralize already-persisted provenance on unconfirmed acceptance, and preserve the active run’s prior ceiling across ordinary queued users before applying a later steer.

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

Yes at source level: the runtime-persisted-before-unconfirmed path and active-stream → ordinary queued user → steer sequence are both concrete, but this read-only review did not execute them.

Is this the best way to solve the issue?

No. Durable provenance is the right owner boundary, but the patch must also handle post-persistence unconfirmation and retain the earlier queued-user ceiling.

Full review comments:

  • [P1] Clear persisted provenance after an unconfirmed steer — src/auto-reply/reply/reply-run-registry.message-injection.ts:236-238
    When the embedded runtime persists the user turn before returning transcriptCommit: "unconfirmed", this setter is a no-op because the recorder has already persisted. Gateway then aborts the steer while its durable steerTargetRunId remains, so the UI treats an unconfirmed turn as a real ordering boundary. Cover the persisted-before-unconfirmed order and move cleanup to an owner that can uphold it.
    Confidence: 0.98
  • [P1] Preserve the pre-steer stream ceiling across queued user turns — ui/src/pages/chat/stream-causal-boundary.ts:419
    Late discovery: this boundary assignment was already present at the earlier reviewed head. If an ordinary queued user turn is persisted before a later steer, stamping the steer boundary on the existing active stream makes interval placement put that pre-steer text below the ordinary user. Preserve the existing ceiling or split at the queued user, and add the combined ordering regression.
    Confidence: 0.96
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 5b14551c7c88.

Labels

Label justifications:

  • P1: The current patch can visibly misorder active chat transcripts during common steering and queued-follow-up sequences.
  • merge-risk: 🚨 session-state: The PR changes persisted user-turn provenance and live-to-durable stream reconciliation, where an incorrect marker alters transcript state.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (recording): The PR body provides a sanitized after-state screenshot and browser recording alongside focused Gateway/UI regression evidence for the changed behavior.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides a sanitized after-state screenshot and browser recording alongside focused Gateway/UI regression evidence for the changed behavior.
  • proof: 🎥 video: Contributor real behavior proof includes video or recording evidence. The PR body provides a sanitized after-state screenshot and browser recording alongside focused Gateway/UI regression evidence for the changed behavior.

Evidence

What I checked:

Likely related people:

  • steipete: Authored the current head and prior merged user-transcript/session repairs in the affected ownership area. (role: recent session and steering contributor; confidence: high; commits: 528a4ed10a56, dfbc95e4ea2b, 39bbd8afd338; files: src/sessions/user-turn-transcript.ts, src/auto-reply/reply/reply-run-registry.message-injection.ts, ui/src/pages/chat/stream-reconciliation.ts)
  • WhatsSkiLL: Blame attributes the pre-existing active-turn injection boundary surrounding this change to their current-main commit; broader history is sparse. (role: adjacent injection-path contributor; confidence: low; commits: 657b6e8f49a7; files: src/auto-reply/reply/reply-run-registry.message-injection.ts)

Rank-up moves

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

  • Repair the persisted-before-unconfirmed provenance lifecycle and add its regression.
  • Add coverage for an active stream followed by an ordinary queued user and then a steer.

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-17T09:57:27.774Z sha bb8413a :: needs changes before merge. :: [P1] Record the resolved target run for leaf-only steering | [P1] Clear steering provenance for an unconfirmed acceptance
  • reviewed 2026-08-17T10:13:52.263Z sha 8ebdc8e4afceb4feea100508da4ff2e8ee107750 :: found issues before merge. :: [P1] Record the resolved target run for leaf-only steering | [P1] Clear provenance when the transcript commit is unconfirmed
  • reviewed 2026-08-17T10:45:30.883Z sha 34435564a5f508d1402b7763d9d9c657f1b75be9 :: found issues before merge. :: [P1] Record the resolved run for leaf-only steering | [P1] Clear provenance for an unconfirmed transcript commit
  • reviewed 2026-08-17T11:18:10.142Z sha 528a4ed10a56a22df89bf37492b5b60967af9cc7 :: found issues before merge. :: [P1] Clear persisted provenance after an unconfirmed steer

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. proof: 🎥 video Contributor real behavior proof includes video or recording evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. proof: 🎥 video Contributor real behavior proof includes video or recording evidence. labels Aug 17, 2026
@steipete
steipete force-pushed the steipete/mid-stream-steering-order-bug-189a44 branch from 3443556 to 528a4ed Compare August 17, 2026 11:10
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. proof: 🎥 video Contributor real behavior proof includes video or recording evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. proof: 🎥 video Contributor real behavior proof includes video or recording evidence. labels Aug 17, 2026
@wintermute-texture

Copy link
Copy Markdown

Nudge: This PR has been awaiting review for over 3 hours.

@steipete
steipete force-pushed the steipete/mid-stream-steering-order-bug-189a44 branch 2 times, most recently from 79d0b17 to a120686 Compare August 17, 2026 12:24
@steipete

steipete commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor Author

Land-ready evidence for exact head 84e85acb43cf26ecb827c72d5d2c2a9572f7c569.

Latest ClawSweeper findings and rank-up moves are addressed:

  • Leaf-only steering now derives provenance from the final resolved backend run, not optional request metadata.
  • Steering provenance is confirmation-owned. The exact anchored user row is marked only after transcript commitment is proven; rejected and unconfirmed outcomes never write a durable boundary.
  • The unconfirmed regression persists the recorder first, then resolves transcriptCommit: "unconfirmed", and verifies the durable row remains marker-free.
  • Confirmed exact-run and leaf-only regressions verify commit-then-confirm behavior: the initial user update is unmarked, the anchored row is rewritten, and the authoritative session.message update carries steerTargetRunId.
  • An ordinary persisted queued user is now a hard ceiling for the still-live active-run stream. A later steer preserves that existing ceiling, then emits its own boundary marker for post-steer output.
  • The combined live stream → persisted queued user → consumed steer regression failed before the repair with pre-steer text below the queued user, and now passes through terminal history and browser reload.
  • Direct upstream Codex inspection confirmed steering acknowledgement is admission rather than transcript commitment; OpenClaw waits for the correlated completed user item before confirming provenance.
  • The rebase max-lines conflict was resolved by moving live tool filtering into the existing tool-stream identity owner, with no suppression and a net-negative follow-up diff.

Validation:

  • Full steering producer/transcript suites: 341 passed.
  • Rebased chat thread/state suites: 226 passed.
  • Stream/tool reconciliation sweep: 255 passed.
  • Queued-user causal ordering sweep: 452 passed.
  • Control UI browser E2E: 7 passed, including the combined queued-user/steer flow.
  • Real isolated Gateway + mock-provider steer FIFO E2E: passed.
  • Core/UI changed gates: green, including typechecks, lint/max-lines, assertion ratchets, dead exports, import cycles, i18n, and database guards.
  • pnpm build: passed.
  • pnpm ui:build: startup JS gzip 338,387 B, below the committed budget without a baseline increase.
  • Fresh P1 autoreviews: confirmation lifecycle clean; post-rebase UI ownership cleanup clean.
  • Required exact-head CI: run 32031696002 green.

The sanitized screenshot and browser recording remain in the PR body. The original report screenshot is intentionally not attached because it contains private workspace/session identifiers. The real-profile browser relay was unavailable, so the browser proof uses the repository's isolated deterministic Control UI/Gateway flow; the real Gateway boundary is additionally covered by the steer FIFO E2E.

Record exact steering provenance and keep cumulative assistant output on its causal side of persisted user turns across live streaming, terminal events, tool boundaries, and history reloads.
Tighten the inherited environment-variable budget and remove a stale test import exposed by the rebased lint gate.
Assert the causal stream rollover when a steer lands and move persisted split-layout normalization off the startup path to keep the Control UI bundle within budget.
Keep the persisted split-layout normalizer off the interactive module cycle while preserving the Control UI startup bundle reduction.
@steipete
steipete force-pushed the steipete/mid-stream-steering-order-bug-189a44 branch from a120686 to 84e85ac Compare August 17, 2026 12:48
@steipete
steipete merged commit 08622cd into main Aug 17, 2026
230 checks passed
@steipete
steipete deleted the steipete/mid-stream-steering-order-bug-189a44 branch August 17, 2026 13:00
@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 18, 2026
* fix(ui): preserve steering stream order

Record exact steering provenance and keep cumulative assistant output on its causal side of persisted user turns across live streaming, terminal events, tool boundaries, and history reloads.

* chore(ci): refresh post-rebase gates

Tighten the inherited environment-variable budget and remove a stale test import exposed by the rebased lint gate.

* fix(ui): preserve terminal steer stream segment

Assert the causal stream rollover when a steer lands and move persisted split-layout normalization off the startup path to keep the Control UI bundle within budget.

* refactor(ui): extract split layout types

Keep the persisted split-layout normalizer off the interactive module cycle while preserving the Control UI startup bundle reduction.

* fix(gateway): resolve steering provenance at injection

* fix(gateway): confirm steering provenance after persistence

* refactor(ui): move live tool filtering to identity owner

* fix(ui): preserve queued user stream ceiling
steipete added a commit that referenced this pull request Oct 15, 2026
Continue the y01 largest-owner, export/caller and duplicate-helper audit.
Delegate composer mounting to the canonical interop boundary while retaining
field equality, keyed renderer identity and foreground picker cleanup. Remove
test-only panel refresh methods and commit counters; exercise the actual view,
polling and committed DOM instead. Trust admitted immutable composer metadata
and the full tool-stream owner contract. Narrow sidebar traversal to its
normalized single column and simplify browser/Gateway realtime decoding.

Both shipping Lit/Solid paths and rendered markup remain unchanged. No config,
protocol, storage, dependency, security-boundary or Phase E backend changes.

Best-effort tradeoffs accepted

- Malformed internal tool-stream hosts: #158032 introduced shape probes during
  a bookkeeping refactor, not a human incident. Real owners have complete state;
  a broken internal caller now fails rather than silently skipping cleanup.
  #125197's human steering/order report still justifies the unchanged causal
  reconciliation algorithm; no report ties malformed-host probes to that bug.
- In-place mutation of admitted draft metadata: #158335 added reply persistence
  and #166682 moved the annotation copies, without a mutation incident. Actual
  editors replace records/arrays. A future in-place mutator must follow that
  contract or it may alter a pending snapshot. Durable receipts/revisions stay.
- Non-JSON relay events: #146676 added transport machinery without a human
  cyclic-frame incident. Frames already crossed JSON decoding; an impossible
  internal cycle or BigInt now throws. Activation count/byte bounds remain.
- Older Gateway close-disposition support: #171377 added a compatibility path,
  but UI/Gateway ship together and the current server advertises the field.
  Unsupported skew now rejects. Accepted-answer durability from the real human
  report #171310 and fixes #171377/#172159 remains intact.
- Blob/typed-array/arbitrary Google message representations: c399fb7
  added these alternate decoder branches without a linked human report. The
  browser WebSocket is configured as arraybuffer before listeners. Unsupported
  synthetic representations are ignored; actual strings/ArrayBuffers still
  decode, and removal of the artificial await needs no post-await stale check.
- Extra sidebar columns after normalization: #123874 flattened the flexible
  #113712 layout to one tabbed panel. A broken internal producer is no longer
  searched as a multi-column layout; persisted legacy flattening still runs.

The earlier commit records the original eight accepted best-effort scenarios.
Coverage and remaining justified owners are logged in .local/y01-ledger.md for
coordinator bundling. Combined candidate removes 416 net production lines
against 5716bb1 (tests/support excluded).
steipete added a commit that referenced this pull request Oct 15, 2026
Continue the y01 largest-owner, export/caller and duplicate-helper audit.
Delegate composer mounting to the canonical interop boundary while retaining
field equality, keyed renderer identity and foreground picker cleanup. Remove
test-only panel refresh methods and commit counters; exercise the actual view,
polling and committed DOM instead. Trust admitted immutable composer metadata
and the full tool-stream owner contract. Narrow sidebar traversal to its
normalized single column and simplify browser/Gateway realtime decoding.

Both shipping Lit/Solid paths and rendered markup remain unchanged. No config,
protocol, storage, dependency, security-boundary or Phase E backend changes.

Best-effort tradeoffs accepted

- Malformed internal tool-stream hosts: #158032 introduced shape probes during
  a bookkeeping refactor, not a human incident. Real owners have complete state;
  a broken internal caller now fails rather than silently skipping cleanup.
  #125197's human steering/order report still justifies the unchanged causal
  reconciliation algorithm; no report ties malformed-host probes to that bug.
- In-place mutation of admitted draft metadata: #158335 added reply persistence
  and #166682 moved the annotation copies, without a mutation incident. Actual
  editors replace records/arrays. A future in-place mutator must follow that
  contract or it may alter a pending snapshot. Durable receipts/revisions stay.
- Non-JSON relay events: #146676 added transport machinery without a human
  cyclic-frame incident. Frames already crossed JSON decoding; an impossible
  internal cycle or BigInt now throws. Activation count/byte bounds remain.
- Older Gateway close-disposition support: #171377 added a compatibility path,
  but UI/Gateway ship together and the current server advertises the field.
  Unsupported skew now rejects. Accepted-answer durability from the real human
  report #171310 and fixes #171377/#172159 remains intact.
- Blob/typed-array/arbitrary Google message representations: c399fb7
  added these alternate decoder branches without a linked human report. The
  browser WebSocket is configured as arraybuffer before listeners. Unsupported
  synthetic representations are ignored; actual strings/ArrayBuffers still
  decode, and removal of the artificial await needs no post-await stale check.
- Extra sidebar columns after normalization: #123874 flattened the flexible
  #113712 layout to one tabbed panel. A broken internal producer is no longer
  searched as a multi-column layout; persisted legacy flattening still runs.

The earlier commit records the original eight accepted best-effort scenarios.
Coverage and remaining justified owners are logged in .local/y01-ledger.md for
coordinator bundling. Combined candidate removes 416 net production lines
against 5716bb1 (tests/support excluded).
steipete added a commit that referenced this pull request Oct 15, 2026
* refactor(ui): consolidate chat owners and remove obsolete adapters

Keep both live rendering routes and the existing DOM, text, persisted shapes,
security boundaries, draft durability, and ordinary session concurrency.
Consolidate effective-tool loading, header registration, transcript refs,
history target capture, and PCM output ownership. Remove unused adapters
after their completed native-control cutovers and redundant internal work.

Best-effort tradeoffs accepted:
- Pending-page/live-update overlap: #145240 records synthetic request-order
  proof, not a cited human incident. Displayed disposition can briefly lag
  until the next ordinary refresh; durable receipts remain authoritative.
- Synchronous rail self-retirement: #153245 records a synthetic benchmark,
  not a cited human incident. Focus restoration is best effort in that case.
- Obsolete intersection callbacks: #142227 records synthetic E2E proof, not
  a cited stale-delivery incident. Target maps ignore retired rows; a late
  callback can request redundant layout.
- Obsolete mutation callbacks: the same #142227 provenance. Native disconnect
  remains; a late delivery can resample the current scroller.
- Obsolete resize callbacks: #162617 records synthetic performance traces,
  not a cited stale-delivery incident. Native cleanup remains; a late callback
  can sample current layout.
- Wrong bundled Gateway PR identity: #148070/#147952 describe the feature,
  not a wrong-target incident. The producer constructs the exact requested
  target; a contract violation now displays its returned result.
- Cross-tab prefetch election: #125128 covered a retired five-session idle
  sweep with synthetic performance proof. Two tabs can now redundantly read
  one explicitly hover/focus-intended target; per-tab limits remain.
- Malformed internal sidebar maps: #113712 introduced feature normalization,
  not a cited incident. Settings validates load/save and all callers use that
  output; impossible malformed typed values are not repaired at every update.

* refactor(ui): consolidate chat lifecycle and internal state paths

Continue the y01 largest-owner, export/caller and duplicate-helper audit.
Delegate composer mounting to the canonical interop boundary while retaining
field equality, keyed renderer identity and foreground picker cleanup. Remove
test-only panel refresh methods and commit counters; exercise the actual view,
polling and committed DOM instead. Trust admitted immutable composer metadata
and the full tool-stream owner contract. Narrow sidebar traversal to its
normalized single column and simplify browser/Gateway realtime decoding.

Both shipping Lit/Solid paths and rendered markup remain unchanged. No config,
protocol, storage, dependency, security-boundary or Phase E backend changes.

Best-effort tradeoffs accepted

- Malformed internal tool-stream hosts: #158032 introduced shape probes during
  a bookkeeping refactor, not a human incident. Real owners have complete state;
  a broken internal caller now fails rather than silently skipping cleanup.
  #125197's human steering/order report still justifies the unchanged causal
  reconciliation algorithm; no report ties malformed-host probes to that bug.
- In-place mutation of admitted draft metadata: #158335 added reply persistence
  and #166682 moved the annotation copies, without a mutation incident. Actual
  editors replace records/arrays. A future in-place mutator must follow that
  contract or it may alter a pending snapshot. Durable receipts/revisions stay.
- Non-JSON relay events: #146676 added transport machinery without a human
  cyclic-frame incident. Frames already crossed JSON decoding; an impossible
  internal cycle or BigInt now throws. Activation count/byte bounds remain.
- Older Gateway close-disposition support: #171377 added a compatibility path,
  but UI/Gateway ship together and the current server advertises the field.
  Unsupported skew now rejects. Accepted-answer durability from the real human
  report #171310 and fixes #171377/#172159 remains intact.
- Blob/typed-array/arbitrary Google message representations: c399fb7
  added these alternate decoder branches without a linked human report. The
  browser WebSocket is configured as arraybuffer before listeners. Unsupported
  synthetic representations are ignored; actual strings/ArrayBuffers still
  decode, and removal of the artificial await needs no post-await stale check.
- Extra sidebar columns after normalization: #123874 flattened the flexible
  #113712 layout to one tabbed panel. A broken internal producer is no longer
  searched as a multi-column layout; persisted legacy flattening still runs.

The earlier commit records the original eight accepted best-effort scenarios.
Coverage and remaining justified owners are logged in .local/y01-ledger.md for
coordinator bundling. Combined candidate removes 416 net production lines
against 5716bb1 (tests/support excluded).

* test(ui): align talk fixtures with transport contracts

Require detach disposition when append rejection closes the relay. The UI and
Gateway ship together; the prior fallback's omitted field is no longer valid.

Close the Google socket before start settles when testing startup rejection.
Synchronous frame decoding removed the fixture's former artificial decode
microtask; waiting one turn now settles start before the close. Preserve all
error, callback, microphone, socket and timer assertions.

No production change or new best-effort tradeoff. The preceding commit records
the accepted transport assumptions and their provenance.

* refactor(agents): consolidate runner lifecycle plumbing

Share lifecycle hook capture, native policy loops and gated diagnostic content
construction. Combine initial session metadata updates through the existing
writer and reuse the persisted-input notifier. Keep delivery evidence in a
typed WeakMap without mutating or wrapping frozen error objects.

Security checks, public contracts, transcript durability, parallel tool
correlation and ordinary shutdown settlement remain. No schema, configuration,
dependency, protocol or public SDK signature changes. The standalone session
memory backend and its lifecycle machinery are untouched.

Best-effort tradeoffs accepted:
- Reusing the same engine during active disposal no longer has a WeakRef
  tombstone rejection. #168789 cites synthetic #143426/#143592 disposal cases,
  not a human production report. Misuse may fail in the engine normally;
  closing admission and actual resource settlement remain.
- Fresh bounded primitive diagnostics are not redundantly cloned before
  publication (#108304). Listener egress still isolates its payloads.
- Internal delivery-evidence readers receive the attachment-time snapshot,
  not another defensive copy (0ea0807). No human mutation report was found;
  unsupported internal mutation could affect a later reader. Confirmed-send
  suppression and attachment-time copying remain.

Lane y08: 105 net production lines removed (165 added / 270 removed), excluding
tests; tests add 67 net lines. Below-500 branch-only handoff for coordinator
bundling after recent, older and largest-owner audits found no further sound
candidate. No PR or hosted-CI success is claimed.

Proof: production and affected test types, changed-file lint/format, runtime
and madge cycles (zero), lint-suppressions (3/3), and independent P2 review
passed. Maintenance resources (6/6), CLI spawn (40/40), and restart recovery
(33/33) completed. Support proof was stopped after ten minutes without an
assertion result; Gateway cancellation timed out during startup/imports with
no assertion result, and deletion was not reached. CLI reliability was only
partially exercised in an earlier interrupted selection. These are unresolved
proof gaps, not attributed main failures.

* refactor(agents): remove duplicate runner preparation work

Trust canonical inline model modalities and waiter-owned cleanup. Fold the
sole-caller HTTP setup wrapper and stage warning predicate into their owners,
and remove an unused diagnostic clock option.

This pass removes 32 net production lines; the branch total is 137. Core and
affected test types, lint, format, cycle checks, stage timing and suppression
tests pass. Independent P2 review is clean. Wider focused runtime selections
remain incomplete under host load; coordinator bundling needs broad CI proof.

* refactor: withdraw inconclusive stream cleanup and repair bundle ratchets

Retain current main stream-state contracts after the UI failure replay could not establish an exact-main comparison. Shrink the delivery-evidence assertion allowance and keep its frozen/primitive regression intact in a focused unit file.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 16, 2026
…w#173015)

* refactor(ui): consolidate chat owners and remove obsolete adapters

Keep both live rendering routes and the existing DOM, text, persisted shapes,
security boundaries, draft durability, and ordinary session concurrency.
Consolidate effective-tool loading, header registration, transcript refs,
history target capture, and PCM output ownership. Remove unused adapters
after their completed native-control cutovers and redundant internal work.

Best-effort tradeoffs accepted:
- Pending-page/live-update overlap: openclaw#145240 records synthetic request-order
  proof, not a cited human incident. Displayed disposition can briefly lag
  until the next ordinary refresh; durable receipts remain authoritative.
- Synchronous rail self-retirement: openclaw#153245 records a synthetic benchmark,
  not a cited human incident. Focus restoration is best effort in that case.
- Obsolete intersection callbacks: openclaw#142227 records synthetic E2E proof, not
  a cited stale-delivery incident. Target maps ignore retired rows; a late
  callback can request redundant layout.
- Obsolete mutation callbacks: the same openclaw#142227 provenance. Native disconnect
  remains; a late delivery can resample the current scroller.
- Obsolete resize callbacks: openclaw#162617 records synthetic performance traces,
  not a cited stale-delivery incident. Native cleanup remains; a late callback
  can sample current layout.
- Wrong bundled Gateway PR identity: openclaw#148070/openclaw#147952 describe the feature,
  not a wrong-target incident. The producer constructs the exact requested
  target; a contract violation now displays its returned result.
- Cross-tab prefetch election: openclaw#125128 covered a retired five-session idle
  sweep with synthetic performance proof. Two tabs can now redundantly read
  one explicitly hover/focus-intended target; per-tab limits remain.
- Malformed internal sidebar maps: openclaw#113712 introduced feature normalization,
  not a cited incident. Settings validates load/save and all callers use that
  output; impossible malformed typed values are not repaired at every update.

* refactor(ui): consolidate chat lifecycle and internal state paths

Continue the y01 largest-owner, export/caller and duplicate-helper audit.
Delegate composer mounting to the canonical interop boundary while retaining
field equality, keyed renderer identity and foreground picker cleanup. Remove
test-only panel refresh methods and commit counters; exercise the actual view,
polling and committed DOM instead. Trust admitted immutable composer metadata
and the full tool-stream owner contract. Narrow sidebar traversal to its
normalized single column and simplify browser/Gateway realtime decoding.

Both shipping Lit/Solid paths and rendered markup remain unchanged. No config,
protocol, storage, dependency, security-boundary or Phase E backend changes.

Best-effort tradeoffs accepted

- Malformed internal tool-stream hosts: openclaw#158032 introduced shape probes during
  a bookkeeping refactor, not a human incident. Real owners have complete state;
  a broken internal caller now fails rather than silently skipping cleanup.
  openclaw#125197's human steering/order report still justifies the unchanged causal
  reconciliation algorithm; no report ties malformed-host probes to that bug.
- In-place mutation of admitted draft metadata: openclaw#158335 added reply persistence
  and openclaw#166682 moved the annotation copies, without a mutation incident. Actual
  editors replace records/arrays. A future in-place mutator must follow that
  contract or it may alter a pending snapshot. Durable receipts/revisions stay.
- Non-JSON relay events: openclaw#146676 added transport machinery without a human
  cyclic-frame incident. Frames already crossed JSON decoding; an impossible
  internal cycle or BigInt now throws. Activation count/byte bounds remain.
- Older Gateway close-disposition support: openclaw#171377 added a compatibility path,
  but UI/Gateway ship together and the current server advertises the field.
  Unsupported skew now rejects. Accepted-answer durability from the real human
  report openclaw#171310 and fixes openclaw#171377/openclaw#172159 remains intact.
- Blob/typed-array/arbitrary Google message representations: 2a4c20f
  added these alternate decoder branches without a linked human report. The
  browser WebSocket is configured as arraybuffer before listeners. Unsupported
  synthetic representations are ignored; actual strings/ArrayBuffers still
  decode, and removal of the artificial await needs no post-await stale check.
- Extra sidebar columns after normalization: openclaw#123874 flattened the flexible
  openclaw#113712 layout to one tabbed panel. A broken internal producer is no longer
  searched as a multi-column layout; persisted legacy flattening still runs.

The earlier commit records the original eight accepted best-effort scenarios.
Coverage and remaining justified owners are logged in .local/y01-ledger.md for
coordinator bundling. Combined candidate removes 416 net production lines
against 7f7310a (tests/support excluded).

* test(ui): align talk fixtures with transport contracts

Require detach disposition when append rejection closes the relay. The UI and
Gateway ship together; the prior fallback's omitted field is no longer valid.

Close the Google socket before start settles when testing startup rejection.
Synchronous frame decoding removed the fixture's former artificial decode
microtask; waiting one turn now settles start before the close. Preserve all
error, callback, microphone, socket and timer assertions.

No production change or new best-effort tradeoff. The preceding commit records
the accepted transport assumptions and their provenance.

* refactor(agents): consolidate runner lifecycle plumbing

Share lifecycle hook capture, native policy loops and gated diagnostic content
construction. Combine initial session metadata updates through the existing
writer and reuse the persisted-input notifier. Keep delivery evidence in a
typed WeakMap without mutating or wrapping frozen error objects.

Security checks, public contracts, transcript durability, parallel tool
correlation and ordinary shutdown settlement remain. No schema, configuration,
dependency, protocol or public SDK signature changes. The standalone session
memory backend and its lifecycle machinery are untouched.

Best-effort tradeoffs accepted:
- Reusing the same engine during active disposal no longer has a WeakRef
  tombstone rejection. openclaw#168789 cites synthetic openclaw#143426/openclaw#143592 disposal cases,
  not a human production report. Misuse may fail in the engine normally;
  closing admission and actual resource settlement remain.
- Fresh bounded primitive diagnostics are not redundantly cloned before
  publication (openclaw#108304). Listener egress still isolates its payloads.
- Internal delivery-evidence readers receive the attachment-time snapshot,
  not another defensive copy (8c995fb). No human mutation report was found;
  unsupported internal mutation could affect a later reader. Confirmed-send
  suppression and attachment-time copying remain.

Lane y08: 105 net production lines removed (165 added / 270 removed), excluding
tests; tests add 67 net lines. Below-500 branch-only handoff for coordinator
bundling after recent, older and largest-owner audits found no further sound
candidate. No PR or hosted-CI success is claimed.

Proof: production and affected test types, changed-file lint/format, runtime
and madge cycles (zero), lint-suppressions (3/3), and independent P2 review
passed. Maintenance resources (6/6), CLI spawn (40/40), and restart recovery
(33/33) completed. Support proof was stopped after ten minutes without an
assertion result; Gateway cancellation timed out during startup/imports with
no assertion result, and deletion was not reached. CLI reliability was only
partially exercised in an earlier interrupted selection. These are unresolved
proof gaps, not attributed main failures.

* refactor(agents): remove duplicate runner preparation work

Trust canonical inline model modalities and waiter-owned cleanup. Fold the
sole-caller HTTP setup wrapper and stage warning predicate into their owners,
and remove an unused diagnostic clock option.

This pass removes 32 net production lines; the branch total is 137. Core and
affected test types, lint, format, cycle checks, stage timing and suppression
tests pass. Independent P2 review is clean. Wider focused runtime selections
remain incomplete under host load; coordinator bundling needs broad CI proof.

* refactor: withdraw inconclusive stream cleanup and repair bundle ratchets

Retain current main stream-state contracts after the UI failure replay could not establish an exact-main comparison. Shrink the delivery-evidence assertion allowance and keep its frozen/primitive regression intact in a focused unit file.
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 gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 🎥 video Contributor real behavior proof includes video or recording evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL 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.

2 participants