fix(tui-gateway): a hidden seed row stays out of search, a partial seed copy is rolled back, live resume counts the wire (#107562)

Two independent reviews of the seeded-create change found three more
places where the newly durable hidden row, or the new create-time copy,
was not handled by the same rule as the rest of the path:

- Message search (dashboard search and the session_search tool) had no
  display_kind filter, so a hidden opening row matched a query the
  person never saw. The shared search predicate now skips hidden rows.
- _seed_row left the fresh session row behind when the transcript copy
  failed after the row was committed. The first prompt's retry copies
  the whole seed, so a kept partial copy would be duplicated. The row
  is now deleted when the copy did not complete, the compensation
  _persist_branch applies to branch children; the first prompt then
  starts clean.
- _live_session_payload (a resume that reuses a live session) reported
  message_count as the raw history length while its messages array was
  filtered. It now follows _resume_response: the stored size when
  messages are omitted, else the wire count.

Tests: the two seeded-create tests now drive the first-submit path
through _persist_session_row_for_submit, the function prompt.submit
calls, and assert search and the reuse-live count; a third test pins
the rollback (no row after a failed copy, one copy after the retry).
This commit is contained in:
Siddharth Balyan
2026-09-10 23:35:33 +05:30
committed by GitHub
parent c22a8d8e3f
commit d5aaaa4a1b
4 changed files with 56 additions and 8 deletions
+2
View File
@@ -135,6 +135,8 @@ def _search_filter_clauses(
rewind/undo rows (active=0, compacted=0) are hidden."""
if not include_inactive:
where.append("(m.active = 1 OR m.compacted = 1)")
# display_kind="hidden" rows are model-facing scaffolding the person never saw; a hit would confuse.
where.append("COALESCE(m.display_kind, '') <> 'hidden'")
if source_filter is not None:
where.append(f"s.source IN ({','.join('?' for _ in source_filter)})")
params.extend(source_filter)