Repository navigation
fix(agents): resolve utility models against the session owner's role - #206962
Conversation
Activity recaps picked their utility model without the session owner's role, so a role that refuses every utility model failed each recap and retried it on every activity. The utility selection owner now takes the role policy and returns a model or a disabled reason (config, role-policy, not-offered). A role refusal never falls back to the main model; the recap authority reports it and the recap publishes unavailable with no attempt and no retry. Config validation warns on the refusing role. Drops the branch that returned a declared model already known to be unoffered.
… catalog Config validation now asks the utility model decision for role warnings, and importing the runtime published catalog from there closed an import cycle through config/config.ts. The decision moves unchanged to utility-model-selection.ts and takes the inventory as a lazy input; utility-model.ts keeps the catalog read and its API. The recap gate now runs only for model work, after the current check, and reports only role refusals.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
The model-selection barrel pulled the plugin runtime into config validation's import graph (madge cycle). The decision module now imports the same functions from model-selection-config and model-selection-shared, as the warnings did.
|
Codex review: needs changes before merge. What this changesThis PR checks the session owner's model policy before generating Activity recaps and reports when that policy disables utility work. Example: An agent uses test/main for chat and test/utility for recaps, while the session owner's role allows only test/main.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 3 items remain Keep open: this maintainer-authored PR addresses a concrete recap failure, but its new imports break PR provisioning and the architecture gate, and its fallback documentation needs updating. Reviewed head: Before merge
Findings
Agent review detailsHow this fits togetherThe Gateway recap service reads session excerpts, obtains the owner's admitted authority, and uses shared utility selection and completion to generate cached recap text. flowchart TD
A[Session activity] --> B[Gateway recap service]
B --> C[Session owner authority]
C --> D[Shared utility selection]
E[Config and published inventory] --> D
D --> F[Unavailable state or completion]
F --> G[Cached Activity recap]
Technical reviewBest possible solution: Keep selection and recap admission with their existing owners, use narrow config-safe imports, preserve wrapper dependency closure, and document the accepted fallback changes. Do we have a high-confidence way to reproduce the issue? Current-main recap selection omits the owner's policy, while utility execution enforces it and the catch path records failure; the supplied production refusal log matches this source path, but no product reproduction was run during this read-only review. Is this the best way to solve the issue? Checking the prepared owner's policy before completion addresses the reported repeated refusal without new state, and the module extraction has a valid config-import purpose, but its broad dependency and extraction inventory must be repaired. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4849bb76ca96. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +183, Tests +114. Total +297 across 11 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 27, 2026, 4:32 PM ET / 21:32 UTC. |
… role refuses With nothing offered, no utility model is selected: narration and Activity recaps pause and other utility tasks use the primary. A session owner's role that refuses every utility candidate pauses that owner's recaps instead of using the primary; config validate, status and Doctor name the role.
Config validation's utility warning now reaches utility-model-selection, operator-model-policy and model-selection-resolve, so the PR wrapper's extracted inventory must include them.
…onical id Prepared role policies match canonical model identities, but the declared utility model was checked by its raw id, so a manifest alias made an allowed model look refused. With a role policy, the declared id now resolves through the same normalizer as configured fallbacks; an unresolvable id is not refused.
…207070) ## What problem this solves Follow-up to #206962 (Activity recaps vs operator role model policy). The same role refusal reaches four other utility consumers, and the recap still retried its other owner refusals. Real-user log signature (a production team Gateway; 331 on 2026-11-27): ``` [activity-summary] Activity recap deferred error: Your operator role cannot use this model. … ``` The Gateway's default role allows only main-chat models, so every utility model is refused for its sessions. - **Progress narration** ignored the turn's role and ran the refused utility model (policy bypass). - **The session observer** had no role check at all and ran the utility model for every session (bypass). - **Titles** tried the refused utility model first, logged a false "Conversation label generation failed" warning, then made the regular-model pass. - **The recap** turned "operator profile unavailable" and "role cannot access this agent" into a 120 s retry, re-run on every later activity. ## Change `resolveUtilityModelSelectionForAgent` stays the one owner; each consumer now asks it with the relevant role: - **Narrator:** uses the turn's `operatorAuthority`. A refusing role attaches no narrator. The narration completion carries the authority, so execution skips refused candidates in a partly allowed chain. - **Observer:** - Resolves the session owner's role once per run through the recap's existing session-owner authority. The digest is persisted and shown to every viewer, so the owner's role applies. - An owner role that excludes the agent or refuses every utility model turns the run's observation off quietly: no degradation notice, no retry. A session whose owner profile was deleted still gets observation. - The authority reaches the completion. - **Titles** (dashboard and channel thread): a refusing role makes no utility attempt and no warning. The documented regular-model title pass still runs; that is the session's own permitted model. - **Recap:** - The authority returns a typed refusal instead of throwing. - A refusal ("profile gone", "role excludes the agent", "role refuses every utility model") publishes `unavailable` with no model call, no retry and no log line. The next activity asks again; a config or role change applies there with no extra state. - A role-changed read race keeps its existing retry. - **Status and Doctor:** - When the Gateway substituted the agent's primary because no utility model is offered, `openclaw models status` shows `<model> (utility model not offered; using main model)`. A provider whose declared small model is the primary shows no note. - `openclaw doctor` reports the same line as an info finding. - No wire change. ## Not changed - **Side chat:** it already makes no refused attempt. When the role refuses the utility route, it answers with the role's first permitted model, so a user's question is never refused. - **Nothing offered at all** (`not-offered` with no listed primary): behavior unchanged from main. ## User population - **Gateway:** multi-user Gateways whose operator roles refuse the utility models. Affected surfaces: narration in replies (`get-reply.ts` → `progress-narrator.ts`), observer digests (`session-observer.ts`), dashboard and thread titles, and Activity recaps. - **Gateway and CLI:** `openclaw models status` and `openclaw doctor` users whose automatic utility routing falls back to the primary. ## Evidence | Consumer | Main | This PR | |---|---|---| | Narrator, role allows only the main model | narrator attached; runs the refused utility model | options returned unchanged; no narration attempt | | Observer, owner's role refuses the utility model | completion runs the utility model, no authority | refusal; 0 completions; the allowed case passes the owner's authority | | Thread title, role allows only the main model | false "Conversation label generation failed" warning, then the main model | no warning; one completion on the main model | | Recap, owner profile gone / role excludes the agent, 4 activity rounds 130 s apart | 120 s retry armed each round | 0 attempts, 0 retries; a committed config change lifts it on the next activity | | Status, Gateway substituted the primary | `<model> (provider default)` | `<model> (utility model not offered; using main model)` | | Status, provider's declared small model is the primary | - | `<model> (provider default)`; no note | | Doctor, Gateway substituted the primary | - | info finding "utility model not offered; using main model" | ### Real CLI on an isolated Gateway Each scenario runs its own Gateway (loopback port, empty `HOME` and state directory, `env -i`; no other OpenClaw state). The provider is a local fixture plugin, `w9-fixture`. Its manifest declares `defaultUtilityModel: "small"`, and its catalog `run` returns a `ready` outcome listing exactly the configured ids. `plugins.allow` holds only the fixture, so the published inventory is authoritative, as on a Gateway whose providers are all signed in. Base is this PR's merge base on `main` (`501ee911`); head is `ab1120a`. Same commands on both sides. **(a) Utility model not offered.** Primary `w9-fixture/main`; the listing has only `main`. The Gateway publishes `{"modelRef":"w9-fixture/main","source":"provider-default"}` on both sides. ```text # base: openclaw models status Utility model : w9-fixture/main (provider default) # base: openclaw doctor --lint --severity-min info --only core/doctor/model-references (no findings) # head: openclaw models status Utility model : w9-fixture/main (utility model not offered; using main model) # head: openclaw doctor --lint --severity-min info --only core/doctor/model-references {"severity":"info","message":"utility model not offered; using main model","fixHint":"Configure agents.defaults.utilityModel with a model the catalog lists, or leave it unset to keep using the main model."} ``` **(b) The provider's declared small model is the primary.** Primary `w9-fixture/small`; the listing has `small` and `main`. Both sides print the same, with no note: ```text # base and head: openclaw models status Utility model : w9-fixture/small (provider default) # base and head: openclaw doctor --lint --severity-min info --only core/doctor/model-references (no findings) ``` An earlier head printed the note here from `doctor` only: Doctor has no current plugin metadata snapshot, so the declared model was invisible. `isUtilityModelNotOffered` now loads the manifests itself (`ab1120a`). **(c) A role-policy refusal.** Primary `w9-fixture/main`; the listing has `main` and `small`. The default role `guest` allows only `w9-fixture/main`. The CLI connects as the token operator, so `models status` shows the agent's own selection (`w9-fixture/small (provider default)`) on both sides; a refused selection is not disclosed to a guest reader. The refusal and its reason come from config validation, identically on base and head: ```text # base and head: openclaw doctor [config] warnings: gateway.roles.definitions.guest.modelPolicy: Role "guest" allows no utility model for agent "main", so Activity recaps are off for sessions this role owns. Allow a utility model in this role's modelPolicy, or set a utilityModel the role allows. ``` Red on main (`501ee911`), green here: the recap "profile gone" and "role excludes the agent" cases (the retry was re-armed each round, with `Activity recap deferred` logged), and the title "no utility attempt or warning" case. The status and Doctor note is new; its tests cover the published wire shape and the declared-model false positive. Checks on `ab1120adad`: touched suites green; `tsgo` core and test shards clean; oxlint, line-cap, session-identity and permission-read boundary checks clean; CI green. Local review: patch is correct, 0 findings. Size: production about +200 lines; `list.status-command.ts` net −10 (the status field text moved to `list.status-utility.ts`). Co-authored-by: Ayaan Zaidi <[email protected]>
…penclaw#206962) ## What problem this solves Activity recaps for sessions owned by a role that refuses every utility model fail every time, and the failure repeats on every new activity. Real-user log signature (a production team Gateway; 331 on 2026-11-27): ``` [activity-summary] Activity recap deferred error: Your operator role cannot use this model. Choose an allowed model or ask a gateway administrator to update your role's model policy. retryScheduled: false ``` - The Gateway's default role allows only main-chat models. The utility chain (`gpt-6-luna` → `gpt-5.6-luna`) has no model that role may use. - The recap picked its model without the session owner's role. The fallback runner then refused every candidate, and the recap treated the refusal as a failure: `unavailable` plus a 120 s retry, re-run on every later activity, with no reason shown anywhere. ## Change `resolveUtilityModelSelectionForAgent` is the one owner of utility model choice. It now takes the session owner's role policy and returns either a model or `{ disabled: "config" | "role-policy" | "not-offered" }`. - **Role refusal disables.** Every utility candidate (declared, fallbacks, explicit chain) is checked against the role before inventory. A refusal never falls back to the main model: the operator restricted that role, so spending the main model would override them. The answer does not depend on catalog publication timing. - **Absence still recovers.** When the small model is simply not offered and no role refused it, the existing offered-primary fallback stays. - **Deleted:** the branch that returned the declared model already known to be unoffered (`utility-model.ts`, old 256-258). With nothing offered (neither the small model nor the primary listed), utility routing is now `not-offered`: narration is off, recaps are `unavailable`, and optional utility callers use the agent's main model through simple completion. Before, they got a guaranteed missing-model failure at execution. - **Recap:** the recap's authority owner (`session-activity-summary-authority.ts`) already resolves the session owner's role in `prepare()`. It now also reports whether that role refuses every utility model. A run with model work checks this after the "already current" check and before it publishes `updating` or arms its timer. On refusal it publishes `unavailable` with no model attempt and no retry. Execution's fallback runner still picks the allowed model from the run's chain, so there is one model resolution per run. - The recap's static system prompt moved, unchanged, to `session-activity-summary-prompt.ts`. That keeps the service under its line cap. - **The selection decision moved, unchanged, to `src/agents/utility-model-selection.ts`.** It takes the published inventory as a lazy input, so config validation can ask it without importing the runtime catalog. That would otherwise create an import cycle through `config/config.ts`. `utility-model.ts` keeps the catalog read and its exported API. - **Visible reason, no wire change:** config validation warns at `gateway.roles.definitions.<role>.modelPolicy` when a role allows no utility model for an agent it can use. `openclaw config validate`, `openclaw status` and `openclaw doctor` all show it. - **Docs:** `docs/concepts/models.md` now describes both outcomes. When nothing is offered, narration and recaps pause and other utility tasks use the primary. A refusing role pauses that owner's recaps. - `resolveUtilityModelRefForAgent` no longer accepts a role policy: a bare ref drops the reason, and simple completion would turn `undefined` back into the main model. ## User population - **Gateway** users on multi-user Gateways with operator roles whose `modelPolicy` excludes the utility models: Activity recaps (`session-activity-summaries.ts`). - **Gateway and one-shot** users with nothing offered for automatic utility routing: utility routing is now off (`not-offered`) instead of sending a request to a model the catalog already reported missing (`utility-model.ts`). ## Not changed (follow-ups) - **Titles, companion, observer and narrator still resolve without the role.** - **A queued recap with no summary yet still shows `updating` before `unavailable`** (`schedule()` can't know the role synchronously, and remembering the refusal would be new state). - **The recap catch block still retries other authority refusals** (operator profile unavailable or role changed). - **The gate re-resolves on each view of a refused session** (cheap, no model call), and one explicit-chain case still reaches the runner's refusal: one ref unparseable and the rest refused. - **One previously working config now has no recaps:** the role refuses the provider's declared small model, the catalog lacks it, and the role allows the main model. On main that ran on the main model; this PR treats it as the role's refusal. - **`not-offered` is not shown in `models status`**: that needs a new wire value. ## Evidence | Proof | Main | This PR | |---|---|---| | Recap regression (`session-activity-summaries.retry.test.ts`): role allows only the main model, 4 activity rounds 130 s apart on a fake scheduler clock | model attempts on every round | 0 attempts, `unavailable`, 0 armed wakes | | Utility selection: role refuses the small model, with and without it in the catalog | n/a (no role input) | `role-policy` both ways; a permissive role with the small model missing still gets the offered primary | | Config validation, explicit and automatic utility routing | no warning | one warning on the refusing role's `modelPolicy` | | Real CLI, scratch config in the incident's shape: main `openai/gpt-6.2-sol`, automatic utility, default role `guest` allowing only the main model (base `d498faee` vs head, dist builds) | `config validate`: valid, no warning | `config validate`, `status` (Utility model row) and `doctor` (`[config] warnings`) name `Role "guest"` | Suites: `utility-model`, `config.utility-model-warnings`, `session-activity-summaries`, `session-activity-summaries.retry`, `list.status`, `dashboard-session-title`, `session-observer-stdout`, `session-row-transcript-backfill`, `models-list-result.configured-static`. Co-authored-by: Ayaan Zaidi <[email protected]>
…penclaw#207070) ## What problem this solves Follow-up to openclaw#206962 (Activity recaps vs operator role model policy). The same role refusal reaches four other utility consumers, and the recap still retried its other owner refusals. Real-user log signature (a production team Gateway; 331 on 2026-11-27): ``` [activity-summary] Activity recap deferred error: Your operator role cannot use this model. … ``` The Gateway's default role allows only main-chat models, so every utility model is refused for its sessions. - **Progress narration** ignored the turn's role and ran the refused utility model (policy bypass). - **The session observer** had no role check at all and ran the utility model for every session (bypass). - **Titles** tried the refused utility model first, logged a false "Conversation label generation failed" warning, then made the regular-model pass. - **The recap** turned "operator profile unavailable" and "role cannot access this agent" into a 120 s retry, re-run on every later activity. ## Change `resolveUtilityModelSelectionForAgent` stays the one owner; each consumer now asks it with the relevant role: - **Narrator:** uses the turn's `operatorAuthority`. A refusing role attaches no narrator. The narration completion carries the authority, so execution skips refused candidates in a partly allowed chain. - **Observer:** - Resolves the session owner's role once per run through the recap's existing session-owner authority. The digest is persisted and shown to every viewer, so the owner's role applies. - An owner role that excludes the agent or refuses every utility model turns the run's observation off quietly: no degradation notice, no retry. A session whose owner profile was deleted still gets observation. - The authority reaches the completion. - **Titles** (dashboard and channel thread): a refusing role makes no utility attempt and no warning. The documented regular-model title pass still runs; that is the session's own permitted model. - **Recap:** - The authority returns a typed refusal instead of throwing. - A refusal ("profile gone", "role excludes the agent", "role refuses every utility model") publishes `unavailable` with no model call, no retry and no log line. The next activity asks again; a config or role change applies there with no extra state. - A role-changed read race keeps its existing retry. - **Status and Doctor:** - When the Gateway substituted the agent's primary because no utility model is offered, `openclaw models status` shows `<model> (utility model not offered; using main model)`. A provider whose declared small model is the primary shows no note. - `openclaw doctor` reports the same line as an info finding. - No wire change. ## Not changed - **Side chat:** it already makes no refused attempt. When the role refuses the utility route, it answers with the role's first permitted model, so a user's question is never refused. - **Nothing offered at all** (`not-offered` with no listed primary): behavior unchanged from main. ## User population - **Gateway:** multi-user Gateways whose operator roles refuse the utility models. Affected surfaces: narration in replies (`get-reply.ts` → `progress-narrator.ts`), observer digests (`session-observer.ts`), dashboard and thread titles, and Activity recaps. - **Gateway and CLI:** `openclaw models status` and `openclaw doctor` users whose automatic utility routing falls back to the primary. ## Evidence | Consumer | Main | This PR | |---|---|---| | Narrator, role allows only the main model | narrator attached; runs the refused utility model | options returned unchanged; no narration attempt | | Observer, owner's role refuses the utility model | completion runs the utility model, no authority | refusal; 0 completions; the allowed case passes the owner's authority | | Thread title, role allows only the main model | false "Conversation label generation failed" warning, then the main model | no warning; one completion on the main model | | Recap, owner profile gone / role excludes the agent, 4 activity rounds 130 s apart | 120 s retry armed each round | 0 attempts, 0 retries; a committed config change lifts it on the next activity | | Status, Gateway substituted the primary | `<model> (provider default)` | `<model> (utility model not offered; using main model)` | | Status, provider's declared small model is the primary | - | `<model> (provider default)`; no note | | Doctor, Gateway substituted the primary | - | info finding "utility model not offered; using main model" | ### Real CLI on an isolated Gateway Each scenario runs its own Gateway (loopback port, empty `HOME` and state directory, `env -i`; no other OpenClaw state). The provider is a local fixture plugin, `w9-fixture`. Its manifest declares `defaultUtilityModel: "small"`, and its catalog `run` returns a `ready` outcome listing exactly the configured ids. `plugins.allow` holds only the fixture, so the published inventory is authoritative, as on a Gateway whose providers are all signed in. Base is this PR's merge base on `main` (`b8a4618d`); head is `ab1120a`. Same commands on both sides. **(a) Utility model not offered.** Primary `w9-fixture/main`; the listing has only `main`. The Gateway publishes `{"modelRef":"w9-fixture/main","source":"provider-default"}` on both sides. ```text # base: openclaw models status Utility model : w9-fixture/main (provider default) # base: openclaw doctor --lint --severity-min info --only core/doctor/model-references (no findings) # head: openclaw models status Utility model : w9-fixture/main (utility model not offered; using main model) # head: openclaw doctor --lint --severity-min info --only core/doctor/model-references {"severity":"info","message":"utility model not offered; using main model","fixHint":"Configure agents.defaults.utilityModel with a model the catalog lists, or leave it unset to keep using the main model."} ``` **(b) The provider's declared small model is the primary.** Primary `w9-fixture/small`; the listing has `small` and `main`. Both sides print the same, with no note: ```text # base and head: openclaw models status Utility model : w9-fixture/small (provider default) # base and head: openclaw doctor --lint --severity-min info --only core/doctor/model-references (no findings) ``` An earlier head printed the note here from `doctor` only: Doctor has no current plugin metadata snapshot, so the declared model was invisible. `isUtilityModelNotOffered` now loads the manifests itself (`ab1120a`). **(c) A role-policy refusal.** Primary `w9-fixture/main`; the listing has `main` and `small`. The default role `guest` allows only `w9-fixture/main`. The CLI connects as the token operator, so `models status` shows the agent's own selection (`w9-fixture/small (provider default)`) on both sides; a refused selection is not disclosed to a guest reader. The refusal and its reason come from config validation, identically on base and head: ```text # base and head: openclaw doctor [config] warnings: gateway.roles.definitions.guest.modelPolicy: Role "guest" allows no utility model for agent "main", so Activity recaps are off for sessions this role owns. Allow a utility model in this role's modelPolicy, or set a utilityModel the role allows. ``` Red on main (`b8a4618d`), green here: the recap "profile gone" and "role excludes the agent" cases (the retry was re-armed each round, with `Activity recap deferred` logged), and the title "no utility attempt or warning" case. The status and Doctor note is new; its tests cover the published wire shape and the declared-model false positive. Checks on `ab1120adad`: touched suites green; `tsgo` core and test shards clean; oxlint, line-cap, session-identity and permission-read boundary checks clean; CI green. Local review: patch is correct, 0 findings. Size: production about +200 lines; `list.status-command.ts` net −10 (the status field text moved to `list.status-utility.ts`). Co-authored-by: Ayaan Zaidi <[email protected]>
…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]>
Progress narration ran the utility model without the turn's operator authority, so a role whose modelPolicy refuses that model still ran it on the Gateway's credentials and showed its status text. Narration now carries the turn's admitted authority into the isolated completion, and a role that refuses the prepared utility model gets no narration attempt and no log line, the same path as a missing utility model. The user sees the raw tool lines instead of narrated status. To get narration back, allow a utility model in the role's modelPolicy. (backport of the narration part of 6d8d1f5, #207070) Release adaptation: branch-local narration fix. The main commit depends on #206962 (a72dcc9), the role-aware utility selection, which does not exist on this line. The check uses the turn's prepared modelPolicy with the provider that runIsolatedCompletion authorizes, so it matches the execution check. Excluded: the session observer, titles, Activity recap retries and the models status/doctor notes. On this line Activity recaps and observer digests run on Gateway service authority by design (no session-owner authority exists here), so they still run the utility model for sessions of a refusing role. Follow-ups on main: none (git log --grep '#207070' at 37511ae).
…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]>
## Class: foreign updater records must not grant admission Instances: #203486, #205736, #203917, and the modern release route refusing an old unfinished recovery. The release preparation owner now takes its existing lock, checks the installation and physical restore guard, then records other unfinished runs as `failed: interrupted` and continues. It preserves its current run and the serving trial's handed-over run. The bounded drain reads current rows, not an enclosing Doctor snapshot. In modern release preparation, the two recovery refusals remain: a positively live in-place lease holder, and `.openclaw-restore-*` that may contain the original state. Current modern locks/trials and normal preflight still apply. ## What disappears - The 808-line interrupted plugin-cohort settlement owner, its run/finalize/repair discovery and replay paths, and obsolete killed-driver/death-proof suites. - Foreign saved-row permission for plugin peer links, snapshot collection, interruption/reconciliation and terminal capture. Foreign cohort rows remain unchanged; another update does not replay their rollback. - The critical-path retained-runtime census and its timeout branches. Existing owned-release path collection runs after ready; Doctor retains its separate old-runtime cleanup. - Current mutation and Gateway completion read only their named pair. Main's existing all-row admission reader is retained only by the shipped package-finalization bridge, as the accepted fallback below. Current source/executor/lifecycle/transaction/finalizer checks remain. Explicit repeated repair uses its existing abandonment and exclusive-ownership checks, not a foreign stored-recovery veto; it does not replay the saved cohort. Snapshot collection defers only inside this operation's existing live publication capture, preserving its rollback bytes without consulting foreign records. The shipped `finishInterruptedUpdate` export keeps its real staged finalization, pinned as a source build entry because the compatibility inventory names it. No new state, flag, timer, death proof, schema/stored shape, or launcher/Gateway protocol change. Doctor-compatible reads remain for legitimate current cross-build bookkeeping, not foreign admission. **Accepted legacy edge:** package-only finalization retains main's `recoveryAdmission` worker, coherent facts and assertion on its selected service/history roots. The schema-refusal/copy-cost cleanup is not redesigned here. Ordinary readiness guards keep their original no-recovery early return; modern release admission remains physical-only. ## Size `tokei` on this PR's 39 runtime source files, excluding tests/support/harnesses and fixtures, against merged main `1e6d3f9bd9ecdbb061908ed30090bcf2fd6d7c2f` (original before-code base: `5c815265d5281c7929ab7483bd4e471e54e5c0ff`): | | Before | After | Net | | --- | ---: | ---: | ---: | | Production code lines | 11,335 | 10,362 | **−973** | | Test/support lines | | | **−2,447** | Tooling routing/inventory and the update implementation contract are updated with the cut; their deletions are not counted as runtime savings. ## Verification - Current head `b4e588ff5f9e35a27faa20232819c7f73e100d4a`, tree `12b76c0debe4b9b4ee2274c3459acce54acc1c3d`, fixes the landing review's lease-permission regression: slot inspection opens through the existing lease-store preparation owner, not direct identity capture. The existing slot table now covers an idle owned `0644` store being repaired to `0600` without refusing admission or changing history. Normal hooks passed; **current-head CI is pending**. Predecessor `63010e7d0af9` completed 87 successful checks with no failures/pending checks, including schema, copy-cost, healthy-caller, type, lint, ratchet and extension-boundary gates ([run](https://github.com/openclaw/openclaw/actions/runs/45952703299)). - Corrected AWS Linux base proof: seven selected contracts, **six meaningful failures and one terminal-history control pass**. A pre-repair repeated-repair comparison selected two positive cases; both failed meaningfully. This supersedes the initial host-only baseline, which is not counted as Linux proof. - AWS `747bd654fa01`: **145 passed, two skipped** across nine files; core/core-test/scripts/tooling types, changed lint/format and dead-export scans passed. AWS `9901b03a6ae4`: **132 passed** across six affected files, including real snapshot rollback and CLI deadline integration; core/core-test types, scoped lint/format and dead-export scans passed. [Final run](https://crabbox.openclaw.ai/portal/runs/run_95deb2b3c2b56df85ff53e839750f5c5). These are qualified source snapshots, not exact `2dfc213fbdc6` proof. - The final local identity ratchet could not resolve the original base object after normal synthetic-source sync; that is a setup gap, not a policy verdict. Current CI owns the ratchet and the later two-root schema repair. Both owned AWS leases were released with exact `stop --wait` receipts; no paid resource remains. - Predecessor `63010e7d0af9` passed the Linux published-to-head [`docker-seed-e2e` / `release-update-survivor` lane](https://github.com/openclaw/openclaw/actions/runs/45952703299/job/140352861920) in 2,615 seconds; healthy/crash/downgrade receipts are artifact 15179778195. Latest-head CI remains the landing gate. The standalone fixture-kit producer remains unsupported unchanged on AWS Linux because it requires Studio/macOS-only ocx cloning; no kit patch, host build, shim or separate paid campaign was used. - Two local review rounds completed. The first review's request to restore foreign cohort settlement is [explicitly rejected](#206295 (comment)) under Ayaan's rule; its concrete repeated-repair case, build reachability and real path-state testing concerns are addressed. The second review's current-operation snapshot-retention finding is fixed through the existing live capture, not a foreign-row permission check. The maintainer reviews only this final delta. - The active-list query now excludes the two protected named rows before its limit; `run.ts` has no ID comparisons and the identity allowlist does not grow. Four CI failures that asserted the deliberately retired foreign-record refusal were removed or migrated while retaining current-operation, service-profile and saved-evidence assertions. - `47d896edda06` passed the two split-root schema cases but added a second snapshot on the common readiness path (`update-command-recovery-cost.test.ts:77`). Per maintainer direction, the move is reverted and main's admission is retained only for package finalization. Both schema assertions and the copy-cost assertion remain unchanged. Current reporting refusal remains; only the retired global-malformed-row policy tail is deleted. Current CI owns the fallback's qualification; earlier AWS snapshots do not prove it. Runner-shutdown ratchets and WebKit apt 403 were infrastructure failures, not product verdicts. - Maintainer landing review and latest-head CI remain required; no worker merge performed. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit 91d4912) Release adaptation: Port the modern release preparation admission boundary only: retain the published package updater’s existing recovery contract, check live in-place custody and restore directories, interrupt only unowned run history, and preserve beta.2 release/runtime cleanup outside that boundary. No schema or row-shape changes. Later same-path commits from the pinned scan (separate behavior unless named as folded/selected below): f84b705 fix: preserve lower-token guidance for unaffordable requests (#201392); dae01a9 fix: keep other agents running when one store is refused (#208364); a20fd1c fix: avoid competing Gateway test boots and cold agent mutation imports (#208203); c9f7a98 fix: keep container Gateway commands from rolling back host updates (#208271); edb6820 fix: let the Gateway restart while boot plugin maintenance is running (#208074); 516166c fix: exit once when gateway run rejects an argument after an update (#208068); 07e96dc fix: restart the Gateway after real plugin repairs (#208207); 13059ef fix: keep the PostgreSQL Doctor preflight test from timing out on module loading (#208225); 50d7708 fix: keep Claude fork compaction out of the parent chat (#208192); bd48ff6 fix: avoid restarting the Gateway for plugin timestamp changes (#208119); 259f71c fix: stop Linux service starts from copying the whole agent database (#207969); 7cb8975 fix: keep forked Claude chats separate after a Gateway crash (#208048); 407b523 fix(slack): thread queued DM replies under the triggering message (#208133); 43b5b52 chore(release): close out 2026.11.11 on main (#208114); 5d5284c fix(ci): add tagged reply control to the PR wrapper inventory (#208120); 1782ab0 fix: keep confirmed sends in the receiving chat's model history (#208049); 6d300d3 fix: restart launcher-managed Gateways after exit 78 (#207972); c4a675f fix: avoid reloading unchanged plugins after Gateway boot (#207949); 13c67a1 fix: let updates back up deeply nested databases (#207756); e2fcd4d fix: acknowledge updates when the Gateway first becomes ready (#207819); 8933edd fix: name safe recovery when agent schema markers disagree (#207705); 19e9dd6 fix(gateway): keep Linux legacy lock recovery explicit (#207340); 3256a47 test(update): move package ownership coverage to preparation (#207581); fbf1aae fix: give safe update ownership guidance and restore legacy result delivery (#207640); a922203 refactor(update): remove native post-activation Doctor subprocess (#207585); 7ac87ad fix: avoid taking service-account ownership during updates (#207563); b3902a2 fix(update): allow in-place updates without a full state copy (#207448); ece7a74 improve(workboard): apply the Control UI glossary and style to Workboard copy; 1c89587 fix: update system service packages without root state changes (#207304); dfd17d0 fix(docker): avoid pre-boot Doctor delays on container recreation (#207200); b616036 refactor(subagents): simplify ACP spawn relay ownership (#207023); 93ca762 improve: reduce allocations when preparing session rows (#207109); adb3716 fix(update): surface boot plugin repair advisories (#207163); f79ef8c fix: finish updates of 2026-11-17 main checkouts automatically on Linux and macOS (#207062); 3c4362b fix(update): preserve exception causes in failure history (#207085); 539f37f perf(gateway): keep legacy lease inspection out of heartbeats (#207084); 7a20389 fix: preserve source ranges in compaction requests (#207045); 20c92a4 fix: converge plugins after every Gateway boot (#206926); 3078862 fix(update): clean up rejected Git update worktrees (#207040); 73cb180 improve: reduce peak memory during Gateway startup update checks (#207073); 9993328 refactor(subagents): simplify kill claim and ownership handling (#207025); 97815bd refactor(subagents): consolidate registry cleanup and publication guards (#207064); 49c5e3e fix: let the end-of-turn recovery request reuse the turn's cached prompt (#207052); e94f799 refactor(subagents): centralize requester turn matching (#206584); e2e0974 fix(doctor): skip the state schema repair when its read-only plan finds nothing (#206694); 15e840e fix(ci): clear stale restart-sentinel exports from the dependency report (#206911); a72dcc9 fix(agents): resolve utility models against the session owner's role (#206962); 8ae0874 improve(gateway): avoid redundant cleanup for empty legacy auth stores (#206867); af1f26c improve: avoid unused proxy runtime in local text replies (#206931); 179e0c4 fix: label conversation data in system updates; ea77ca3 refactor: report update failures from recorded runs (#206700); 18e53d8 fix: finish Linux upgrades after a legacy Gateway crashes (#206530); f0e7d96 fix: preserve large snapshots in trajectory exports (#206810); c7ea9f4 improve: reduce memory used to renew state leases (#206798); 4d7e00b fix: let started participant runs and requests finish after an access change (#206747); dff00f3 fix(mcp): bound unavailable server notices in each turn (#206318); 9845bf5 fix(test): keep readiness abort fixtures alive until stopped (#206660); 844bfbf improve(build): trim unused imports from standalone relays (#170187); d4d45a7 improve: reduce memory when reading saved credentials (#206686); 461f650 fix(ci): keep startup helpers internal (#206649); f89ae43 refactor(subagents): use cleanup and terminal owners in sweeps (#206533); a882e0f fix(agents): preserve task answers when sessions are reused (#126263); 5c5f629 perf(config): keep update inspection out of ordinary config reads (#206607); ccb6d81 fix: finish core updates when the Gateway is ready (#206560); 74f02b4 fix: refuse root updates of a system service that runs as another account (#206343); 01032b1 fix(update): keep acknowledged run IDs when status is unavailable (#206562); cbdd907 fix: finish release updates after a slow launcher response (#206503); ad676f4 improve: reduce memory used by Gateway ownership checks (#206516); 81fc833 refactor(subagents): own dormant child Stop decisions (#206479). Later PR-number mentions: `ccb6d8168658` fix: finish core updates when the Gateway is ready (#206560), `ea77ca3d602c` refactor: report update failures from recorded runs (#206700) Later commit-SHA mentions: `238c6daf2ba6` perf: import llm-core types from their leaf entry (#206518), `ccb6d8168658` fix: finish core updates when the Gateway is ready (#206560) Pinned PR grep: ea77ca3 refactor: report update failures from recorded runs (#206700); ccb6d81 fix: finish core updates when the Gateway is ready (#206560); 91d4912 fix(update): stop using foreign recovery records as admission (#206295); 41afc0f fix(update): keep successful plugin reload warnings advisory (#206372) Co-authored-by: RomneyDa <[email protected]>
Release adaptation: Keep current recap lease and profile checks, return deliberate role refusals without retry, and snapshot only the admitted model restriction for each observer run. Adapt role regression fixtures to the stable admission API. Companion audit: #206962 already committed as the ordered companion. #207774 plugin generation handling is already in stable. #207262 cancellation, #205607 title fallback, and #208460 provider routing are separate existing behaviors; #207247 is follow-up documentation. (cherry picked from commit 6d8d1f5) Co-authored-by: RomneyDa <[email protected]>
What problem this solves
Activity recaps for sessions owned by a role that refuses every utility model fail every time, and the failure repeats on every new activity.
Real-user log signature (a production team Gateway; 331 on 2026-11-27):
gpt-6-luna→gpt-5.6-luna) has no model that role may use.unavailableplus a 120 s retry, re-run on every later activity, with no reason shown anywhere.Change
resolveUtilityModelSelectionForAgentis the one owner of utility model choice. It now takes the session owner's role policy and returns either a model or{ disabled: "config" | "role-policy" | "not-offered" }.utility-model.ts, old 256-258). With nothing offered (neither the small model nor the primary listed), utility routing is nownot-offered: narration is off, recaps areunavailable, and optional utility callers use the agent's main model through simple completion. Before, they got a guaranteed missing-model failure at execution.session-activity-summary-authority.ts) already resolves the session owner's role inprepare(). It now also reports whether that role refuses every utility model. A run with model work checks this after the "already current" check and before it publishesupdatingor arms its timer. On refusal it publishesunavailablewith no model attempt and no retry. Execution's fallback runner still picks the allowed model from the run's chain, so there is one model resolution per run.session-activity-summary-prompt.ts. That keeps the service under its line cap.src/agents/utility-model-selection.ts. It takes the published inventory as a lazy input, so config validation can ask it without importing the runtime catalog. That would otherwise create an import cycle throughconfig/config.ts.utility-model.tskeeps the catalog read and its exported API.gateway.roles.definitions.<role>.modelPolicywhen a role allows no utility model for an agent it can use.openclaw config validate,openclaw statusandopenclaw doctorall show it.docs/concepts/models.mdnow describes both outcomes. When nothing is offered, narration and recaps pause and other utility tasks use the primary. A refusing role pauses that owner's recaps.resolveUtilityModelRefForAgentno longer accepts a role policy: a bare ref drops the reason, and simple completion would turnundefinedback into the main model.User population
modelPolicyexcludes the utility models: Activity recaps (session-activity-summaries.ts).not-offered) instead of sending a request to a model the catalog already reported missing (utility-model.ts).Not changed (follow-ups)
updatingbeforeunavailable(schedule()can't know the role synchronously, and remembering the refusal would be new state).not-offeredis not shown inmodels status: that needs a new wire value.Evidence
session-activity-summaries.retry.test.ts): role allows only the main model, 4 activity rounds 130 s apart on a fake scheduler clockunavailable, 0 armed wakesrole-policyboth ways; a permissive role with the small model missing still gets the offered primarymodelPolicyopenai/gpt-6.2-sol, automatic utility, default roleguestallowing only the main model (baseb82c5504vs head, dist builds)config validate: valid, no warningconfig validate,status(Utility model row) anddoctor([config] warnings) nameRole "guest"Suites:
utility-model,config.utility-model-warnings,session-activity-summaries,session-activity-summaries.retry,list.status,dashboard-session-title,session-observer-stdout,session-row-transcript-backfill,models-list-result.configured-static.