Skip to content

The agent that grows with you

docs+cli: document prompt.resolve_unknown; gateway CLI /discard acknowledges a lost turn

Teknium8175f5ff8d5c
diff --git a/hermes_cli/gateway_chat_view.py b/hermes_cli/gateway_chat_view.py
index c11638654cf..41d64909761 100644
--- a/hermes_cli/gateway_chat_view.py
+++ b/hermes_cli/gateway_chat_view.py
@@ -97,6 +97,17 @@ class GatewayChatView:
execution_generation=prompt["execution_generation"], prompt_id=prompt_id,
**({"choice": answer} if expected == "approval" else {"answer": answer}))
return True
+ if command == "/discard":
+ # Acknowledge a turn lost across an owner restart; the resume snapshot
+ # is the only source of the generation the authority stamped on it.
+ snapshot = await self.client.rpc("session.resume", session_id=self.session_id)
+ lost = next((row for row in snapshot.get("pending", [])
+ if row["admission_id"] == rest.strip() and row["status"] == "unknown"), None)
+ if lost is None:
+ raise GatewayClientError("No unknown (lost) admission with that id; resume to refresh")
+ await self.client.rpc("prompt.resolve_unknown", session_id=self.session_id,
+ admission_id=lost["admission_id"], execution_generation=lost["execution_generation"])
+ return True
if command in {'/branch', '/model', '/compress'}:
from hermes_cli.gateway_mutations import slash_mutation
operation, payload = slash_mutation(command, rest.strip())
@@ -111,7 +122,7 @@ class GatewayChatView:
print(f"{operation}: {target}")
return True
if command == "/help":
- print("/stop, /approve <id> <choice>, /answer <id> <text>, /quit (detach). /branch [title], /model <model> [--provider name], /compress [focus].")
+ print("/stop, /approve <id> <choice>, /answer <id> <text>, /discard <admission_id> (turn lost during restart), /quit (detach). /branch [title], /model <model> [--provider name], /compress [focus].")
return True
raise GatewayClientError("Unsupported gateway CLI command; use /help. No local command was run.")
diff --git a/website/docs/developer-guide/gateway-internals.md b/website/docs/developer-guide/gateway-internals.md
index 1c6c8f1d444..a9552835dc2 100644
--- a/website/docs/developer-guide/gateway-internals.md
+++ b/website/docs/developer-guide/gateway-internals.md
@@ -22,6 +22,17 @@ publishes this state before `message.complete`, retaining the terminal event as
last event of that turn. Desktop translates both paths into its existing
`pending_submissions` queue store.
+A turn that was `started` when its owning gateway died is recovered by the next owner
+as `unknown`: Hermes cannot prove which side effects happened, so it neither replays
+the input nor lets the queued turns behind it run. `prompt.resolve_unknown`
+(`session:control`, params `session_id`, `admission_id`, `execution_generation`)
+acknowledges the loss: the row settles as `interrupted`, the session FIFO resumes and
+the follower runs exactly once. The generation must be the one stamped on the unknown
+row (visible in the resume/`session.info` projection), so a stale or already-resolved
+row is refused with `stale_generation`. Desktop shows such a row in the queue panel as
+"Turn lost during restart" with a **Discard** button; the gateway CLI exposes it as
+`/discard <admission_id>`. The lost input stays in the transcript for the user to resend.
+
## Shared authority local slash commands
Authenticated local sessions accept `slash.exec({session_id, command})` and