Skip to content

fix(gateway): allow write-scoped session model changes - #120875

Merged
steipete merged 1 commit into
mainfrom
steipete/roboclaw-model-access-permissions-60328c
Aug 9, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/roboclaw-model-access-permissions-60328c

Conversation

@steipete

@steipete steipete commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Closes #120867

What Problem This Solves

Fixes an issue where operators using the Control UI or another bounded client could not change the current session model with operator.write. The model picker was disabled with an administrator-access message because sessions.patch { model } was rejected before the existing session-only handler path could run.

Why This Change Was Made

The canonical params-aware session policy now treats model as a write-scoped session mutation while keeping thinking, fast, verbose, trace, reasoning, unknown fields, and mixed privileged patches admin-only. Public compare-and-swap envelope fields no longer accidentally escalate an otherwise write-scoped patch.

The handler's existing ownership boundary remains intact: write-scoped model changes affect only the session, while only operator.admin callers can persist the selection as the configured agent default. The Control UI now evaluates model and effort access separately so widening model access does not expose admin-only controls.

This PR is AI-assisted and was reviewed against the full diff.

User Impact

Operators with operator.write can select or clear an allowed model for their current session without receiving administrator authority. Thinking and fast-mode controls remain unavailable without operator.admin, and mixed model-plus-privileged patches still fail atomically.

The separate owner handoff problem was already fixed by #119785 and is not changed here. Live Roboclaw verification showed the active pane currently receives the full administrator scope set.

Evidence

  • Source-blind isolated Gateway validation:
    • a connection advertising only operator.write changed and cleared the session model successfully;
    • thinkingLevel and fastMode returned structured missing scope: operator.admin errors;
    • a mixed model-plus-thinking patch was denied with no partial model mutation;
    • an admin connection successfully changed model, thinking, and fast mode.
  • Focused Vitest proof: 278 core/Gateway/client tests and 360 Control UI tests passed during the repair; the narrowed final model-only bundle reran 176 Gateway/policy tests and 304 UI tests successfully.
  • Full local changed-file gate passed after the hosted Testbox backend was unavailable: formatting, core/core-test/UI typechecks, core lint, UI i18n, dead exports, plugin boundaries, import cycles, database-first guards, auth pairing guards, and related repository checks.
  • git diff --check passed.
  • Codex autoreview (--mode uncommitted, P1) reported no accepted/actionable findings; TruffleHog was clean.
  • Focused security review found no qualifying newly introduced high- or medium-severity vulnerabilities.
  • Rebase onto current origin/main was conflict-free and preserved the reviewed patch ID.

Production delta: +49/−35 lines (net +14). Tests are net +60 lines; docs are net +5 lines.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime size: M maintainer Maintainer-authored PR labels Aug 9, 2026
@steipete
steipete marked this pull request as ready for review August 9, 2026 04:17
@steipete

steipete commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

Land-ready verification for head 2fd3439e985e43d8ae1ac27c7fb7323f3258b60d:

  • Focused Gateway/policy and Control UI regression suites passed, including real WebSocket dispatch coverage for write-scoped model mutation and atomic denial of mixed model+effort patches.
  • Source-blind isolated Gateway proof passed:
    • operator.write changed and cleared the session model;
    • thinking/fast changes returned missing scope: operator.admin;
    • mixed model+thinking denial left session state unchanged;
    • admin scope successfully changed model and effort settings.
  • Full local changed gate passed via OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 node scripts/check-changed.mjs --timed: format, core/core-test/UI typechecks, core lint, UI i18n, dead exports, plugin boundaries, import cycles, database-first guards, and auth pairing guards.
  • Hosted Testbox was unavailable locally because the Blacksmith CLI was not installed; repository policy fallback was the successful local gate above.
  • git diff --check passed.
  • Codex autoreview (--mode uncommitted, P1) was clean with no accepted/actionable findings; TruffleHog was clean.
  • Focused security review found no qualifying newly introduced high- or medium-severity vulnerabilities.
  • Exact-head CI is green: https://github.com/openclaw/openclaw/actions/runs/31294240619

Known proof gap: the disposable local Gateway did not finish serving Control UI assets, so browser screenshot capture was unavailable. The changed UI access split is covered by focused Control UI tests, while the underlying public Gateway behavior was proven source-blind end to end.

@steipete
steipete merged commit 34062ea into main Aug 9, 2026
185 checks passed
@steipete
steipete deleted the steipete/roboclaw-model-access-permissions-60328c branch August 9, 2026 04:43
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 10, 2026
@VACInc

VACInc commented Sep 12, 2026

Copy link
Copy Markdown
Member

Follow-up: merged #146343 extends the write-scoped session model-setting policy from #120875 to thinkingLevel and fastMode updates, including clearing overrides.

Existing per-session access checks and privileged-field restrictions are preserved. The original model-picker fix remains #120875; #146343 addresses the effort controls deliberately excluded from that earlier change. These fixes are complementary, not duplicates.

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: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Control UI model picker incorrectly requires operator.admin

2 participants