Skip to content

fix(ui): require exact active run ownership - #126116

Merged
steipete merged 1 commit into
mainfrom
steipete/failure-cause-489d91
Aug 19, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/failure-cause-489d91

Conversation

@steipete

@steipete steipete commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Related: #125983

What Problem This Solves

Fixes an issue where Control UI consumers could treat the first server-reported active run ID as the owner of aggregate session activity. With overlapping or externally started runs, that arbitrary choice could expose a stale observer headline or Inspect run link and project transcript state under the wrong run identity.

Why This Change Was Made

The Gateway remains the owner of exact active-run facts: hasActiveRun is aggregate direct-session activity, while a present activeRunIds contains known exact identities. Omission provides no identity information; on incremental merge events, a present empty array replaces and clears the cached list.

Consumers now require an identity they actually own. Observer headlines and inspector links require exact observerDigest.runId membership, and transcript projection receives null when the pane has no explicit/local run. The patch intentionally retains activeRunIds; it does not reopen sessions.steer, remove protocol fields, or change selected-session send semantics. Main already delegates selected-session input to the runtime's ordered start-or-steer owner.

This follows the maintainer decision that closed #125983: keep Gateway-owned exact facts and remove arbitrary first-run selection. The broader producer-normalization work in #126106 is independent; this PR does not redefine field presence as completeness.

User Impact

Activity and chat surfaces no longer attach stale or unrelated run-owned UI to a session merely because that run ID happened to sort first. Exact matching observers remain visible, aggregate running indicators remain intact, reconnecting outbox-owned transcript projection remains intact, and selected-session steering still works without browser-selected run targeting.

Evidence

Judged diff: production UI +10/-19 (net -9), tests +90/-10, docs +19/-8.

Post-rebase validation on 54ebb307cdfc28f8c232162179b9734b19662dbd:

  • node scripts/run-vitest.mjs ui/src/lib/observer-digest.test.ts ui/src/pages/activity/session-activity-view.test.ts ui/src/pages/chat/chat-projection-run-id.test.ts — 3 files, 10 tests passed.
  • node scripts/check-changed.mjs -- docs/gateway/clients.md docs/gateway/protocol.md ui/src/lib/observer-digest.ts ui/src/lib/observer-digest.test.ts ui/src/pages/activity/session-activity-view.ts ui/src/pages/activity/session-activity-view.test.ts ui/src/pages/chat/components/chat-transcript-projection.ts ui/src/pages/chat/chat-projection-run-id.test.ts — passed, including formatting, ratchets, dead-export scans, UI i18n, TypeScript, and lint lanes.
  • pnpm ui:build — passed; 2,957 modules transformed and 908 finalized sidecars verified.
  • pnpm check:docs — passed; formatting, markdownlint, MDX, glossary, 6,542 internal links with 0 broken, and 1,180 config fences validated.
  • git diff --check — passed.
  • Global Codex autoreview, --mode uncommitted, default P0 scope — clean; no accepted/actionable findings, patch correct at 0.99 confidence.

Source-blind behavior validation passed Activity ownership and selected-session steering. The transcript-internal clause is black-box blocked because it has no honest UI-visible observation without instrumentation; the focused behavior regression and source-aware autoreview cover it, and it is not claimed as live proof.

Live selected-session proof used an isolated Gateway. An idle real turn completed, then a second chat.send reached the same visibly active selected session with queueMode=steer, no expectedRunId, and no expectedLeafEntryId; the final visible reply included UI3_STEER_OK, and the legacy uniqueness error was absent. An unrelated duplicate steered assistant-output observation is tracked separately and excluded from this patch.

Direct Codex OSS contract inspection at 86b1123ff6b5d089a146be4e603a324cf454223a:

  • codex-rs/core/src/session/session.rs:58 and :1311 — the session owns active_turn and initializes it once.
  • codex-rs/core/src/codex_thread.rs:278-289 and :370-383 — start_or_steer_turn submits through the ordered turn-input path.
  • codex-rs/core/src/session/turn_input.rs:141-155, :167-245, and :478-565 — Core alone decides start versus steer while checking the active turn and returns the exact accepted turn ID.
  • codex-rs/protocol/src/turn_input.rs:115-159 and :180-207 — the protocol defines start-or-steer and its exact Started/Steered/NotSubmitted outcomes.

Visual proof

Before: the stale nonmember observer headline is shown.

Before: stale nonmember observer headline shown

After: the stale headline and Inspect run affordance are absent, while the matching active observer remains visible.

After: only exact observer ownership remains visible

Selected session while the real turn is active:

Selected session with Stop generating visible

The same selected session after steering, with UI3_STEER_OK visible:

Selected session after successful steering

Live steering recording:

selected-session-steering.webm

@clawsweeper

clawsweeper Bot commented Aug 19, 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 docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime size: S maintainer Maintainer-authored PR labels Aug 19, 2026
@steipete
steipete marked this pull request as ready for review August 19, 2026 01:36
@steipete

steipete commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor Author

Land-ready evidence for b8c7d68a7c742502e20f1fb58a6138f174d0a2b1.

Root cause and owner: hasActiveRun is aggregate session activity, but three Control UI consumers treated activeRunIds[0] as a locally owned run. The Gateway remains the owner of known exact IDs; the UI now attaches run-scoped presentation only to a local/request/history/event identity or exact observer membership. The observer, Activity, and transcript first-entry fallbacks are removed. Production UI is +10/-19 (net -9), tests +90/-10, docs +19/-8.

Best-fix verdict: this is the narrow canonical consumer cleanup. Removing activeRunIds was rejected in #125983 because it loses exact Gateway facts; redefining producer completeness in #126106 is independent broader work; reopening sessions.steer would duplicate the runtime's ordered start-or-steer owner.

Proof:

  • Focused UI: 3 files, 10 tests passed.
  • Eight-file check-changed: passed.
  • pnpm ui:build: passed (2,957 modules; 908 sidecars).
  • pnpm check:docs: passed (6,542 internal links, 0 broken; 1,180 config fences validated).
  • git diff --check: passed.
  • Global Codex autoreview (--mode uncommitted, high, default P0): clean, no accepted/actionable findings.
  • Exact-head pull-request CI: run 32205555238, openclaw/ci-gate success.
  • Source-blind proof: Activity ownership passed; selected-session steering passed with the same active selected session, queueMode=steer, no expected run/leaf targeting, and visible UI3_STEER_OK.

Known proof gap: transcript cache-key ownership is not honestly observable black-box without instrumentation. It is covered by the focused regression and source-aware autoreview and is not claimed as live proof.

ClawSweeper: the exact-head review published with no actionable findings, 4/6 patch quality, and sufficient video-backed proof. Its only before-merge item was exact-head CI plus a clean current-main merge result; CI run 32205555238 is green and the native Testbox-backed prepare gate completed successfully against current main. There is no Rank-up moves section, and no post-review behavior push requires re-review. The unrelated duplicate steered assistant-output observation remains separately tracked and excluded.

@clawsweeper

clawsweeper Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 18, 2026, 9:43 PM ET / August 19, 2026, 01:43 UTC.

ClawSweeper review

What this changes

The PR stops Control UI from selecting an arbitrary active run and instead renders run-specific activity and transcript state only for a locally owned or exactly matched run ID.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

No blocking patch defect found. This focused UI fix remains open because it carries the protected maintainer label and exact-head CI is still in progress.

Priority: P1
Reviewed head: b8c7d68a7c742502e20f1fb58a6138f174d0a2b1

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Focused implementation, targeted regressions, and real-flow evidence support normal maintainer landing once CI completes.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (recording): The PR body provides before/after Control UI media and a recorded isolated-Gateway steering flow; reviewer artifact retrieval was unavailable but does not invalidate the supplied proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (recording): The PR body provides before/after Control UI media and a recorded isolated-Gateway steering flow; reviewer artifact retrieval was unavailable but does not invalidate the supplied proof.
Evidence reviewed 6 items UI ownership repair: The changed UI paths require exact membership for observer affordances and pass only an explicit run ID into transcript projection.
Gateway owner boundary: Gateway calculates aggregate activity independently of tracked exact IDs, so active work can exist with no known run identity for a consumer to adopt.
Safe reconnect sibling: The existing chat-pane caller obtains a projection ID from local state or a reconnecting outbox entry whose ID is present in the active set, preserving the named safe path.
Findings None None.
Security None None.

Live Verification

Command: pnpm openclaw gateway --help

Result: PASS (completed)

pnpm openclaw gateway --help
runner@runnervm76f27:/tmp/clawsweeper-live-proof-126116-JEHld2/target$ pnpm openclaw gateway --help
$ node scripts/run-node.mjs gateway --help
pnpm openclaw gateway --help
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 400.66 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 98.12 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.7s
node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2343:31 ]
      │
 2343 │           ASM_CONSTS[start] = eval(func);
      │                               ──┬─
      │                                 ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

[tsdown-build] invocation 2/2 finished in 14.2s
[plugin-control-plane-loads] verified 36 built modules with native require and checked doctor closures
runtime-postbuild: 10 phases completed in 4187ms (slowest: built plugin control-plane loads 3450ms)
│
◇

OpenClaw 2026.8.1 (b8c7d68) — All your chats, one OpenClaw.

Usage: openclaw gateway [options] [command]

Run, inspect, and query the WebSocket Gateway

Options:
  --allow-unconfigured      Allow gateway start without enforcing gateway.mode=local in config (does not repair config) (default: false)
  --ambient-channels        Allow the gateway to auto-configure channels from ambient environment variables (default: false)
  --auth ‹mode›             
… output truncated …

Assertions:

  • PASS expect_output: gateway

How this fits together

Gateway projects aggregate session activity plus any known exact run identities to Control UI. The UI uses those facts for activity headlines, inspector links, and transcript projection.

flowchart LR
A[Gateway session projection] --> B[Aggregate activity]
A --> C[Exact active run IDs]
D[Local or observer run ID] --> E[Exact ownership check]
B --> E
C --> E
E --> F[Activity headline and inspector]
E --> G[Transcript projection]
Loading

Before merge

  • Resolve merge risk (P1) - The branch is behind current main and exact-head CI is still running; refresh review only against GitHub’s clean three-way merge result rather than treating base drift as a source regression.
Agent review details

Security

None.

PR surface

Source -9, Tests +80, Docs +11. Total +82 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 3 10 19 -9
Tests 3 90 10 +80
Docs 2 19 8 +11
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 119 37 +82

Review metrics

Metric Value Why it matters
Production versus regression coverage production +10/-19 (net -9); tests +90/-10; docs +19/-8 The change deletes arbitrary run-selection paths and adds focused stale-identity coverage.

Stored data model

Persistent data-model change detected: serialized state: ui/src/pages/activity/session-activity-view.test.ts, serialized state: ui/src/pages/activity/session-activity-view.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land after exact-head CI completes, keeping the aggregate running indicator while allowing run-specific UI only for local or exact Gateway-owned identities.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land after exact-head CI completes, keeping the aggregate running indicator while allowing run-specific UI only for local or exact Gateway-owned identities.

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

Yes. The base implementation selected activeRunIds[0] in the affected UI paths; the new focused tests cover stale digests and multi-run projection without arbitrary adoption.

Is this the best way to solve the issue?

Yes. Requiring an exact owned identity is the narrowest fix and preserves aggregate activity plus the existing reconnecting-outbox recovery path.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P1: The patch corrects active-session UI state that could attribute activity, inspection, or transcript projection to the wrong run.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides before/after Control UI media and a recorded isolated-Gateway steering flow; reviewer artifact retrieval was unavailable but does not invalidate the supplied proof.
  • add proof: 🎥 video: Contributor real behavior proof includes video or recording evidence. The PR body provides before/after Control UI media and a recorded isolated-Gateway steering flow; reviewer artifact retrieval was unavailable but does not invalidate the supplied proof.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.

Label justifications:

  • P1: The patch corrects active-session UI state that could attribute activity, inspection, or transcript projection to the wrong run.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides before/after Control UI media and a recorded isolated-Gateway steering flow; reviewer artifact retrieval was unavailable but does not invalidate the supplied proof.
  • proof: 🎥 video: Contributor real behavior proof includes video or recording evidence. The PR body provides before/after Control UI media and a recorded isolated-Gateway steering flow; reviewer artifact retrieval was unavailable but does not invalidate the supplied proof.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: History for the observer-digest and related Control UI surfaces shows repeated prior work, including the observer HUD feature and this focused repair. (role: primary feature-history contributor; confidence: high; commits: b8c7d68a7c74, 1f0a3ecc68a0, aa35dc8c402e; files: ui/src/lib/observer-digest.ts, ui/src/pages/activity/session-activity-view.ts, ui/src/pages/chat/components/chat-transcript-projection.ts)
  • Patrick Erichsen: Recent history links this contributor to Gateway session-lifecycle work adjacent to the active-run projection contract. (role: recent adjacent contributor; confidence: medium; commits: a13251825afe; files: src/gateway/server-methods/session-active-runs.ts, src/gateway/session-event-payload.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.

@steipete
steipete merged commit 948a444 into main Aug 19, 2026
198 checks passed
@steipete
steipete deleted the steipete/failure-cause-489d91 branch August 19, 2026 01:55
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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 gateway Gateway runtime maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant