Skip to content

The agent that grows with you

fix(tui): keep process-global sidecar verbs off the shared owner; scope Ink /stop to its session

Teknium8a444a32acee
diff --git a/apps/shared/src/gateway-contract.generated.ts b/apps/shared/src/gateway-contract.generated.ts
index 70989460ca4..e75e928332a 100644
--- a/apps/shared/src/gateway-contract.generated.ts
+++ b/apps/shared/src/gateway-contract.generated.ts
@@ -5834,7 +5834,7 @@ export interface RpcMethods {
'process.kill': { params: ProcessKillParams; result: ProcessKillResult }
/** Background processes owned by the caller's session (desktop status stack poll). */
'process.list': { params: ProcessListParams; result: ProcessListResult }
- /** Kill every background process in the registry (``/stop``), answering the count killed. */
+ /** ``/stop``: on the shared owner, kill the background processes ``session_id`` owns (required); a standalone sidecar kills every process it holds. Answers the count killed. */
'process.stop': { params: ProcessStopParams; result: ProcessStopResult }
/** Editor Save: apply any subset of a profile's sections and report each one. */
'profiles.configure': { params: ProfilesConfigureParams; result: ProfilesConfigureResult }
diff --git a/apps/shared/src/gateway-contract.openrpc.json b/apps/shared/src/gateway-contract.openrpc.json
index 19da558594d..d2f9298090a 100644
--- a/apps/shared/src/gateway-contract.openrpc.json
+++ b/apps/shared/src/gateway-contract.openrpc.json
@@ -2510,7 +2510,7 @@
},
{
"name": "process.stop",
- "summary": "Kill every background process in the registry (``/stop``), answering the count killed.",
+ "summary": "``/stop``: on the shared owner, kill the background processes ``session_id`` owns (required); a standalone sidecar kills every process it holds. Answers the count killed.",
"params": [
{
"name": "params",
diff --git a/gateway/session_ancillary.py b/gateway/session_ancillary.py
index 2dee1801b15..a727d2fed65 100644
--- a/gateway/session_ancillary.py
+++ b/gateway/session_ancillary.py
@@ -1,7 +1,9 @@
-"""Read-only Desktop/Ink projections of existing owner state.
+"""Desktop/Ink projections of existing owner state, plus the session-scoped process stop.
-No legacy server, manager construction, process recovery, or execution on reads.
+No legacy server, manager construction, process recovery, or execution on reads. ``process.stop``
+is the one write: it stops exactly the processes ``process.list`` projects for the session.
"""
+import asyncio
from functools import partial
import sys
@@ -21,7 +23,8 @@ def handlers(connection):
'session.control.read': 'control', 'process.list': 'processes',
'subagent.list': 'subagents', 'subagent.tail': 'tail',
}.items()}, 'approval.pending': partial(approvals, connection),
- 'approval.received': partial(approvals, connection, ack=True)}
+ 'approval.received': partial(approvals, connection, ack=True),
+ 'process.stop': partial(stop_processes, connection)}
async def approvals(connection, ref, params, *, ack=False):
@@ -62,21 +65,10 @@ async def read(connection, ref, params, *, kind):
authorize(connection, ref, params, 'session:read')
live = authority.sessions[ref.session_id]
with live.event_stream.lock:
- target = physical_target(authority, ref)
- store = authority.runner.session_store
- with store._lock:
- entry = store._entries.get(live.route)
- if entry is None or entry.session_id != target:
- raise RuntimeStoreError('stale_generation')
+ _require_current_route(authority, ref)
if kind == 'control':
return {'control': control_snapshot(authority, ref)}
- # Process-local registries cannot describe another interpreter's live
- # objects. Never turn that missing authority into a successful empty list.
- from gateway.session_managed_worker import managed_policy
- if managed_policy(authority, ref) is not None:
- raise RuntimeStoreError('unsupported_projection')
- agent = authority.agent(ref)
- records = subagent_records(agent)
+ agent, records = _owner_objects(authority, ref)
if kind == 'subagents':
return {'subagents': [{key: record.get(key) for key in _SUBAGENT_FIELDS}
for record in records], 'delegations': []}
@@ -85,6 +77,59 @@ async def read(connection, ref, params, *, kind):
return {'processes': process_snapshot(authority, ref, agent, records)}
+async def stop_processes(connection, ref, params):
+ """Ink ``/stop``: kill the background processes this session owns (what ``process.list``
+ shows), never the registry-wide ``kill_all`` the legacy sidecar ran, which on the shared owner
+ reached every chat, Desktop window and served profile (dokterdok N2). An explicit stop, so a
+ ``persist_on_release`` job of THIS session is still reached (#41225)."""
+ if set(params) - {'session_id', 'profile'} or not isinstance(ref.session_id, str) or not ref.session_id:
+ raise RuntimeStoreError('invalid_params')
+ authority = connection.authority
+ if ref.session_id not in authority.sessions:
+ raise RuntimeStoreError('not_found')
+ authorize(connection, ref, params, 'session:control')
+ live = authority.sessions[ref.session_id]
+ with live.event_stream.lock:
+ _require_current_route(authority, ref)
+ agent, records = _owner_objects(authority, ref)
+ module = sys.modules.get('tools.process_registry')
+ if module is None: # nothing ever registered a process in this interpreter
+ return {'killed': 0}
+ registry = module.process_registry
+ keys, owners = _ownership(authority, ref, agent, records)
+ with registry._lock:
+ targets = [p.id for p in _owned_locked(registry, keys, owners)
+ if not p.exited or p._scope_stop_pending]
+
+ def kill():
+ results = [registry.kill_process(pid, source='process.stop', consume_output=False) for pid in targets]
+ return sum(r.get('status') in {'killed', 'already_exited'} and 'scope_stop_failed' not in r
+ for r in results)
+ return {'killed': await asyncio.to_thread(kill) if targets else 0}
+
+
+def _require_current_route(authority, ref):
+ """The route still serves this conversation (a reused route must not lend its objects)."""
+ live = authority.sessions[ref.session_id]
+ target = physical_target(authority, ref)
+ store = authority.runner.session_store
+ with store._lock:
+ entry = store._entries.get(live.route)
+ if entry is None or entry.session_id != target:
+ raise RuntimeStoreError('stale_generation')
+
+
+def _owner_objects(authority, ref):
+ """``(agent, subagent records)`` of this in-process session. Process-local registries cannot
+ describe (or stop) another interpreter's live objects: a managed worker is refused rather than
+ answered with an empty success."""
+ from gateway.session_managed_worker import managed_policy
+ if managed_policy(authority, ref) is not None:
+ raise RuntimeStoreError('unsupported_projection')
+ agent = authority.agent(ref)
+ return agent, subagent_records(agent)
+
+
def physical_target(authority, ref):
from gateway.config import Platform
if authority.sessions[ref.session_id].source.platform == Platform.LOCAL:
@@ -151,24 +196,34 @@ def subagent_tail(records, subagent_id):
return {**result, 'available': True, 'text': text, 'truncated': size > _TAIL_BYTES}
-def process_snapshot(authority, ref, agent, records):
- module = sys.modules.get('tools.process_registry')
- if module is None:
- return []
- registry = module.process_registry
- route = authority.sessions[ref.session_id].route
+def _ownership(authority, ref, agent, records):
+ """``(routing keys, owners)`` a registry process must match to belong to this session: its
+ routing key AND an owner among the session, its agent and its subagents."""
target = physical_target(authority, ref)
- owners = {target}
+ keys, owners = {authority.sessions[ref.session_id].route, target}, {target}
if agent is not None:
owners.add(getattr(agent, 'session_id', None))
owners.update(r.get('subagent_id') for r in records)
owners.discard(None)
owners.discard('')
- # list_sessions refreshes recovered processes (and writes checkpoints).
- # Read the current objects directly, keeping ownership and output together.
+ return keys, owners
+
+
+def _owned_locked(registry, keys, owners):
+ """Matching process objects; the caller holds ``registry._lock``. Read directly:
+ ``list_sessions`` refreshes recovered processes and writes checkpoints."""
+ return [p for p in (*registry._running.values(), *registry._finished.values())
+ if p.session_key in keys and (p.owner_task_id or p.task_id) in owners]
+
+
+def process_snapshot(authority, ref, agent, records):
+ module = sys.modules.get('tools.process_registry')
+ if module is None:
+ return []
+ registry = module.process_registry
+ keys, owners = _ownership(authority, ref, agent, records)
+ # Keep ownership and output together.
with registry._lock:
- processes = [p for p in (*registry._running.values(), *registry._finished.values())
- if p.session_key in {route, target} and (p.owner_task_id or p.task_id) in owners]
return [{'session_id': p.id, 'command': p.command[:200],
'status': 'exited' if p.exited else 'running', 'exit_code': p.exit_code,
- 'output_tail': p.output_buffer[-4000:]} for p in processes]
+ 'output_tail': p.output_buffer[-4000:]} for p in _owned_locked(registry, keys, owners)]
diff --git a/scripts/gen_gateway_command_parity.py b/scripts/gen_gateway_command_parity.py
index 710a96404a5..4bbc337d346 100755
--- a/scripts/gen_gateway_command_parity.py
+++ b/scripts/gen_gateway_command_parity.py
@@ -112,6 +112,10 @@ def ink_cell(cmd, gateway, ink, served):
if entry is None:
return "slash.exec" if gateway != "refused" else "slash.exec: refused"
_, block = entry
+ if "canonical.controls.notAvailable" in block:
+ # The shared gateway refuses it in the client (no owner verb yet), whatever it calls on a
+ # standalone backend; never reported as a working route.
+ return "refused: not available yet"
if "isCanonical" in block:
return "canonical route"
methods = set(re.findall(r"(?:rpc|request)(?:<[^>]*>)?\(\s*'([a-z_]+\.[a-z_.]+)'", block))
diff --git a/tests/gateway/fixtures/process_scope_peer.py b/tests/gateway/fixtures/process_scope_peer.py
new file mode 100644
index 00000000000..9101fe06045
--- /dev/null
+++ b/tests/gateway/fixtures/process_scope_peer.py
@@ -0,0 +1,74 @@
+"""Authenticated WS fixture: process-global sidecar verbs on the shared owner; no inference."""
+import asyncio
+import json
+import os
+from pathlib import Path
+import shlex
+import sys
+import traceback
+
+
+async def probe():
+ from gateway.run import GatewayRunner
+ from gateway.session_authority import initialize_session_authority
+ from gateway.run_api import start_gateway_api, stop_gateway_api
+ from hermes_cli import web_server
+ from hermes_cli.dashboard_auth.ws_tickets import mint_ticket
+ from tests.gateway.fixtures.local_recovery_probe import rpc
+ from tools.delegate_tool import is_spawn_paused
+ from tools.process_registry import process_registry
+ from websockets.asyncio.client import connect
+
+ home = Path(os.environ['HERMES_HOME'])
+ (home / 'config.yaml').write_text('gateway:\n multiplex_profiles: false\nmodel:\n provider: custom\n default: no-inference\n base_url: http://127.0.0.1:1/v1\nauxiliary:\n title_generation:\n enabled: false\n')
+ (home / '.env').write_text('PROCESS_SCOPE_PROBE=from-dotenv\n')
+ runner = GatewayRunner()
+ authority = await initialize_session_authority(runner, profile_id=str(home), instance_id='process-scope')
+ api = await start_gateway_api(runner)
+ web_server.app.state.auth_required = True
+ receipt, processes = {}, []
+ command = shlex.quote(sys.executable) + ' -c ' + shlex.quote('import time; time.sleep(60)')
+ try:
+ ticket = mint_ticket(user_id='owner', provider='fixture')
+ async with connect(api.api_origin.replace('http:', 'ws:') + '/api/ws?ticket=' + ticket) as ws:
+ sid = (await rpc(ws, 'session.create', request_id='scope', source='tui', toolsets=[]))['result']['session_id']
+ route = authority.sessions[sid].route
+ # This session's own job (persisted too), another chat's job and another chat's persisted job.
+ for task, key, persist in [(sid, route, False), (sid, route, True),
+ ('foreign', 'agent:main:telegram:dm:1', False),
+ ('foreign-persist', 'agent:main:discord:dm:2', True)]:
+ processes.append(process_registry.spawn_local(command, cwd=str(home), task_id=task, owner_task_id=task,
+ session_key=key, persist_on_release=persist))
+ stop = await rpc(ws, 'process.stop', session_id=sid)
+ for proc in processes[:2]:
+ await asyncio.to_thread(proc._completion_event.wait, 10)
+ receipt['stop'] = stop.get('result', stop.get('error'))
+ receipt['exited'] = [p.exited for p in processes]
+ receipt['sessionless_stop'] = (await rpc(ws, 'process.stop')).get('error', {}).get('code')
+ receipt['exited_after_sessionless'] = [p.exited for p in processes]
+ pause = await rpc(ws, 'delegation.pause', paused=True)
+ receipt['pause'] = pause.get('error', {}).get('code')
+ receipt['spawn_paused'] = is_spawn_paused()
+ os.environ.pop('PROCESS_SCOPE_PROBE', None)
+ receipt['reload_env'] = (await rpc(ws, 'reload.env')).get('error', {}).get('code')
+ receipt['environ_rewritten'] = 'PROCESS_SCOPE_PROBE' in os.environ
+ receipt['reload_mcp'] = (await rpc(ws, 'reload.mcp', session_id=sid, confirm=True)).get('error', {}).get('code')
+ receipt['agents_list'] = (await rpc(ws, 'agents.list')).get('error', {}).get('code')
+ finally:
+ for proc in processes:
+ if not proc.exited:
+ process_registry.kill_process(proc.id)
+ await stop_gateway_api(api)
+ (home / 'receipt.json').write_text(json.dumps(receipt))
+
+
+if __name__ == '__main__':
+ status = 0
+ try:
+ asyncio.run(probe())
+ except BaseException:
+ traceback.print_exc()
+ status = 1
+ sys.stdout.flush()
+ sys.stderr.flush()
+ os._exit(status)
diff --git a/tests/gateway/test_session_process_scope.py b/tests/gateway/test_session_process_scope.py
new file mode 100644
index 00000000000..65114196d9a
--- /dev/null
+++ b/tests/gateway/test_session_process_scope.py
@@ -0,0 +1,32 @@
+"""Process-global sidecar verbs never reach the shared owner's other sessions (dokterdok N2)."""
+import json
+from pathlib import Path
+import subprocess
+import sys
+
+from tests.gateway.fixtures.local_recovery_probe import child_env
+
+
+def test_stop_is_session_scoped_and_global_verbs_keep_the_owner_refusal(tmp_path):
+ """Ink ``/stop`` kills only its own session's processes (a persisted one included); another
+ chat's processes, persisted or not, survive. ``delegation.pause``, ``reload.env``,
+ ``reload.mcp`` and ``agents.list`` keep the authority's -32601 instead of reaching the legacy
+ handler that pauses every spawn, rewrites the shared environ or reloads every MCP server."""
+ root = Path(__file__).resolve().parents[2]
+ home, user = tmp_path / 'state', tmp_path / 'user'
+ home.mkdir()
+ user.mkdir()
+ env = child_env()
+ env.update(HOME=str(user), USERPROFILE=str(user), HERMES_HOME=str(home),
+ PYTHONPATH=str(root), PYTHONUNBUFFERED='1')
+ result = subprocess.run([sys.executable, str(root / 'tests/gateway/fixtures/process_scope_peer.py')],
+ cwd=root, env=env, capture_output=True, text=True, timeout=90)
+ assert result.returncode == 0, result.stdout + result.stderr
+ receipt = json.loads((home / 'receipt.json').read_text())
+ assert receipt['stop'] == {'killed': 2}, receipt
+ assert receipt['exited'] == [True, True, False, False], receipt
+ assert receipt['sessionless_stop'] == 4001, receipt
+ assert receipt['exited_after_sessionless'] == [True, True, False, False], receipt
+ assert receipt['pause'] == -32601 and receipt['spawn_paused'] is False, receipt
+ assert receipt['reload_env'] == -32601 and receipt['environ_rewritten'] is False, receipt
+ assert receipt['reload_mcp'] == -32601 and receipt['agents_list'] == -32601, receipt
diff --git a/tui_gateway/contracts/tools_commands.py b/tui_gateway/contracts/tools_commands.py
index f8f029cbf8e..6cdd731de1d 100644
--- a/tui_gateway/contracts/tools_commands.py
+++ b/tui_gateway/contracts/tools_commands.py
@@ -61,7 +61,8 @@ class ProcessStopResult(Result):
method("process.stop", params=ProcessStopParams, result=ProcessStopResult,
- doc="Kill every background process in the registry (``/stop``), answering the count killed.")
+ doc="``/stop``: on the shared owner, kill the background processes ``session_id`` owns (required); a "
+ "standalone sidecar kills every process it holds. Answers the count killed.")
class AgentsListParams(Params):
diff --git a/tui_gateway/ws_legacy_fallback.py b/tui_gateway/ws_legacy_fallback.py
index 5f8580b5ce3..a98f3233a25 100644
--- a/tui_gateway/ws_legacy_fallback.py
+++ b/tui_gateway/ws_legacy_fallback.py
@@ -34,13 +34,23 @@ _SESSION_FALLBACK_ALLOWED = frozenset({
"session.foreign.list", "session.foreign.preview", "session.foreign.import",
"session.workspace.move",
})
+# Sidecar verbs whose handler acts on PROCESS-global state. In a TUI's own sidecar that state was
+# that TUI's alone; on the shared owner it is every chat's, Desktop window's and served profile's:
+# ``process.stop`` = ``kill_all`` over the whole registry (persisted jobs included),
+# ``delegation.pause`` = the global spawn gate, ``reload.mcp`` = tear down and rediscover every MCP
+# server, ``reload.env`` = rewrite ``os.environ`` from the launch profile's ``.env``, ``agents.list``
+# = every chat's process commands. The owner serves the session-scoped ``process.stop`` itself
+# (``gateway/session_ancillary.py``); ``process.kill`` stays: its handler is already session-scoped.
+_PROCESS_GLOBAL = frozenset({"process.stop", "delegation.pause", "reload.mcp", "reload.env", "agents.list"})
def legacy_fallback_allowed(actor: Any, method: str) -> bool:
"""True when the connection's grant covers the interactive purpose (the authority's own
- capability map; never a second list that could drift) and *method* is not a session verb
- the authority owns."""
+ capability map; never a second list that could drift) and *method* is neither a session verb
+ the authority owns nor a process-global sidecar verb."""
from gateway.runtime_bootstrap import _PURPOSE_CAPABILITIES
+ if method in _PROCESS_GLOBAL:
+ return False
if method.startswith(_SESSION_NAMESPACES) and method not in _SESSION_FALLBACK_ALLOWED:
return False
return _PURPOSE_CAPABILITIES["interactive"] <= frozenset(getattr(actor, "capabilities", ()) or ())
diff --git a/ui-tui/src/__tests__/canonicalSlashCommands.test.ts b/ui-tui/src/__tests__/canonicalSlashCommands.test.ts
index 56b098c4ca4..067c3bc4ccd 100644
--- a/ui-tui/src/__tests__/canonicalSlashCommands.test.ts
+++ b/ui-tui/src/__tests__/canonicalSlashCommands.test.ts
@@ -163,3 +163,28 @@ it('/status reads through the gateway; /save, /bg and /btw refuse instead of cal
expect(notices).toContain(`/${name} is not available on the shared gateway yet`)
}
})
+
+it('/stop is session-scoped; process-global /agents pause, /reload-mcp and /reload refuse on the shared gateway', async () => {
+ const { request, slash, sys } = harness()
+
+ for (const cmd of ['/stop', '/agents pause', '/reload-mcp now', '/reload']) {
+ slash(cmd)
+ }
+
+ await flush()
+
+ // dokterdok N2: a sessionless process.stop was the owner-wide kill_all.
+ expect(request).toHaveBeenCalledWith('process.stop', { session_id: 'owner' })
+
+ const methods = request.mock.calls.map(([method]) => method)
+
+ for (const method of ['delegation.pause', 'reload.mcp', 'reload.env']) {
+ expect(methods).not.toContain(method)
+ }
+
+ const notices = sys.mock.calls.map(([text]) => String(text))
+
+ for (const name of ['agents pause', 'reload-mcp', 'reload']) {
+ expect(notices).toContain(`/${name} is not available on the shared gateway yet`)
+ }
+})
diff --git a/ui-tui/src/app/slash/commands/ops.ts b/ui-tui/src/app/slash/commands/ops.ts
index 4a1c4385903..2289f678341 100644
--- a/ui-tui/src/app/slash/commands/ops.ts
+++ b/ui-tui/src/app/slash/commands/ops.ts
@@ -14,10 +14,12 @@ import type {
ToolsConfigureResponse
} from '../../../gatewayTypes.js'
import { t } from '../../../i18n/runtime.js'
+import { appendTranscriptMessage } from '../../../lib/messages.js'
import type { PanelSection } from '../../../types.js'
import { applyDelegationStatus, getDelegationState } from '../../delegationStore.js'
import { patchOverlayState } from '../../overlayStore.js'
import { getSpawnHistory, pushDiskSnapshot, setDiffPair, type SpawnSnapshot } from '../../spawnHistoryStore.js'
+import { turnController } from '../../turnController.js'
import { noSkillsInstalled } from '../../userMessages.js'
import { canonicalTools } from '../canonicalSessionCommands.js'
import type { SlashCommand } from '../types.js'
@@ -69,8 +71,20 @@ export const opsCommands: SlashCommand[] = [
help: 'stop background processes',
name: 'stop',
run: (_arg, ctx) => {
+ // Registry busy policy `interrupt_then_dispatch` (classic /stop, Desktop /stop): end the
+ // running turn first, then stop this session's processes — session-scoped on the shared
+ // owner, never the legacy registry-wide kill_all (every chat's, every profile's).
+ if (ctx.gateway.gw?.isCanonical && ctx.ui.busy && ctx.sid) {
+ void turnController.interruptTurn({
+ appendMessage: msg => ctx.transcript.setHistoryItems(prev => appendTranscriptMessage(prev, msg)),
+ gw: ctx.gateway.gw,
+ sid: ctx.sid,
+ sys: ctx.transcript.sys
+ })
+ }
+
ctx.gateway
- .rpc<ProcessStopResponse>('process.stop', {})
+ .rpc<ProcessStopResponse>('process.stop', ctx.sid ? { session_id: ctx.sid } : {})
.then(
ctx.guarded<ProcessStopResponse>(r => {
const killed = Number(r.killed ?? 0)
@@ -88,6 +102,12 @@ export const opsCommands: SlashCommand[] = [
help: 'reload MCP servers in the live session (warns about prompt cache invalidation)',
name: 'reload-mcp',
run: (arg, ctx) => {
+ // A canonical session's MCP servers are frozen with its launch policy; the shared owner's
+ // pool is every chat's, so there is no per-session reload verb yet.
+ if (ctx.gateway.gw?.isCanonical) {
+ return ctx.transcript.sys(t('canonical.controls.notAvailable', 'reload-mcp'))
+ }
+
// Parse arg: `now` / `always` skip the confirmation gate.
// `always` additionally persists approvals.mcp_reload_confirm=false.
const a = (arg || '').trim().toLowerCase()
@@ -132,6 +152,11 @@ export const opsCommands: SlashCommand[] = [
help: 're-read ~/.hermes/.env into the running gateway (CLI parity)',
name: 'reload',
run: (_arg, ctx) => {
+ // The shared owner's environment is every profile's; it re-reads `.env` per turn itself.
+ if (ctx.gateway.gw?.isCanonical) {
+ return ctx.transcript.sys(t('canonical.controls.notAvailable', 'reload'))
+ }
+
ctx.gateway
.rpc<ReloadEnvResponse>('reload.env', {})
.then(
@@ -325,6 +350,11 @@ export const opsCommands: SlashCommand[] = [
// explicit subcommands skip the overlay and act directly so scripts and
// multi-step flows can drive it without entering interactive mode.
if (sub === 'pause' || sub === 'resume' || sub === 'unpause') {
+ // The spawn gate is process-global: on the shared owner it would pause every chat.
+ if (ctx.gateway.gw?.isCanonical) {
+ return ctx.transcript.sys(t('canonical.controls.notAvailable', `agents ${sub}`))
+ }
+
const paused = sub === 'pause'
ctx.gateway.gw
.request<DelegationPauseResponse>('delegation.pause', { paused })
diff --git a/ui-tui/src/components/agentsOverlay.tsx b/ui-tui/src/components/agentsOverlay.tsx
index 04d70b6a384..5c787fbae1d 100644
--- a/ui-tui/src/components/agentsOverlay.tsx
+++ b/ui-tui/src/components/agentsOverlay.tsx
@@ -785,6 +785,11 @@ export function AgentsOverlay({ gw, initialHistoryIndex = 0, onClose, t }: Agent
const togglePause = () =>
guardLive(() => {
+ // The spawn gate is process-global: on the shared owner it would pause every chat.
+ if (gw.isCanonical) {
+ return setFlash(messages().canonical.controls.notAvailable('agents pause'))
+ }
+
gw.request<DelegationPauseResponse>('delegation.pause', { paused: !delegation.paused })
.then(raw => {
const r = asRpcResult<DelegationPauseResponse>(raw)
diff --git a/website/docs/developer-guide/gateway-command-parity.md b/website/docs/developer-guide/gateway-command-parity.md
index df8ecec5520..d2dd4cf3dff 100644
--- a/website/docs/developer-guide/gateway-command-parity.md
+++ b/website/docs/developer-guide/gateway-command-parity.md
@@ -25,15 +25,15 @@ policy; `client-local (cli_only)` commands are terminal/UI features of a client.
| Command | Gateway (`slash.exec`) | Classic CLI | Ink | Desktop | ACP | Notes |
|---|---|---|---|---|---|---|
-| `/agents` (/tasks) | refused | refused: not available yet | sidecar: delegation.pause | slash.exec: refused | refused | gateway-wide: lists every chat's running agents and the process's async jobs |
+| `/agents` (/tasks) | refused | refused: not available yet | refused: not available yet | slash.exec: refused | refused | gateway-wide: lists every chat's running agents and the process's async jobs |
| `/approvals` | refused | refused: not available yet | slash.exec: refused | slash.exec: refused | refused | port: per-session setting |
| `/approve` | refused | approval.respond (prompt id) | slash.exec: refused | unavailable: messaging | refused | messaging-only |
| `/battery` | refused | refused: not available yet | config.set; sidecar: system.battery | slash.exec: refused | refused | client-local (cli_only) |
-| `/bg` | refused | refused: not available yet | canonical route | action: background | refused | |
+| `/bg` | refused | refused: not available yet | refused: not available yet | action: background | refused | |
| `/blueprint` (/bp) | refused | refused: not available yet | slash.exec: refused | slash.exec: refused | refused | |
| `/branch` (/fork) | refused | session.mutate branch | canonical route | action: branch | ACP fork_session | |
| `/browser` | refused | refused: not available yet | sidecar: browser.manage | action: browser | refused | client-local (cli_only) |
-| `/btw` | refused | refused: not available yet | canonical route | action: btw | refused | |
+| `/btw` | refused | refused: not available yet | refused: not available yet | action: btw | refused | |
| `/bundles` | read | slash.exec | slash.exec | slash.exec | refused | |
| `/busy` | refused | refused: not available yet | canonical route | unavailable: terminal | refused | port: per-session setting |
| `/clear` | refused | session.create | local | action: new | refused | client-local (cli_only) |
@@ -90,15 +90,15 @@ policy; `client-local (cli_only)` commands are terminal/UI features of a client.
| `/reasoning` | refused | refused: not available yet | config.get, config.set | action: reasoning | refused | port: per-session setting |
| `/redraw` | refused | refused: not available yet | local | unavailable: terminal | refused | client-local (cli_only) |
| `/refine` | refused | refused: not available yet | slash.exec: refused | slash.exec: refused | refused | |
-| `/reload` | refused | refused: not available yet | sidecar: reload.env | unavailable: terminal | refused | client-local (cli_only) |
-| `/reload-mcp` (/reload_mcp) | refused | refused: not available yet | sidecar: reload.mcp | unavailable: advanced | refused | |
+| `/reload` | refused | refused: not available yet | refused: not available yet | unavailable: terminal | refused | client-local (cli_only) |
+| `/reload-mcp` (/reload_mcp) | refused | refused: not available yet | refused: not available yet | unavailable: advanced | refused | |
| `/reload-skills` (/reload_skills) | refused | refused: not available yet | commands.catalog; sidecar: skills.reload | unavailable: advanced | refused | |
| `/restart` | refused | refused: not available yet | slash.exec: refused | unavailable: terminal | refused | messaging-only |
| `/resume` | refused | refused: not available yet | local | picker: session | refused | switches the messaging chat's session; local clients resume by id |
| `/retry` | refused | session.mutate rewind + resubmit | canonical route | slash.exec: refused | refused | |
| `/review` | refused | refused: not available yet | slash.exec: refused | slash.exec: refused | refused | |
| `/rollback` | refused | refused: not available yet | sidecar: rollback.diff, rollback.list, rollback.restore | slash.exec: refused | refused | restores filesystem checkpoints |
-| `/save` | refused | refused: not available yet | canonical route | slash.exec: refused | refused | writes an export file on the gateway host |
+| `/save` | refused | refused: not available yet | refused: not available yet | slash.exec: refused | refused | writes an export file on the gateway host |
| `/sessions` | refused | refused: not available yet | local | picker: session | refused | messaging origin-scoped listing (`/sessions all` needs a messaging admin) |
| `/sethome` (/set-home) | refused | refused: not available yet | slash.exec: refused | unavailable: terminal | refused | messaging-only |
| `/skills` | refused | refused: not available yet | slash.exec; sidecar: skills.manage | slash.exec: refused | refused | write-approval queue; `/skills approve\|approval` write |
@@ -108,7 +108,7 @@ policy; `client-local (cli_only)` commands are terminal/UI features of a client.
| `/status` | read | slash.exec | canonical route | slash.exec (rpc fallback) | refused | |
| `/statusbar` (/sb) | refused | refused: not available yet | config.set | unavailable: terminal | refused | client-local (cli_only) |
| `/steer` (/s) | refused | refused: not available yet | canonical route | slash.exec: refused | refused | |
-| `/stop` | refused | session.interrupt | sidecar: process.stop | action: stop | refused | |
+| `/stop` | refused | session.interrupt | canonical route | action: stop | refused | |
| `/subgoal` | refused | refused: not available yet | slash.exec: refused | slash.exec: refused | refused | |
| `/subscription` (/upgrade) | refused | refused: not available yet | sidecar: subscription.state | slash.exec: refused | refused | client-local (cli_only) |
| `/suggestions` (/suggest) | read (bare only) | slash.exec | slash.exec | slash.exec | refused | |