Skip to content

fix(ui): send approvals past busy chat queue#101532

Merged
steipete merged 2 commits into
mainfrom
codex/replay-77672-webchat-approve
Jul 7, 2026
Merged

fix(ui): send approvals past busy chat queue#101532
steipete merged 2 commits into
mainfrom
codex/replay-77672-webchat-approve

Conversation

@steipete

@steipete steipete commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

When a Control UI chat run is waiting for exec approval, typed /approve ... commands follow the ordinary busy-chat path and are queued behind the run that cannot finish until that command is handled.

This is a narrow current-main replay of the useful WebChat portion of #77672. It does not carry that stale draft's requester-limited approval-list CLI, duplicated reconnect loader, already-landed sessions alias, or unrelated docs.

Why This Change Was Made

The Gateway already resolves authorized /approve commands before active-run queue admission. Control UI now sends a recognized /approve command through the existing detached chat.send path only while the selected chat is busy. Idle command behavior remains unchanged, the active run keeps ownership, and Gateway scope and command authorization checks remain authoritative.

Contributor credit is preserved through the commit co-author and changelog attribution to @vincentkoc.

User Impact

Operators can type an approval decision in Control UI while an exec is waiting without deadlocking the decision behind the blocked run.

Evidence

  • Testbox tbx_01kwxy6jtj8x9fzarrt507zpy9: pnpm test ui/src/pages/chat/chat-send.test.ts — 99 passed.
  • Same Testbox: pnpm test:ui:e2e ui/src/e2e/approval-flow.e2e.test.ts — 2 passed, including a browser composer/WebSocket scenario that keeps the first run active and proves the approval becomes an immediate second chat.send with no queue entry or run replacement.
  • Same Testbox: pnpm check:changed — core/core-tests/docs lanes passed, including typechecks, lint, changelog/dependency/storage/media/runtime guards, and import-cycle scan.
  • Fresh autoreview --mode local — clean, no accepted/actionable findings (overall correctness 0.91).
  • git diff --check — clean.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: S maintainer Maintainer-authored PR labels Jul 7, 2026
@steipete

steipete commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

Land-ready proof refreshed for exact head 712b6f44bbdfc638496f1902130cb795e3b22b48.

  • Testbox tbx_01kwxy6jtj8x9fzarrt507zpy9: pnpm test ui/src/pages/chat/chat-send.test.ts (99 passed), pnpm test:ui:e2e ui/src/e2e/approval-flow.e2e.test.ts (2 passed), and pnpm check:changed (all selected checks passed).
  • Exact-head GitHub Actions run 28857041607: 48 successful, 9 skipped, 0 failed.
  • Fresh maintainer autoreview: no accepted or actionable findings.
  • Native scripts/pr review artifacts validated; OPENCLAW_TESTBOX=1 scripts/pr prepare-run 101532 passed at the exact head above.

The replay remains intentionally narrow: only busy Control UI /approve bypasses the local chat queue. Idle /approve, /btw, server command handling, CLI approval authority, and reconnect/session work are unchanged.

@clawsweeper

clawsweeper Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Codex review: stale review; fresh review needed.

Summary
The latest durable ClawSweeper review was for head 4626b796847db4dd5e4b475bdf678b333af6d77d, but the PR head is now 712b6f44bbdfc638496f1902130cb795e3b22b48. Its old verdict and PR readiness labels are no longer current.

Next step
Run or wait for a fresh ClawSweeper review on the current PR head.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 712b6f44bb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// The backend resolves /approve before active-run admission. Send it now so
// the approval command cannot queue behind the run that is waiting for it.
const shouldSendDetachedCommand =
isBtwCommand(message) || (parsed?.command.key === "approve" && isChatBusy(host));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep detached approvals out of the transcript

When an operator types /approve ... while a run is busy, this branch sends it as a detached chat.send, but the Gateway still treats that text as a normal main/text-slash turn (turnKind only special-cases BTW in src/gateway/server-methods/chat.ts:3673-3675). The non-agent command branch then persists the user turn and appends an assistant transcript message (src/gateway/server-methods/chat.ts:4852-5260), unlike the BTW side-result path, so approving an exec during an active run pollutes the same session history/context with the approval command and success notice while the original run is still in progress. Please route these approvals through a non-transcript backend path or mark them as side/non-persistent before detaching them.

Useful? React with 👍 / 👎.

Comment thread CHANGELOG.md

### Fixes

- **Control UI typed approvals:** send `/approve` commands immediately through the authorized Gateway command path while an agent run is blocked instead of queueing the command behind that run. (#77672) Thanks @vincentkoc.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove the normal-fix changelog entry

This adds an Unreleased entry for a normal fix, but the repo’s root AGENTS.md says CHANGELOG.md is release-only and that normal fixes should keep release-note context in the PR body, squash message, or direct commit. Leaving this line in a regular fix makes the release generator inherit prewritten content that can be duplicated or contradicted during release-note generation; please drop the changelog edit from this commit.

Useful? React with 👍 / 👎.

@steipete
steipete merged commit 395fbb8 into main Jul 7, 2026
78 checks passed
@steipete
steipete deleted the codex/replay-77672-webchat-approve branch July 7, 2026 09:59
@steipete

steipete commented Jul 7, 2026

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant