Skip to content

The agent that grows with you

fix(gateway): admit clarify.lock during a restart's after-turn wait

Teknium7c3b10c15505
diff --git a/gateway/drain_control.py b/gateway/drain_control.py
index 219b063ef3a..3ac3efbab9d 100644
--- a/gateway/drain_control.py
+++ b/gateway/drain_control.py
@@ -69,7 +69,7 @@ def restart_wait_read(runner, method, path) -> bool:
RESTART_WAIT_WS_METHODS = frozenset({
"ping", "runtime.describe", "session.resume", "session.detach", "session.events.since",
"session.info", "session.list", "prompt.submit", "prompt.receipt", "session.interrupt",
- "approval.pending", "approval.received", "approval.respond", "clarify.respond",
+ "approval.pending", "approval.received", "approval.respond", "clarify.respond", "clarify.lock",
})
diff --git a/tests/gateway/test_restart_wait_prompt_reach.py b/tests/gateway/test_restart_wait_prompt_reach.py
index 86f8484f8f8..1dd45f0a53d 100644
--- a/tests/gateway/test_restart_wait_prompt_reach.py
+++ b/tests/gateway/test_restart_wait_prompt_reach.py
@@ -185,6 +185,12 @@ async def test_restart_wait_ws_serves_the_parked_turn_and_refuses_every_other_ve
answered = await call("approval.respond", execution_generation=1, prompt_id="gone", choice="once")
# Reached the authority: a stale prompt is its own verdict, never the drain's refusal.
assert answered.get("error", {}).get("message") != "runtime_draining"
+ # A batch clarify answers one question at a time with clarify.lock (no session_id); the
+ # allowlist is what lets Desktop/Ink answer a turn parked on a clarify batch.
+ locked = await viewer.dispatch({"id": "lock", "method": "clarify.lock", "params": {
+ "request_id": "srq-none", "question_id": "q0", "answer": "red"}})
+ assert locked.get("error", {}).get("message") != "runtime_draining", locked
+ assert locked["result"]["status"] == "expired"
for method, params in [("config.set", {"key": "model", "value": "x"}), ("session.save", {}),
("process.kill", {"pid": 1}), ("reload.mcp", {}), ("rollback.restore", {})]:
refused = await call(method, **params)