Skip to content

The agent that grows with you

fix(tui_gateway): reopen the finalized row in the compute-host child, not _run_prompt_submit

Brooklyn Nicholsond62fbea7e110
diff --git a/tui_gateway/compute_host.py b/tui_gateway/compute_host.py
index d425fff96af..a79bc7b95c9 100644
--- a/tui_gateway/compute_host.py
+++ b/tui_gateway/compute_host.py
@@ -253,6 +253,13 @@ class ComputeHost:
self._reply("turn.started", sid, request_id, started_ns=now_ns())
with contextlib.suppress(Exception):
server._ensure_session_db_row(session)
+ # #85303: the parent's prompt.submit reopened this row before dispatching here (or
+ # the turn would not have been admitted), but an old parent predating that fix --
+ # or a synthesized re-entry -- must not strand the child's transcript writes in a
+ # row still marked ended_at. Same best-effort shape as the row binding above.
+ with server._session_db(session) as db:
+ if db is not None:
+ server._reopen_if_finalized(db, str(session.get("session_key") or ""))
with contextlib.suppress(Exception):
import hermes_undo
hermes_undo.on_user_message_appended(session["session_key"])
diff --git a/tui_gateway/prompt_turn.py b/tui_gateway/prompt_turn.py
index acd10860e8c..6152dd0c9f6 100644
--- a/tui_gateway/prompt_turn.py
+++ b/tui_gateway/prompt_turn.py
@@ -1120,17 +1120,6 @@ def _run_prompt_submit(
logger.warning(
"prompt dispatch: session store unavailable for %s — this turn may not persist",
session.get("session_key") or sid)
- else:
- # The first real turn reopens a finalized row (#85303): resume/mount is read-only, so
- # the row's ended_at is cleared HERE — at the one seam every dispatch crosses, not in
- # prompt.submit's persist. The isolated compute-host dispatch returns from prompt.submit
- # before that persist (the child process runs the turn), so a reopen placed there never
- # fires for isolated turns; here it covers inline and isolated dispatch equally, plus
- # the synthesized turns that bypass prompt.submit entirely. Best-effort, like the
- # reopen helper itself: a failed read never blocks the turn.
- with _session_db(session) as db:
- if db is not None:
- _reopen_if_finalized(db, str(session.get("session_key") or ""))
admitted = _admit_prompt_turn(
sid, session, text, image_paths, queued_prompt_generation, display_kind, display_metadata)
if admitted is None: