Skip to content

fix(ui): make active-run steering reliable - #120083

Merged
steipete merged 4 commits into
mainfrom
codex/fix-steer-delivery
Aug 7, 2026
Merged

steipete merged 4 commits into
mainfrom
codex/fix-steer-delivery

Conversation

@steipete

@steipete steipete commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where users steering an active Control UI run during tool work could briefly see “Steered,” then have the message downgraded to the opaque “Needs review” state even though they had explicitly asked to steer. In the observed live failure, one unique steer changed from Steered to Needs review in about 3 seconds, the queue grew from 1 to 2, and no matching transcript entry appeared after 28 seconds.

Why This Change Was Made

The Gateway treated token streaming as the proof that an active run could accept a message. Embedded runs remain steerable while tools execute even when token streaming is false, so admission could reject valid steering after the transcript leaf advanced. The shared reply-run owner now reports actual message-injection availability, preserving the existing originating-leaf fence and rejecting stopped, evidence-stale, or different-leaf owners. Admission and delivery use the same freshness-and-injectability predicate, so a stale owner cannot waive the leaf fence and then reject the same steer during injection.

The Control UI now distinguishes definitive Gateway rejection frames from ambiguous transport loss. Definitive rejections remain failed with the Gateway reason; transport loss remains parked as Delivery uncertain because admission may already have succeeded. Retrying either state preserves the durable steer kind, the original idempotency key, and steer queue mode, and refuses to turn the message into a normal chat turn when no active run exists.

The follow-up intentionally remains: Gateway exact-run terminal evidence for restored outbox reconciliation. The current shared API exposes active-run presence but not authoritative exact-run terminal evidence for every restored browser outbox.

User Impact

Users can steer throughout active tool work. Errors now say whether the Gateway actually rejected the steer or whether delivery is merely uncertain, and Retry preserves the original steering intent instead of accidentally replaying it as a normal turn.

Evidence

Focused proof on the final patch:

  • pnpm format on the changed files: passed
  • pnpm ui:i18n:verify: passed (raw-copy: baseline entries=98, source: keys=4690)
  • node scripts/run-vitest.mjs src/auto-reply/reply/reply-run-registry.test.ts: 52 passed
  • node scripts/run-vitest.mjs src/gateway/server-methods/chat.directive-tags.test.ts: 163 passed
  • node scripts/run-vitest.mjs ui/src/pages/chat/chat-send.test.ts: 269 passed
  • pnpm deadcode:unused-files: production and full-tree scans passed with 0 entries
  • .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main --stream-engine-output: clean, no accepted/actionable findings; overall correct at 0.97
  • git diff --check: passed
  • Exact-head hosted CI before the final stale-owner repair: 63 jobs passed, 0 failed; a new exact-head run is required after this repair.

The focused tests cover fresh non-streaming injectable tool work, evidence-stale owners at both registry and moved-leaf Gateway admission, stopped owners, different originating leaves, definitive Gateway rejection, active-run absence, preserved idempotency key and queue mode on retry, ambiguous transport parking, and no automatic normal-turn replay.

Codex contract evidence was checked directly at sibling Codex origin/main 842547640ee37451c2d66f7e01f8d762e07b336d:

  • codex-rs/core/src/session/mod.rs:3983-4066: active regular turns accept same-turn input atomically and independently of token streaming
  • codex-rs/app-server/src/request_processors/turn_processor.rs:910-1016: no-active, expected-turn mismatch, and non-steerable turns are definitive request errors
  • codex-rs/core/tests/suite/pending_input.rs:497-510 and following: steering is accepted during wait/tool work

Production LOC: +89/-30 (net +59) | Tests: +149/-12 (net +137). The positive production delta adds the required transport-outcome distinction, durable steer retry ownership, and one canonical freshness-and-injectability owner predicate; no config, protocol, storage, or changelog surface changes.

Provenance: the streaming-only owner predicate was introduced in #119594 by PR/code author and merger @fuller-stack-dev on 2026-08-05 (squash 6d2ba0d5622fa7aa21a4770cb4c6fd93cae44e04). This patch narrows that predicate to the canonical backend injection lifecycle rather than adding a parallel steering path.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime size: S maintainer Maintainer-authored PR labels Aug 7, 2026
@steipete steipete self-assigned this Aug 7, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P1 High-priority user-facing bug, regression, or broken workflow. labels Aug 7, 2026
@clawsweeper

clawsweeper Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 6, 2026, 10:45 PM ET / August 7, 2026, 02:45 UTC.

ClawSweeper review

What this changes

The PR replaces streaming-only steering admission with a shared freshness-and-injectability check and preserves steering intent across UI delivery failures and retries.

Regression provenance

Possible regression — probable (reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep this protected maintainer PR open for manual review: source supports the owner-boundary repair, but the required sibling Codex checkout is unavailable for an independent upstream contract verification.

Priority: P1
Reviewed head: 0f496fb38f998d4f90172efd5b71d01b9c6b69f5

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch has focused owner-boundary coverage, but independent upstream Codex-contract verification is unavailable in this checkout.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR is exempt from the external-contributor real-behavior-proof gate; its focused test evidence remains supplemental.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR is exempt from the external-contributor real-behavior-proof gate; its focused test evidence remains supplemental.
Evidence reviewed 5 items Current-main mismatch: Gateway waives the moved-leaf fence for steering only when the owner is streaming, while delivery separately accepts an injectable non-streaming backend.
Shared owner-boundary repair: The PR-head diff makes admission and delivery use the same fresh, injectable reply-operation predicate, retaining the originating-leaf fence.
Runtime adapter evidence: The bundled Codex adapter supplies both terminal-state information and message injection, making a non-streaming injectable run a concrete local source path.
Findings None None.
Security None None.

How this fits together

Control UI steering messages enter Gateway admission, which verifies the active reply-run owner before injecting input into the agent runtime. Gateway outcomes then drive the queue’s accepted, rejected, or delivery-uncertain UI state.

flowchart LR
  A[Control UI steer] --> B[Gateway admission]
  B --> C[Reply-run owner check]
  C --> D[Agent runtime injection]
  D --> E[Gateway outcome]
  E --> F[UI queue state]
Loading

Before merge

  • Resolve merge risk (P1) - Without the required direct Codex source inspection, merge review cannot independently confirm that accepting non-streaming active turns matches the upstream turn-steering contract.
  • Resolve merge risk (P1) - This changes active-message injection and durable queue state; preserve the same-leaf and stale-owner behavior verified by the added Gateway and registry tests.
  • Complete next step (P2) - This protected maintainer PR needs a restored sibling Codex checkout for the required direct dependency-contract check before a merge verdict.
Agent review details

Security

None.

PR surface

Source +59, Tests +137. Total +196 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 7 89 30 +59
Tests 4 149 12 +137
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 238 42 +196

Review metrics

Metric Value Why it matters
Production versus tests production +59 net; tests +137 net The production growth consolidates owner freshness and injectability while the added tests cover admission, stale owners, and retry preservation.

Merge-risk options

Maintainer options:

  1. Verify the upstream turn contract (recommended)
    Restore the sibling Codex checkout and confirm that an active non-streaming tool phase may accept same-turn injected input before merging.
  2. Accept the cited contract evidence
    A maintainer may merge based on the contributor's cited Codex inspection, accepting that this review could not independently reproduce it locally.

Technical review

Best possible solution:

Retain the registry-owned single admission-and-delivery predicate, then complete an exact-head review with the sibling Codex source available before merge.

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

No independent high-confidence live reproduction was run; current source does show a non-streaming injectable owner rejected by the streaming-only admission predicate.

Is this the best way to solve the issue?

Unclear pending the required direct Codex inspection; locally, sharing one freshness-and-injectability predicate is the narrowest owner-boundary repair.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add merge-risk: 🚨 message-delivery: The patch changes whether active-run steering is admitted and injected into the agent runtime.
  • add merge-risk: 🚨 session-state: The patch changes originating-leaf fencing and durable steer retry state for a live session.

Label justifications:

  • P1: A steering instruction can be rejected or ambiguously displayed while an active tool-time run is capable of accepting it.
  • merge-risk: 🚨 message-delivery: The patch changes whether active-run steering is admitted and injected into the agent runtime.
  • merge-risk: 🚨 session-state: The patch changes originating-leaf fencing and durable steer retry state for a live session.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is exempt from the external-contributor real-behavior-proof gate; its focused test evidence remains supplemental.

Evidence

What I checked:

Likely related people:

  • fuller-stack-dev: Authored the merged steering-across-harnesses work that established the active-owner and originating-leaf behavior this PR refines. (role: introduced active-steering invariant; confidence: high; commits: 6d2ba0d5622f; files: src/auto-reply/reply/reply-run-registry.ts, src/gateway/server-methods/chat-send-admission.ts)
  • Shakker: Current-main blame associates the streaming-owner predicate and adjacent UI lifecycle with this recent steering-area commit, though shallow history limits stronger attribution. (role: recent area contributor; confidence: medium; commits: fa06a000c564; files: src/auto-reply/reply/reply-run-registry.ts, ui/src/pages/chat/steer-lifecycle.ts)

Rank-up moves

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

  • Make sibling Codex source available and refresh the exact-head dependency-contract review.

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-08-07T00:39:04.184Z sha e70cf88f48eba3fd6494b6e82754df6e5f6dfe8e :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the codex/fix-steer-delivery branch from e70cf88 to e079789 Compare August 7, 2026 00:43
@steipete

steipete commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Exact-head rank-up accounting for e079789523d72e75ce7b80eefce779a8626ea96d:

  • Direct Codex contract inspection is complete at openai/codex origin/main 842547640ee37451c2d66f7e01f8d762e07b336d. codex-rs/core/src/session/mod.rs:3983-4066 admits same-turn input atomically whenever the matching regular task is active, independent of token streaming; codex-rs/app-server/src/request_processors/turn_processor.rs:910-1016 maps no-active, mismatched-turn, and non-steerable cases to definitive request errors; codex-rs/core/tests/suite/pending_input.rs:497-510 and following proves steering during wait/tool work.
  • The previous review at e70cf88f48eba3fd6494b6e82754df6e5f6dfe8e and both Rank-up moves were read. The branch is now cleanly rebased onto current main, uses the canonical makeChatHost fixture, and narrows the rejected send outcome with an explicit type guard.
  • Focused current-main UI proof passes 269/269. Fresh full-branch autoreview reports no accepted/actionable findings.

Please refresh review on this exact head.

@clawsweeper

clawsweeper Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

@steipete

steipete commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Final exact-head refresh for bc209cc:

  • The branch is now cleanly rebased onto c245cfc, the current-main CI/test-fixture baseline repair. The temporary competing fixture rename was dropped; this head preserves main's canonical .test-support.ts owner.
  • Direct Codex contract inspection remains complete at openai/codex origin/main 842547640ee37451c2d66f7e01f8d762e07b336d: codex-rs/core/src/session/mod.rs:3983-4066, codex-rs/app-server/src/request_processors/turn_processor.rs:910-1016, and codex-rs/core/tests/suite/pending_input.rs:497-510 and following.
  • Focused current-main proof passes: UI chat 269/269 and Knip production/full-tree unused-file scans with zero entries. Fresh full-branch autoreview reports no accepted/actionable findings.

Please refresh the durable review on this exact head.

@clawsweeper

clawsweeper Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

@steipete

steipete commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Exact-head P1 disposition for 0f496fb:

  • Confirmed the admission/delivery mismatch from the bc209 review artifact.
  • Added one operation-level freshness-and-injectability predicate in reply-run-registry.ts; both originating-leaf admission and queueReplyRunMessage now consume it, so an evidence-stale owner cannot waive the leaf fence and reject during injection.
  • Registry proof covers fresh non-streaming owner -> evidence-stale rejection for admission and delivery -> activity restores acceptance.
  • Gateway proof covers a moved leaf with a non-streaming, isStopped=false, evidence-stale owner and requires typed active-leaf-changed rejection with no run admission.
  • Focused proof: reply-run registry 52/52, Gateway directive/chat 163/163, UI chat 269/269; full branch autoreview clean with no accepted/actionable findings.
  • Direct Codex contract evidence remains recorded from openai/codex origin/main 842547640ee37451c2d66f7e01f8d762e07b336d.

Please refresh the durable review on this exact head.

@clawsweeper

clawsweeper Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Aug 7, 2026
@steipete

steipete commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

Exact-head Rank-up move disposition for 0f496fb38f998d4f90172efd5b71d01b9c6b69f5:

  • Sibling Codex checkout: skipped as an infrastructure-only rating move, not an actionable code finding. ClawSweeper's secretless review environment does not provide sibling ../codex; making that checkout available would require an unrelated review-workflow/infrastructure change.
  • The authorized acting landing worker personally inspected openai/codex origin/main 842547640ee37451c2d66f7e01f8d762e07b336d: codex-rs/core/src/session/mod.rs:3983-4066, codex-rs/app-server/src/request_processors/turn_processor.rs:910-1016, and codex-rs/core/tests/suite/pending_input.rs:497-510 and following.
  • The PR evidence records that exact contract: matching active regular turns accept same-turn input independently of token streaming, while no-active, mismatch, and non-steerable cases are definitive request errors.

The durable exact-head review reports no findings; no re-review is requested solely to refresh its rating.

@steipete
steipete merged commit 48ea089 into main Aug 7, 2026
207 of 209 checks passed
@steipete
steipete deleted the codex/fix-steer-delivery branch August 7, 2026 02:49
@steipete

steipete commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit to VACInc/openclaw that referenced this pull request Aug 7, 2026
* origin/main: (58 commits)
  fix(test): restart shared gateway after migration convergence (openclaw#120089)
  fix(ui): make active-run steering reliable (openclaw#120083)
  fix(telegram): preserve voice fallback text
  test(swift): preserve queued websocket frames (openclaw#120106)
  fix: reject missing oxlint shard selectors (openclaw#120096)
  test(channels): align prerelease fallback catalog spec (openclaw#120092)
  fix(node-cli): warn when systemd user lingering is disabled after install (openclaw#118430)
  fix(diagnostics): preserve CLI turn usage totals (openclaw#120100)
  fix(gateway): derive lock and coordinator paths from the resolved state dir (openclaw#120110)
  fix(release): isolate private Telegram QA harness (openclaw#120088)
  test(agents): exercise execution attribution ingress guard
  fix(gateway): defer attribution until admission succeeds
  refactor(agents): centralize exact execution attribution
  fix(google): accept base64url provider media (openclaw#116204)
  fix(plugins): warn when registerHook uses a typed hook event name (openclaw#118601)
  fix(canvas): serve Content-Length on A2UI HEAD responses (openclaw#117961)
  fix(gateway): make doctor dreaming timestamp comparators NaN-safe (openclaw#118749)
  fix(heartbeat): explain target-none skips (openclaw#119689)
  fix(security): stop recommending retired install-policy bypasses (openclaw#120011)
  fix(plugins): preserve startup release during repair (openclaw#120085)
  ...

# Conflicts:
#	CHANGELOG.md
#	src/config/sessions/session-accessor.sqlite-transcript-write.ts
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 7, 2026
* fix(ui): make active-run steering reliable

* chore: leave release notes to release prep

* fix(ui): align steer result typing with main

* fix(gateway): reject stale steering owners
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: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. 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. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant