Repository navigation
feat: limit model use by operator role - #156346
Merged
Merged
Conversation
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Contributor
|
Contributor
Author
|
@clawsweeper review |
Contributor
|
🦞👀 Re-review progress:
|
Contributor
Author
|
Added: optional operator-role model policies that follow model selection, accepted work, and model tools through execution and cleanup. |
This was referenced Sep 23, 2026
steipete
added a commit
that referenced
this pull request
Sep 23, 2026
…d-reasoning tests green (#156565) Operator authority currency no longer folds the caller's own abort signal into assertCurrent, so a caller-aborted direct completion settles through the provider result again instead of rejecting after the stream ended (regressed in #156346). The isolated reasoning validation fixture uses max, which stays unsupported for the host-resolved model now that Ultra is a harness mode on every runtime (#155393). Co-authored-by: Peter Steinberger <[email protected]>
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Sep 24, 2026
Add optional role-based model limits across Gateway selection, accepted execution, and model-consuming tools, preserving original and current permissions through cancellation and cleanup. Refs openclaw#154893.
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Sep 24, 2026
…d-reasoning tests green (openclaw#156565) Operator authority currency no longer folds the caller's own abort signal into assertCurrent, so a caller-aborted direct completion settles through the provider result again instead of rejecting after the stream ended (regressed in openclaw#156346). The isolated reasoning validation fixture uses max, which stays unsupported for the host-resolved model now that Ultra is a harness mode on every runtime (openclaw#155393). Co-authored-by: Peter Steinberger <[email protected]>
2 of 8 tasks
This was referenced Oct 8, 2026
This was referenced Oct 17, 2026
This was referenced Oct 25, 2026
This was referenced Oct 30, 2026
This was referenced Nov 16, 2026
obviyus
added a commit
that referenced
this pull request
Nov 28, 2026
…07247) ## What problem this solves `docs/gateway/operator-scopes.md` says that "bounded automatic metadata" keeps Gateway service authority, but does not say what that covers. #207070 bound progress narration to the turn's operator role and session observer digests to the session owner's role, so the sentence now reads as if those still bypass the role `modelPolicy`. Operators who restrict utility models cannot tell from the docs which automatic model calls their roles control. ## Change Docs only. Replace the undefined term with the consumers and the authority each uses: - Progress narration: the turn's role. Execution skips refused utility models; a role that refuses every utility model gets no narration. - Session observer digests: the session owner's role, resolved once when a run's observation starts. A refusing owner role turns observation off for that run. Deleted owner profiles and sessions without an owner are observed on service authority. - Automatically generated session and thread titles, inbound media preprocessing and host-owned execution approval keep service authority (unchanged; chat-send dashboard titles and channel thread titles pass no operator authority). ## Security note Before #207070, progress narration and session observer digests ran the utility model even when the role's `modelPolicy` refused it (since #156346, 2026-09-23). The refused model ran on the Gateway's credentials and its short text was shown; main turns, tools and data access were not affected. #207070 fixed it on main. Backports are prepared for the active extended-stable line (narration) and the next stable (the #206962 + #207070 pair). ## Evidence - Text checked against `src/auto-reply/reply/progress-narrator.ts`, `src/gateway/session-observer-completion.ts` and `src/gateway/server-methods/chat-send-background.ts` on main. - `oxfmt --check`, `check-docs-mdx`, `docs:check-links` (0 broken), `git diff --check`: clean. - Local review: patch is correct, 0 findings. Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Nov 29, 2026
…enclaw#207247) ## What problem this solves `docs/gateway/operator-scopes.md` says that "bounded automatic metadata" keeps Gateway service authority, but does not say what that covers. openclaw#207070 bound progress narration to the turn's operator role and session observer digests to the session owner's role, so the sentence now reads as if those still bypass the role `modelPolicy`. Operators who restrict utility models cannot tell from the docs which automatic model calls their roles control. ## Change Docs only. Replace the undefined term with the consumers and the authority each uses: - Progress narration: the turn's role. Execution skips refused utility models; a role that refuses every utility model gets no narration. - Session observer digests: the session owner's role, resolved once when a run's observation starts. A refusing owner role turns observation off for that run. Deleted owner profiles and sessions without an owner are observed on service authority. - Automatically generated session and thread titles, inbound media preprocessing and host-owned execution approval keep service authority (unchanged; chat-send dashboard titles and channel thread titles pass no operator authority). ## Security note Before openclaw#207070, progress narration and session observer digests ran the utility model even when the role's `modelPolicy` refused it (since openclaw#156346, 2026-09-23). The refused model ran on the Gateway's credentials and its short text was shown; main turns, tools and data access were not affected. openclaw#207070 fixed it on main. Backports are prepared for the active extended-stable line (narration) and the next stable (the openclaw#206962 + openclaw#207070 pair). ## Evidence - Text checked against `src/auto-reply/reply/progress-narrator.ts`, `src/gateway/session-observer-completion.ts` and `src/gateway/server-methods/chat-send-background.ts` on main. - `oxfmt --check`, `check-docs-mdx`, `docs:check-links` (0 broken), `git diff --check`: clean. - Local review: patch is correct, 0 findings. Co-authored-by: Ayaan Zaidi <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
Shared Gateways can restrict which agents and operations a named role may use, but they cannot give that role a model ceiling that follows its accepted work. A role that should use an administrator's primary and fallback models can otherwise select a different model through session controls, retry paths, or auxiliary model tools.
This contribution introduces an optional model policy for named operator roles and carries it through the host and embedded execution paths. Related: #154893, which retains the native Codex integration and Visitor Access activation work.
User Impact
Administrators can set
gateway.roles.definitions.<name>.modelPolicyto follow a source agent's configured primary and fallbacks, replace that membership withallow, and exclude resolved models or trailing family patterns withdeny. Omitting the policy preserves existing model access. Unrestricted staff and shared-secret System behavior remain unchanged.Accepted work must satisfy its original model ceiling and the current policy. With configuration reload enabled, model-only edits take effect on commit without reconnecting clients. Removing a model cancels its active requests while permitted sibling work remains active. Session selection, defaults, fallbacks, titles, decisions, image/PDF analysis, and plugin completion use the same ceiling.
Interactive plugin runtimes without exact model-policy support reject restricted attempts before starting, whether credentials are host-owned or native-owned. Adding a policy also cancels their previously unrestricted foreground and retained work. Codex interactive support is intentionally pending the separate native integration; the built-in runtime is available for these restricted attempts. Isolated prompt-only completion retains its existing exact-route, empty-tool contract and selected-model binding. This change does not require a policy on existing Visitor Access configurations or activate a live Gateway.
Why This Change Was Made
The Gateway issues the original operator source, so it owns the original/current policy intersection and notifications. Execution owners bind the actual selected model through dispatch and cleanup; callers do not reconstruct permission from model names or credential ownership. Same-source coalescing retains the original authority, and session writes revalidate their selection at the commit boundary.
The shared evaluator derives model choices from existing agent configuration and resolves aliases before exclusions. Automatic fallbacks filter their candidate chain before provider preparation. An empty permitted set produces an explicit error instead of widening access. Unsupported native execution is bound as an unknown model until a runtime implements the exact enforcement contract.
Evidence
The remote regression run exercised the actual registered harness entry point and retained-source capability. Before the repairs, five cases failed: fresh and host-auth restricted attempts executed, policy introduction did not cancel either foreground path, and retained work remained active. Fifteen controls passed, including ordinary no-policy behavior and native admission.
The corrected suites pass all 44 cases: 10 image-tool cases, 9 PDF-tool cases, 15 harness admission/finalization cases, and 10 retained-source cases. Direct and admitted tool callers both enforce denial, permitted fallback, and requester retirement, with source holds released after cleanup. The direct-media cases fail against the previous callers (five failures), then pass with the repair.
Independent review is complete with no unresolved actionable findings. Earlier source-bound proof covers role compilation, original/current intersection, registered Gateway dispatch, reload, coalescing, and the common execution consumers. The full remote package build, type-aware lint, production and affected test types, extension production/test types, config documentation, SDK exports/surface, and import-cycle checks passed. Hosted CI passed on
a39c80e7554, including the corrected UI performance gate.Standalone remote measurements use
pnpm test <file> --maxWorkers=1:image-tool.runtime-abort.test.tspdf-tool.runtime-abort.test.tshost-model-execution.test.tshost-capability.source-lifetime.test.tsStandalone wall time includes worker-artifact preparation and imports. These cases exercise the registered harness or real tool/capability boundary, where a helper-only test would miss the original failure. The role-parser correction also passes 44 schema cases (17.10 s standalone), 4 policy and 57 UI display cases (16.78 s combined), and 732 strict/role grammar comparisons. It restores the existing strict parser used by UI startup while keeping role prefix support in a separate export at the same owner. On the same fixed build identity, the untouched base measured 371,276 gzip bytes, the original integrated candidate measured 371,367 bytes, and the corrected candidate returned to 371,276 bytes, below the unchanged 371,332-byte limit. CI execution timings for the changed test files are recorded below.
Retained timing measurements for the existing policy tests
These are historical single-file command wall times using
pnpm test <path> --maxWorkers=1, retained on matching test bytes. They include startup and cleanup and describe whole-suite cost, not the marginal cost added by this change or fresh execution of the current head. Slower Gateway/session cases exercise registered or persistent lifecycle boundaries that a helper-only assertion would bypass. Do not sum these measurements into CI duration.src/acp/control-plane/manager.operator-model-policy.test.tssrc/agents/cli-runner.operator-model-policy.test.tssrc/agents/cli-runner/prepare.model-routing-authority.test.tssrc/agents/command/model-selection.configured.test.tssrc/agents/embedded-agent-runner/run-orchestrator.cleanup-resources.test.tssrc/agents/isolated-completion.operator-model-policy.test.tssrc/agents/model-fallback-image.operator-model-policy.test.tssrc/agents/model-fallback.operator-model-policy.test.tssrc/auto-reply/reply/conversation-label-generator.test.tssrc/auto-reply/reply/directive-handling.model-selection.test.tssrc/auto-reply/reply/get-reply-run-admission.session-file.test.tssrc/auto-reply/reply/model-selection.resolved-pin.test.tssrc/decisions/runtime.test.tssrc/gateway/chat-auth-readiness.integration.test.tssrc/gateway/operator-role-policy.test.tssrc/gateway/server-methods/sessions-title.test.tssrc/gateway/server-plugin-subagent-runtime.test.tssrc/gateway/server-reload-handlers.operator-model-policy.test.tssrc/gateway/server.sessions.create.resolved-model.test.tssrc/gateway/server/ws-connection/authenticated-request-dispatch.mutation-authority.test.tssrc/gateway/session-companion-rpc.test.tssrc/gateway/session-companion-runtime.test.tssrc/gateway/sessions-patch.operator-model-policy.test.tssrc/model-picker/apply-session-model-selection-placement.test.tssrc/model-picker/apply-session-model-selection.operator-context.test.tssrc/plugins/runtime/runtime-llm.operator-model-policy.test.tsAdditional retained measurements have narrower timing limits:
src/gateway/config-reload-plan.test.ts: 46 cases, 15.140 s wrapper wall (16.466 s including source verification).src/model-picker/apply-session-model-selection.test.ts: 43 cases, 25.080 s wrapper wall (26.426 s including source verification).src/agents/operator-model-policy.test.ts: 22.109 s combined with device-revocation coverage; 12 cases total, 4 belonging to the policy file. The current policy/UI sibling replay above supplies additional validation.src/agents/openclaw-tools.session-status.model-policy.test.ts: 73.160 s combined with native-hook admission coverage; 13 cases total, one belonging to session status. Its assertion time was 5.680 s, not standalone wall time.src/agents/harness/selection.test.ts: historical 161-case run in 41.680 s. Later main changes updated Agents API expectations, so this is a cost reference rather than an exact-current-source measurement.Current-head CI test execution costs
These are summed case execution seconds from the passing Linux Node shard logs in the linked CI run. They exclude worker preparation, imports, and cleanup; the standalone wall measurements above include those costs. They are not additive CI job durations.
src/acp/control-plane/manager.operator-model-policy.test.tssrc/agents/cli-runner.operator-model-policy.test.tssrc/agents/cli-runner/prepare.model-routing-authority.test.tssrc/agents/command/model-selection.configured.test.tssrc/agents/embedded-agent-runner/run-orchestrator.cleanup-resources.test.tssrc/agents/harness/host-capability.source-lifetime.test.tssrc/agents/harness/host-model-execution.test.tssrc/agents/harness/selection.test.tssrc/agents/isolated-completion.operator-model-policy.test.tssrc/agents/model-fallback-image.operator-model-policy.test.tssrc/agents/model-fallback.operator-model-policy.test.tssrc/agents/openclaw-tools.session-status.model-policy.test.tssrc/agents/operator-model-policy.test.tssrc/agents/tools/image-tool.runtime-abort.test.tssrc/agents/tools/pdf-tool.runtime-abort.test.tssrc/auto-reply/reply/conversation-label-generator.test.tssrc/auto-reply/reply/directive-handling.model-selection.test.tssrc/auto-reply/reply/get-reply-run-admission.session-file.test.tssrc/auto-reply/reply/model-selection.resolved-pin.test.tssrc/config/zod-schema.gateway-auth.test.tssrc/decisions/runtime.test.tssrc/gateway/chat-auth-readiness.integration.test.tssrc/gateway/config-reload-plan.test.tssrc/gateway/operator-role-policy.test.tssrc/gateway/server-methods/sessions-title.test.tssrc/gateway/server-plugin-subagent-runtime.test.tssrc/gateway/server-reload-handlers.operator-model-policy.test.tssrc/gateway/server.sessions.create.resolved-model.test.tssrc/gateway/server/ws-connection/authenticated-request-dispatch.mutation-authority.test.tssrc/gateway/session-companion-rpc.test.tssrc/gateway/session-companion-runtime.test.tssrc/gateway/sessions-patch.operator-model-policy.test.tssrc/model-picker/apply-session-model-selection-placement.test.tssrc/model-picker/apply-session-model-selection.operator-context.test.tssrc/model-picker/apply-session-model-selection.test.tssrc/plugins/runtime/runtime-llm.operator-model-policy.test.ts