Skip to content

fix(ui): show correct node command remediation - #135453

Merged
obviyus merged 17 commits into
openclaw:mainfrom
gaoanze888:fix/node-command-reason
Sep 3, 2026
Merged

obviyus merged 17 commits into
openclaw:mainfrom
gaoanze888:fix/node-command-reason

Conversation

@gaoanze888

@gaoanze888 gaoanze888 commented Sep 1, 2026 •

Copy link
Copy Markdown

Refs #135378

What Problem This Solves

The Session host picker mapped three different node command states to one allowlist hint:

  • the node did not declare the command;
  • the command awaited pairing approval;
  • the declared command was blocked by Gateway command policy.

The hint was wrong for the first two states and incomplete when a deny rule overrode an allow rule.

Why This Change Was Made

The Gateway owns node declaration, pairing, and command policy state. The client previously tried to infer that authority from capabilities, invocableCommands, and pending declarations.

environments.list now accepts an optional bounded runtimeId. For write-scoped callers, the Gateway returns one bounded requiredNodeCommand result per connected node when the runtime needs a node command. Its closed state is invocable, pending-approval, undeclared, or unauthorized.

The same Gateway resolver now gates dispatch and the New Session and Move Session pickers. Raw pending declarations remain private. Empty inventory reads remain available with operator.read; runtime-scoped command state requires operator.write.

The change does not add configuration, change the protocol version, or infer workspace or Codex authentication eligibility.

User Impact

The picker now gives one correct next action:

  • make an undeclared command available on the device, then reconnect;
  • ask an administrator to approve a pending command request;
  • authorize a blocked command in the Gateway node command policy.

Evidence

Exact head: 7525af641884d3c103e33e1bf19eabc90900e39a

  • Current-main red on 3c6169c63628a3c59f84b0650b6712c1180f5e42: all three states showed the same allowlist remediation.
  • Exact-head green: a real isolated Gateway, real device and node pairing, an explicit policy deny, and Chromium showed the correct action for all three states.
  • Focused protocol, Gateway, dispatch, New Session, and Move Session tests passed.
  • Protocol registry and generated Swift and Kotlin checks passed.
  • P0 Autoreview reported no accepted or actionable findings.
  • Screenshots, video, commands, and validation details: fix(ui): show correct node command remediation #135453 (comment)

Scope Note

Issue #135378 also requests broader diagnostics. This PR does not add them, so the issue remains open.

AI Assistance

AI-assisted repair. A maintainer independently reproduced the bug, inspected the Codex remote-exec contract, rewrote the fix at the Gateway owner, and verified the real Gateway and Control UI path.

@clawsweeper

clawsweeper Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 1, 2026
@clawsweeper

clawsweeper Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 3, 2026, 12:17 AM ET / 04:17 UTC.

ClawSweeper review

What this changes

The PR adds runtime-scoped node-command eligibility to the Gateway catalog and uses it in New Session and Move Session pickers to distinguish undeclared, unauthorized, and pending-approval commands.

Regression provenance

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

Merge readiness

⛔ Blocked before merge - 3 items remain

Keep open: current main still gives the generic command-policy hint, while this PR adds the Gateway-owned command state needed to give accurate picker remediation.

Priority: P2
Reviewed head: 73850ffad86e6a64de36456ba4bbf328e1f6d577

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A well-targeted owner-boundary repair with credible real-flow proof and a normal additive protocol compatibility consideration.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): The changed Gateway policy projection is exercised by focused unit/UI coverage and a linked exact-head real Gateway, pairing, and Chromium run; linked media was supplied but could not be opened from this DNS-restricted review environment.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The changed Gateway policy projection is exercised by focused unit/UI coverage and a linked exact-head real Gateway, pairing, and Chromium run; linked media was supplied but could not be opened from this DNS-restricted review environment.
Evidence reviewed 9 items Current-main behavior remains unfixed: Current main derives picker unavailability from the invocable-command list and gives the generic command-policy remediation; it has no runtime-scoped required-command state.
Gateway owner boundary: The PR validates an optional runtime id, resolves the runtime's required node command, and projects only closed eligibility states; placement dispatch uses the same resolver.
Shared dispatch invariant: Actual placement eligibility consumes the Gateway command-policy resolver, avoiding a UI-only inference from incomplete command inventory.
Findings None None.
Security None None.

How this fits together

The Gateway inventories paired devices and their command policy for session placement. The web UI consumes that catalog to enable or explain device choices before a placement dispatch is attempted.

flowchart LR
  A[Selected agent runtime] --> B[Gateway environment listing]
  C[Node command policy and pairing state] --> D[Command eligibility resolver]
  B --> D
  D --> E[Optional placement metadata]
  E --> F[New Session picker]
  E --> G[Move Session picker]
  D --> H[Placement dispatch eligibility]
Loading

Before merge

  • Resolve merge risk (P1) - This extends the public Gateway catalog with optional request and response fields, so strict external protocol consumers should tolerate the additive list shape.
  • Resolve merge risk (P1) - The bug fix has a net production increase of 222 lines; the shared Gateway resolver and bounded protocol projection justify it, but it merits normal merge review.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +186, Tests +695, Docs 0, Config +1, Other +36. Total +918 across 39 files.

View PR surface stats
Area Files Added Removed Net
Source 21 256 70 +186
Tests 14 726 31 +695
Docs 2 2 2 0
Config 1 1 0 +1
Generated 0 0 0 0
Other 1 38 2 +36
Total 39 1023 105 +918

Review metrics

Metric Value Why it matters
Production and test delta production +294/-72 (net +222); tests/support +726/-31 (net +695); docs +2/-2; automation +1 Production growth centralizes command-policy projection at the Gateway boundary, while most added coverage validates the UI and real Gateway flow.

Stored data model

Persistent data-model change detected: unknown-data-model-change: packages/gateway-protocol/src/schema/environments.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Retain the additive protocol contract (recommended)
    Merge with the optional runtime request and required-command response fields so existing empty requests continue to work while clients can adopt the new diagnostics.

Technical review

Best possible solution:

Keep the shared Gateway resolver as the sole source of command eligibility and retain the optional additive protocol fields consumed by both picker flows.

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

Yes, source-reproducible: current main's picker has the generic invocable-command check, and the supplied issue and exact-head Gateway evidence provide the concrete policy-state scenario; this reviewer did not rerun it locally.

Is this the best way to solve the issue?

Yes: resolving eligibility at the Gateway policy owner and sharing it with dispatch avoids both the previous misleading UI inference and a dispatch-only fix that would leave the picker wrong.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • remove proof: 🎥 video: Current real behavior proof evidence kind is linked_artifact.

Label justifications:

  • P2: The PR repairs misleading placement remediation with a bounded effect on session-host selection.
  • merge-risk: 🚨 compatibility: Optional fields are added to the public Gateway environments listing contract used by protocol clients.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The changed Gateway policy projection is exercised by focused unit/UI coverage and a linked exact-head real Gateway, pairing, and Chromium run; linked media was supplied but could not be opened from this DNS-restricted review environment.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed Gateway policy projection is exercised by focused unit/UI coverage and a linked exact-head real Gateway, pairing, and Chromium run; linked media was supplied but could not be opened from this DNS-restricted review environment.

Evidence

What I checked:

Likely related people:

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

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (12 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-02T15:17:45.831Z sha a641c89 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-02T15:45:49.052Z sha ec8de62 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-02T16:11:00.101Z sha 727651a :: needs maintainer review before merge. :: none
  • reviewed 2026-09-02T23:19:30.583Z sha d3e461d :: blocked before merge. :: none
  • reviewed 2026-09-03T00:01:13.715Z sha a2f8f76 :: blocked before merge. :: none
  • reviewed 2026-09-03T00:07:46.204Z sha a2f8f76 :: blocked before merge. :: none
  • reviewed 2026-09-03T00:48:29.892Z sha 7525af6 :: blocked before merge. :: none
  • reviewed 2026-09-03T01:23:15.939Z sha 56efd9f :: blocked before merge. :: none

@gaoanze888

This comment was marked as spam.

@clawsweeper

clawsweeper Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Sep 1, 2026
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S and removed size: XS labels Sep 1, 2026
@gaoanze888

This comment was marked as spam.

@clawsweeper

clawsweeper Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. label Sep 1, 2026
@obviyus obviyus self-assigned this Sep 2, 2026
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: XL and removed size: S labels Sep 2, 2026
@obviyus

obviyus commented Sep 2, 2026 •

Copy link
Copy Markdown
Collaborator

Land-ready verification for exact head 727651a71e7162f523f7cf72ac7f144a436e081d.

  • Root cause: the Session picker inferred node command authority from partial command and capability lists, so three different states produced one allowlist hint.
  • Fix: environments.list({ runtimeId }) now returns one bounded Gateway-owned command state. Runtime-scoped reads require operator.write. Raw pending declarations remain private.
  • Cloud-node ownership: pending pairing records no longer enter the public environment catalog, so a cloud-owned node cannot reappear through pending state.
  • Current-main red: on 3c6169c63628a3c59f84b0650b6712c1180f5e42, undeclared, pending-approval, and unauthorized nodes all showed the same gateway.nodes.commands.allow remediation.
  • Exact-head green: a real isolated Gateway, three real paired node identities, and Chromium showed the correct next action for all three states. The unauthorized case used an explicit deny override.

Undeclared and pending approval states

Unauthorized state

pr-135453-merge2-real-gateway.webm

Validation:

  • node scripts/run-vitest.mjs <focused protocol, Gateway, dispatch, New Session, and Move Session files>: 177 passed after merging current main.
  • Schema optionality repair after CI typecheck: 18 focused protocol and Gateway tests passed.
  • node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/new-session-page.environment-metadata.e2e.test.ts: 2 passed.
  • node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner test/e2e/qa-lab/runtime/session-host-command-state.real-gateway.e2e.test.ts: 1 passed on the exact commit.
  • Protocol registry, Swift generation, Kotlin generation, docs MDX, UI translations, assertion safety, max-lines, coercion, import cycles, Oxfmt, OXlint, and git diff --check: passed.
  • P0 Autoreview: clean; no accepted or actionable findings.
  • Core-to-plugin and extension-test boundary guards: passed after routing the QA Lab-owned proof through test/e2e/qa-lab/runtime.
  • New Session where-chip sibling coverage: 10 passed with exact closed-state assertions.

Direct Codex contract check: openai/codex at da23e131e68b171909407f469da1b2f72d9c4f4a, including codex-rs/exec-server/src/client_api.rs, codex-rs/exec-server/src/environment_toml.rs, and codex-rs/exec-server-protocol/src/protocol.rs.

ClawSweeper rank-up moves are addressed: the cloud-node ownership leak is removed, and real after-fix Control UI proof is attached.

@obviyus obviyus changed the title fix(ui): distinguish undeclared node commands from unauthorized ones fix(ui): show correct node command remediation Sep 2, 2026
# Conflicts:
#	test/vitest/vitest.ui-e2e.config.ts
#	ui/src/pages/chat/chat-pane-placement.runtime.ts
@clawsweeper clawsweeper Bot removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 2, 2026
@obviyus

obviyus commented Sep 2, 2026 •

Copy link
Copy Markdown
Collaborator

Exact-head proof refresh for a2f8f76e229544221d4315e43d327c825d865eb4.

  • The scoped close/reopen recovery synchronized this PR to the fork head, then CI coverage added the second QA Lab suite to its full inventory.
  • Current-main red remains on 3c6169c63628a3c59f84b0650b6712c1180f5e42: all three command states gave the same allowlist remediation.
  • Exact-head green uses a real isolated Gateway, real device and node pairing, an explicit command-policy deny, and Chromium.
  • The QA plugin-owned test checks environments.list({ runtimeId }) and the picker copy for undeclared, pending approval, and unauthorized states.
  • The ClawSweeper rank-up move is met: the client maps one Gateway-owned closed state and does not infer command authority.

Undeclared and pending approval states

Unauthorized state

[email protected]

Validation:

  • node scripts/run-vitest.mjs src/gateway/server-methods/environments.node-command-authority.test.ts packages/gateway-protocol/src/schema/environments.test.ts ui/src/pages/new-session/device-placement.test.ts ui/src/pages/new-session/discovery.test.ts ui/src/pages/new-session/where-chip.test.ts ui/src/pages/chat/chat-pane-placement.test.ts: 73 passed.
  • node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner extensions/qa-lab/src/session-host-command-state.real-gateway.e2e.test.ts: 1 passed on the exact head.
  • Plugin boundary, SDK export/surface, formatting, and direct OXlint checks: passed.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Sep 2, 2026
@obviyus

obviyus commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

# Conflicts:
#	.github/workflows/ci.yml
#	test/scripts/ci-workflow-guards.test.ts
#	test/vitest-ui-e2e-config.test.ts
#	test/vitest/vitest.ui-e2e.config.ts
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Sep 3, 2026
# Conflicts:
#	test/vitest-ui-e2e-config.test.ts
@clawsweeper clawsweeper Bot removed the proof: 🎥 video Contributor real behavior proof includes video or recording evidence. label Sep 3, 2026
@obviyus

obviyus commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

LandPR notes for the current exact head:

  • Retain the additive protocol fields. They are optional and bounded, the protocol version stays unchanged, and exact-head CI covers the accepted list-only shape.
  • Accept the production growth. The Gateway-owned resolver replaces client inference and is shared by listing and dispatch, so the capability needs this owner boundary.
  • Skip stored-data migration proof. packages/gateway-protocol/src/schema/environments.ts defines a wire shape, not persisted data. No database or stored representation changes.

@obviyus
obviyus merged commit 279f8bb into openclaw:main Sep 3, 2026
244 checks passed
@obviyus

obviyus commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Thanks @gaoanze888!

Proof: A real isolated Gateway with device pairing and an explicit command-policy deny showed the correct New Session and Move Session action for undeclared, pending-approval, and unauthorized commands. Exact-head CI passed.

  • Bug: The picker gave the same allowlist hint for three different command states.
  • Fix: The Gateway now projects one bounded required-command state, and both pickers and placement dispatch use that owner result.
Before After
Undeclared, pending approval, and policy-denied commands showed one generic allowlist hint. Each state shows the correct next action.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 3, 2026
Refs openclaw#135378

## What Problem This Solves

The Session host picker mapped three different node command states to one allowlist hint:

- the node did not declare the command;
- the command awaited pairing approval;
- the declared command was blocked by Gateway command policy.

The hint was wrong for the first two states and incomplete when a deny rule overrode an allow rule.

## Why This Change Was Made

The Gateway owns node declaration, pairing, and command policy state. The client previously tried to infer that authority from `capabilities`, `invocableCommands`, and pending declarations.

`environments.list` now accepts an optional bounded `runtimeId`. For write-scoped callers, the Gateway returns one bounded `requiredNodeCommand` result per connected node when the runtime needs a node command. Its closed state is `invocable`, `pending-approval`, `undeclared`, or `unauthorized`.

The same Gateway resolver now gates dispatch and the New Session and Move Session pickers. Raw pending declarations remain private. Empty inventory reads remain available with `operator.read`; runtime-scoped command state requires `operator.write`.

The change does not add configuration, change the protocol version, or infer workspace or Codex authentication eligibility.

## User Impact

The picker now gives one correct next action:

- make an undeclared command available on the device, then reconnect;
- ask an administrator to approve a pending command request;
- authorize a blocked command in the Gateway node command policy.

## Evidence

Exact head: `7525af641884d3c103e33e1bf19eabc90900e39a`

- Current-main red on `46ef0be1422f824d7620e1c5dbc87dc59d1a9138`: all three states showed the same allowlist remediation.
- Exact-head green: a real isolated Gateway, real device and node pairing, an explicit policy deny, and Chromium showed the correct action for all three states.
- Focused protocol, Gateway, dispatch, New Session, and Move Session tests passed.
- Protocol registry and generated Swift and Kotlin checks passed.
- P0 Autoreview reported no accepted or actionable findings.
- Screenshots, video, commands, and validation details: openclaw#135453 (comment)

## Scope Note

Issue openclaw#135378 also requests broader diagnostics. This PR does not add them, so the issue remains open.

## AI Assistance

AI-assisted repair. A maintainer independently reproduced the bug, inspected the Codex remote-exec contract, rewrote the fix at the Gateway owner, and verified the real Gateway and Control UI path.

Co-authored-by: Ayaan Zaidi <[email protected]>
steipete added a commit that referenced this pull request Sep 3, 2026
… hot deny

A hot gateway.nodes.commands deny re-applies policy to live node sessions:
the registry narrows the effective commands and records the withheld ones,
but the declaration stays. resolveRequiredNodeCommandAuthority checked
"declared but not effective" before "withheld", so environments.list and
placement reported pending-approval for a command no approval can restore.
The real-gateway e2e added in #135453 only passed when it read the state
before the refresh, which reds checks-ui-e2e-real-gateway on main.

Withheld now wins, the rest of the closed state is unchanged, and the new
table-driven unit test fails on the previous order.
@clawsweeper

clawsweeper Bot commented Sep 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 commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation extensions: qa-lab gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants