Skip to content

The agent that grows with you

fix(gateway): an unowned process.kill target is process_not_found, not a dead chat

Tekniumfd0376349ead
diff --git a/gateway/session_ancillary.py b/gateway/session_ancillary.py
index 836a2de53a1..3fad343fce2 100644
--- a/gateway/session_ancillary.py
+++ b/gateway/session_ancillary.py
@@ -162,14 +162,15 @@ def _owned_targets(connection, ref, params, *, select):
async def kill_process(connection, ref, params):
"""Desktop's per-process Stop: one process THIS session owns (the ``process.list`` rule); any
- other id, another chat's included, is ``not_found``. The legacy sidecar handler looked the
+ other id, another chat's included, is ``process_not_found``. The legacy sidecar handler looked the
session up in its own table, which never holds an authority session."""
if (set(params) - {'session_id', 'process_id', 'profile'} or not ref.session_id
or not isinstance(params.get('process_id'), str) or not params['process_id']):
raise RuntimeStoreError('invalid_params')
registry, ids = _owned_targets(connection, ref, params, select=lambda p: p.id == params['process_id'])
if not ids:
- raise RuntimeStoreError('not_found')
+ # Never ``not_found``: Desktop reads that reason as "this chat is gone" (dokterdok N64).
+ raise RuntimeStoreError('process_not_found')
return await asyncio.to_thread(registry.kill_process, ids[0])
diff --git a/tests/gateway/test_desktop_process_verbs.py b/tests/gateway/test_desktop_process_verbs.py
index e79b3f3d9d1..a8cca0ae0aa 100644
--- a/tests/gateway/test_desktop_process_verbs.py
+++ b/tests/gateway/test_desktop_process_verbs.py
@@ -23,7 +23,8 @@ def test_desktop_process_kill_stop_and_mcp_reload_reach_only_this_session(tmp_pa
assert result.returncode == 0, result.stdout + result.stderr
receipt = json.loads((home / 'receipt.json').read_text())
assert receipt['kill'] == 'killed', receipt
- assert receipt['foreign_kill'] == 'not_found', receipt
+ # Not ``not_found``, which Desktop's session-gone latch reads as a dead chat (dokterdok N64).
+ assert receipt['foreign_kill'] == 'process_not_found', receipt
assert receipt['stop'] == {'killed': 1}, receipt
assert receipt['exited'] == [True, True, False], receipt
assert receipt['reload_mcp'] == 'reloaded', receipt