From 037a73fa2369b5027fdc4652ebedb27e35cdda8f Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Mon, 31 Aug 2026 09:04:25 -0700 Subject: [PATCH] fix(tui): fail prompt.submit loud only on a real store-open failure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The salvaged #98948 change returned False for every db=None, which also fired in deliberately store-less/degraded contexts (no _db_error), regressing six prompt.submit tests. Gate the loud failure on _db_error being set — the actual #98924 symptom — and keep the pinned best-effort contract otherwise. --- tui_gateway/server.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tui_gateway/server.py b/tui_gateway/server.py index 2b43d7434e..e0de9e1fa1 100644 --- a/tui_gateway/server.py +++ b/tui_gateway/server.py @@ -3834,7 +3834,12 @@ def _ensure_session_db_row(session: dict) -> bool: db = _get_db() close_db = False if db is None: - return False + # Fail loud ONLY when the store actually failed to open (#98924): + # _db_error records the SessionDB open exception. A None db with no + # recorded error means "no store in this context" (degraded harness, + # store deliberately absent) — that keeps the pinned best-effort + # contract and stays True. + return _db_error is None # The session's own model/effort/fast pick — the composer override shipped on # session.create, or a restored /model switch — must own the row's model + # model_config. The agent isn't built yet at first prompt.submit, so derive