Skip to content

fix: allow session thinking and fast-mode changes with write access - #146343

Merged
VACInc merged 2 commits into
mainfrom
openclaw/allow-mid-session-thinking-level-changes
Sep 12, 2026
Merged

VACInc merged 2 commits into
mainfrom
openclaw/allow-mid-session-thinking-level-changes

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes an issue where users with ordinary session write access could change a conversation’s model but could not change its thinking level or fast mode. The same mismatch affected the Control UI pickers and its /think and /fast commands.

Related: #120875, which enabled write-scoped model changes while leaving effort controls admin-only.

Why This Change Was Made

Treat thinkingLevel and fastMode as session-only write-scoped preferences in the existing shared policy, including clearing them with null. Gateway single/batch patches and the Control UI use that same policy. Give the context-window control its own permission check so enabling effort controls does not accidentally enable an unrelated admin-only setting.

Read-only clients remain read-only. Context-window, verbose, tool, full-permission, and unknown-field restrictions are unchanged. No configuration migration, new setting, or active-inference hot-switching is introduced.

User Impact

Users with operator.write can change thinking level and fast mode without starting a new conversation or receiving administrator access. Changes are persisted session preferences for subsequent turns; the composer still disables model/effort controls while a reply is running. Existing model/provider capability validation remains in place.

Reported by @VACInc.

Evidence

  • Before the production change, the shared-policy regression had nine expected failures. Through an authenticated Gateway WebSocket, the same session accepted a model change and then rejected its thinking change with FORBIDDEN / MISSING_SCOPE / operator.admin.
  • After the change, 244 core/Gateway tests and 110 focused UI tests passed, covering shared scope policy, Gateway authorization, real WebSocket persistence, Control UI access, composer interactions, and slash commands. Coverage includes on/off/auto, reset-to-default, persisted session identity, read-only denial, and mixed privileged-patch rejection.
  • The composer regression renders read/write/admin clients and exercises thinking, fast-mode, and context-window callbacks against the selected session. The new cases now live in focused permission/effort test files; all 41 split-suite tests passed, followed by a passing final organization-scope rerun.
  • An additional 435 existing new-session and chat-rendering tests passed, covering the other shared-picker consumer. After correcting typed fixture metadata and the chat-send fixture, 381 composer/chat-send tests passed (including rerun composer coverage).
  • Independent autoreview: no accepted/actionable P0–P2 findings.
  • All selected quality checks passed: core/core-test/UI types, changed-file lint, UI style/i18n checks, unused exports, import cycles, schema/storage guards, runtime helpers, and auth/webhook guards. Passing checks were reused; after the test-file size failure, focused type/lint reruns and the remaining planned checks passed. No lint suppressions or baselines were changed. git diff --check passed.

Commands:

node scripts/run-vitest.mjs src/shared/session-method-scopes.test.ts src/gateway/method-scopes.test.ts src/gateway/server.sessions.store-rpc.test.ts
node scripts/run-vitest.mjs ui/src/lib/session-method-access.test.ts ui/src/pages/chat/chat-pane-session-controls.test.ts ui/src/pages/chat/chat-command-executor.test.ts src/shared/session-method-scopes.test.ts
node scripts/run-vitest.mjs ui/src/pages/new-session/model-control.test.ts ui/src/pages/chat/chat-view.test.ts
node scripts/run-vitest.mjs ui/src/pages/chat/chat-pane-session-controls.test.ts ui/src/pages/chat/chat-send.test.ts
node scripts/run-vitest.mjs src/gateway/server.sessions.effort-scopes.test.ts src/gateway/server.sessions.store-rpc.test.ts ui/src/pages/chat/chat-pane-session-controls.permissions.test.ts ui/src/pages/chat/chat-pane-session-controls.test.ts
node scripts/run-vitest.mjs src/gateway/server.sessions.store-rpc.test.ts -t "write-scoped operators manage"

Production delta: +13 lines, principally the independent context-window permission wiring; tests counted separately. No styling or layout changes. This is isolated Gateway and rendered UI test proof, not a deployed-Gateway or paid-provider live test.

Keep context-window and other privileged overrides admin-scoped while aligning ordinary model, thinking, and fast-mode controls. Cover existing-session persistence, resets, and rendered permission boundaries.

Co-authored-by: VACInc <[email protected]>
@clawsweeper

clawsweeper Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@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 Sep 12, 2026
Keep the existing organization and composer test files within the lint limit without suppressions; retain the real Gateway and rendered-control regression coverage.

Co-authored-by: VACInc <[email protected]>
@roboclaw-bot
roboclaw-bot marked this pull request as ready for review September 12, 2026 19:17
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 12, 2026
@clawsweeper

clawsweeper Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 12, 2026, 3:25 PM ET / 19:25 UTC.

ClawSweeper review

What this changes

Allows write-scoped clients to change session thinking and fast-mode preferences while keeping the Control UI’s context-window control separately admin-scoped.

Merge readiness

✅ Ready for maintainer review

This remains useful: current main and v2026.9.4 retain the admin-only restriction. The focused implementation preserves the surrounding authorization boundaries, and no introduced correctness defect was found.

Priority: P2
Reviewed head: 0df85c0d6360b72692a8b3e06ba3dd29a942047f

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused shared-policy change with meaningful boundary coverage and no actionable correctness findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied repository classification identifies this as maintainer/bot-owned work. Its reported authenticated Gateway persistence tests and rendered-control tests are supplemental boundary evidence; inspection found no unresolved authority violation requiring the scoped proof exception.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository classification identifies this as maintainer/bot-owned work. Its reported authenticated Gateway persistence tests and rendered-control tests are supplemental boundary evidence; inspection found no unresolved authority violation requiring the scoped proof exception.
Evidence reviewed 8 items Introduced production change: The pinned merge-base-to-head diff adds only thinkingLevel and fastMode to the existing write-scoped field set; the UI receives a separate context-window permission result.
Still absent from current main: Current main's write-scoped mutation set excludes thinkingLevel and fastMode, so the requested existing-session behavior remains unavailable to write-only callers.
Latest release comparison: The supplied latest release, v2026.9.4, also excludes both fields from write-scoped session patches.
Findings None None.
Security None None.

How this fits together

The Gateway authorizes session-setting requests from the Control UI and other clients before storing preferences for subsequent turns. The UI consumes the same shared field-permission policy to enable its controls.

flowchart LR
  A[Chat controls and commands] --> B[Shared field permission policy]
  C[Client scopes] --> B
  B --> D[Gateway authorization]
  D --> E[Current session access check]
  E --> F[Persist session preferences]
  F --> G[Subsequent model turns]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +13, Tests +196, Docs +2. Total +211 across 14 files.

View PR surface stats
Area Files Added Removed Net
Source 4 15 2 +13
Tests 8 236 40 +196
Docs 2 3 1 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 14 254 43 +211

Review metrics

Metric Value Why it matters
Permission changes 2 existing fields move from admin to write scope Thinking and fast mode share the existing single/batch patch policy while other privileged fields retain their restrictions.
Production versus test growth Production net +13 lines; tests net +196 lines Production growth primarily separates context-window permission wiring; tests cover persistence and permission boundaries.

Technical review

Best possible solution:

Keep session preference permissions in the shared policy, with privileged fields and current-session authorization enforced by the existing Gateway owners.

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

Not applicable as a regression: this changes a previously documented access policy. Source inspection confirms that current main rejects these effort patches from write-only clients.

Is this the best way to solve the issue?

Yes. Extending the existing shared field policy and separating context-window access avoids competing authorization logic while preserving existing persistence and validation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 7b374192653d.

Labels

Label changes:

  • add P2: This is a bounded session-control improvement for write-scoped clients without evidence of an urgent outage.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied repository classification identifies this as maintainer/bot-owned work. Its reported authenticated Gateway persistence tests and rendered-control tests are supplemental boundary evidence; inspection found no unresolved authority violation requiring the scoped proof exception.

Label justifications:

  • P2: This is a bounded session-control improvement for write-scoped clients without evidence of an urgent outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied repository classification identifies this as maintainer/bot-owned work. Its reported authenticated Gateway persistence tests and rendered-control tests are supplemental boundary evidence; inspection found no unresolved authority violation requiring the scoped proof exception.

Evidence

What I checked:

  • Introduced production change: The pinned merge-base-to-head diff adds only thinkingLevel and fastMode to the existing write-scoped field set; the UI receives a separate context-window permission result. (src/shared/session-method-scopes-base.ts:17, 0df85c0d6360)
  • Still absent from current main: Current main's write-scoped mutation set excludes thinkingLevel and fastMode, so the requested existing-session behavior remains unavailable to write-only callers. (src/shared/session-method-scopes-base.ts:6, 7b374192653d)
  • Latest release comparison: The supplied latest release, v2026.9.4, also excludes both fields from write-scoped session patches. (src/shared/session-method-scopes-base.ts:6, 3a9d69db306c)
  • Related merged work has narrower scope: GitHub confirms fix(gateway): allow write-scoped session model changes #120875 merged. Its supplied body explicitly limits that change to model selection and retains admin-only effort settings, so it does not supersede this PR. (34062ead2047)
  • Authority remains bound to the final write: The patch engine invokes accumulated authorization guards at the persistence boundary and checks the target snapshot again after asynchronous preparation. Session-sharing authorization rechecks current access and session identity; the PR does not replace these owners. (src/gateway/server-methods/sessions-patch-engine.ts:585, 0df85c0d6360)
  • Positive and negative boundary coverage: The new Gateway test exercises authenticated write-scoped model selection, effort changes, resets, and stored session identity. Scope tests reject read-only callers; the existing WebSocket mixed-field test rejects a privileged patch and verifies that stored model and label values remain unchanged. The PR reports passing focused suites; no tests were executed during this read-only review. (src/gateway/server.sessions.effort-scopes.test.ts:9, 0df85c0d6360)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ayaan Zaidi: 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.

@VACInc VACInc self-assigned this Sep 12, 2026
@roboclaw-bot

roboclaw-bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Collaborator Author

Genuine before/after and session-access clarification

A 41.92-second before/after recording is now captured and inspected. These are actual source revisions in Chromium against real isolated Gateways, not a simulated disabled UI:

Revision Observed behavior
Before: 1a49b0e8e42c551bdf0880d4aaa94e9a60df6593 The write-only browser changed the model and restored its default. The effort control stayed disabled; direct thinking and Fast patches were both rejected with missing scope: operator.admin.
After: 0df85c0d6360b72692a8b3e06ba3dd29a942047f The same scope set changed thinking to High and enabled Fast. Both persisted after reload; Guarded mode stayed unchanged; privileged mixed requests were denied and a read-only connection kept the controls disabled.

Both fixtures used operator.read + operator.write, synthetic content, and no model inference. The clips use narrowly scoped devices in an isolated single-owner fixture; they are not a live audit of a particular person’s role configuration.

What “owned or assigned” means here

This PR does not implement an owner/assignee-only restriction. It changes which session fields ordinary write access can modify; the existing per-session authorization rules remain in force.

  • A verified profile creator, explicit session membership, and the configured role/sharing policy determine access. Membership remains subject to the role ceiling.
  • Assignment is responsibility/display only. Assigning the sidebar owner does not grant or remove access, and participant history is not membership.
  • Existing broader cases remain: uncapped shared sessions, roles with sessions.others: write, and administrator access can permit changes to sessions the caller did not create and is not assigned.
  • Both single and batch patches retain target authorization and fresh pre-write checks. There is no new membership, role, sharing, or administrator grant in this change.

Sources: ownership versus assignment, sharing-role resolution, mutation policy, and existing admin exception.

Independent verification passed 262 existing tests across 7 policy/mutation test files. A two-identified-user, effort-field-specific RPC matrix for both patch methods was not performed; the source trace and existing tests establish the unchanged common authorization boundary.

Comparison media status

The comparison video is not attached to this PR yet. The current GitHub upload attempt still returns HTTP 400 Bad Content-Length; the configured Crabbox fallback still fails with HTTP 403 SignatureDoesNotMatch. No broken media links are being presented as proof. The inspected MP4 is retained for delivery/manual attachment.

Comparison SHA-256: 82c15bcc978e969a62f927035569c9e844098bf96c94e4e8cbd4c0b2ad487ffd.


Real Control UI verification

Verified on 0df85c0d6360b72692a8b3e06ba3dd29a942047f using the actual source Control UI in Chromium and a real isolated Gateway. No Gateway WebSocket or permission responses were mocked.

Check Observed result
Live write-only connection hello-ok.auth.scopes was exactly operator.read, operator.write — no operator.admin.
Thinking control Changed Low → High through the real UI; Gateway accepted and stored the change.
Fast-mode control Enabled through the real UI on a supported OpenAI Responses request profile; Gateway stored fastMode: true.
Reload High and Fast remained selected in the same session; session identity was unchanged.
Execution permissions permissionMode stayed guarded throughout the successful preference writes.
Privileged mixed patches thinkingLevel + verboseLevel, fastMode + permissionMode: full, and contextWindow: null were each rejected with FORBIDDEN: missing scope: operator.admin on the same write-only connection.
Read-only connection Live scopes were exactly operator.read; model and effort controls remained disabled.

The fixture used synthetic transcript/model labels and isolated credentials. No model inference was started (chat.send count: 0). The Gateway, browser, and fixture state were cleaned up after capture; production sessions were not touched.

Recording / publication status

A 28.2-second, 1280×800 H.264 recording was captured and visually inspected, including its full timeline, the High/Fast result, reload persistence, and the read-only state.

Media attachment is blocked by the verification host’s upload path, not by the fix:

  • GitHub user-attachment uploads return HTTP 400 Bad Content-Length, including a retry with an explicit length and binary content type.
  • The documented Crabbox artifact fallback returns HTTP 403 SignatureDoesNotMatch; its reported canonical request has an empty content-length field.
  • No unverified or broken media links are included here. The recording is retained and supplied in the requesting conversation.

Video SHA-256: ec7ad8b4d05660aaeb0a689ce5abc78e68bafc643a4ebd3263587548dfcfecca.

This verifies session-preference controls and authorization boundaries, not active-inference switching or overall CI status.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 13, 2026
…penclaw#146343)

* fix: allow session thinking and fast-mode changes with write access

Keep context-window and other privileged overrides admin-scoped while aligning ordinary model, thinking, and fast-mode controls. Cover existing-session persistence, resets, and rendered permission boundaries.

Co-authored-by: VACInc <[email protected]>

* test: isolate session setting permission regressions

Keep the existing organization and composer test files within the lint limit without suppressions; retain the real Gateway and rendered-control regression coverage.

Co-authored-by: VACInc <[email protected]>

---------

Co-authored-by: roboclaw-bot <[email protected]>
Co-authored-by: VACInc <[email protected]>
@VACInc

VACInc commented Sep 13, 2026

Copy link
Copy Markdown
Member

Follow-up to the upload blocker documented here: #144902 has merged the protected-egress fixed-length framing correction. This is separate from this PR's session thinking/Fast Mode permission changes. The transport fix does not itself attach the recording, prove GitHub attachment acceptance, or establish that the running Gateway has been updated.

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 P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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.

2 participants