The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix: owner refuses config.set key=model with use_session_mutation_model
Tekniumae2fd61c5085
diff --git a/apps/shared/src/gateway-contract.generated.ts b/apps/shared/src/gateway-contract.generated.tsindex 2d2b9f5f2c5..f9e835817d9 100644--- a/apps/shared/src/gateway-contract.generated.ts+++ b/apps/shared/src/gateway-contract.generated.ts@@ -4880,11 +4880,13 @@ export interface CanonicalConfigGetResult {key?: string | nullscope?: string | null}+/** ``model`` is recognised only to be refused with ``use_session_mutation_model``: a model pick is the revision-fenced ``session.mutate`` operation, never a config write. */export interface CanonicalConfigSetParams {profile?: string | nullsession_id: string- key: 'busy' | 'verbose' | 'yolo'+ key: 'busy' | 'verbose' | 'yolo' | 'model'value?: unknown+ confirm_expensive_model?: boolean | null}export interface CanonicalProfilesParams {profile?: string | nulldiff --git a/apps/shared/src/gateway-contract.openrpc.json b/apps/shared/src/gateway-contract.openrpc.jsonindex 8719558e9ea..a0a7fde5b6c 100644--- a/apps/shared/src/gateway-contract.openrpc.json+++ b/apps/shared/src/gateway-contract.openrpc.json@@ -8347,6 +8347,7 @@},"CanonicalConfigSetParams": {"additionalProperties": false,+ "description": "``model`` is recognised only to be refused with ``use_session_mutation_model``: a model pick is\nthe revision-fenced ``session.mutate`` operation, never a config write.","properties": {"profile": {"anyOf": [@@ -8368,7 +8369,8 @@"enum": ["busy","verbose",- "yolo"+ "yolo",+ "model"],"title": "Key","type": "string"@@ -8376,6 +8378,18 @@"value": {"default": null,"title": "Value"+ },+ "confirm_expensive_model": {+ "anyOf": [+ {+ "type": "boolean"+ },+ {+ "type": "null"+ }+ ],+ "default": null,+ "title": "Confirm Expensive Model"}},"required": [diff --git a/gateway/session_busy_controls.py b/gateway/session_busy_controls.pyindex 8bec5e197c2..35082f25bb4 100644--- a/gateway/session_busy_controls.py+++ b/gateway/session_busy_controls.py@@ -27,6 +27,11 @@ def authorize(connection, ref, params, capability):async def busy_config(connection, ref, params, *, write=False):+ if write and params.get('key') == 'model':+ # The legacy picker verb. On the owner a model pick is ``session.mutate`` operation=model+ # (revision-fenced, retry-idempotent, selection-guarded); a config write would bypass all+ # three. Refused before authorization or any read: nothing is written or deferred.+ raise RuntimeStoreError('use_session_mutation_model')allowed = {'session_id', 'profile', 'key'} | ({'value'} if write else set())if params.get('key') == 'verbose' and not set(params) - allowed and ref.session_id:return verbose_config(connection, ref, params, write)diff --git a/tests/gateway/test_session_busy_controls.py b/tests/gateway/test_session_busy_controls.pyindex 51bcd8e7b68..90a380643dc 100644--- a/tests/gateway/test_session_busy_controls.py+++ b/tests/gateway/test_session_busy_controls.py@@ -115,7 +115,10 @@ def test_busy_policy_is_authorized_session_scoped_and_not_inference(tmp_path):for method, params, reason in [('config.get', {'session_id': ids[0], 'key': 'busy', 'profile': 'foreign'}, 'profile_mismatch'),('config.set', {'key': 'busy', 'value': 'queue'}, 'invalid_params'),- ('config.set', {'session_id': ids[0], 'key': 'model', 'value': 'other'}, 'invalid_params'),+ ('config.set', {'session_id': ids[0], 'key': 'model', 'value': 'other'}, 'use_session_mutation_model'),+ # The Desktop picker's legacy shape: refused with the same actionable code.+ ('config.set', {'session_id': ids[0], 'key': 'model', 'value': 'other --provider custom --session',+ 'confirm_expensive_model': True}, 'use_session_mutation_model'),]:result = await rpc(ws, method, **params)assert result.get('error', {}).get('message') == reason, resultdiff --git a/tests/gateway/test_session_config_projection.py b/tests/gateway/test_session_config_projection.pyindex fbbeddd2259..b50e8da86d5 100644--- a/tests/gateway/test_session_config_projection.py+++ b/tests/gateway/test_session_config_projection.py@@ -46,7 +46,7 @@ def test_client_config_projection_keeps_session_policy_and_secrets_private(tmp_pfor method, params, reason in [('config.get', {'key': 'full', 'profile': 'foreign'}, 'profile_mismatch'),('config.get', {'key': 'full', 'session_id': sid, 'source': 'gui'}, 'invalid_params'),- ('config.set', {'key': 'model', 'session_id': sid, 'value': 'other'}, 'invalid_params'),+ ('config.set', {'key': 'model', 'session_id': sid, 'value': 'other'}, 'use_session_mutation_model'),]:assert (await rpc(ws, method, **params))['error']['message'] == reasonother_url = desc['api_origin'].replace('http:', 'ws:') + '/api/ws?token=other-controls-actor'diff --git a/tui_gateway/contracts/canonical_projections.py b/tui_gateway/contracts/canonical_projections.pyindex 83d6e6c5de2..9fae63374d5 100644--- a/tui_gateway/contracts/canonical_projections.py+++ b/tui_gateway/contracts/canonical_projections.py@@ -17,8 +17,12 @@ class CanonicalConfigGetResult(ConfigGetResult):class CanonicalConfigSetParams(CanonicalSessionParams):- key: Literal['busy', 'verbose', 'yolo']+ """``model`` is recognised only to be refused with ``use_session_mutation_model``: a model pick is+ the revision-fenced ``session.mutate`` operation, never a config write."""++ key: Literal['busy', 'verbose', 'yolo', 'model']value: JsonValue = None+ confirm_expensive_model: bool | None = Noneclass CanonicalAttachedImageResult(AttachedImageResult):