Skip to content

fix(tui_gateway): stop live profile session reuse from hiding verification answers - #71834

Merged
teknium1 merged 1 commit into
NousResearch:mainfrom
fangliquanflq:fix/live-session-payload-profile-db
Aug 15, 2026
Merged

fix(tui_gateway): stop live profile session reuse from hiding verification answers#71834
teknium1 merged 1 commit into
NousResearch:mainfrom
fangliquanflq:fix/live-session-payload-profile-db

Conversation

@fangliquanflq

@fangliquanflq fangliquanflq commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Warm/live reuse of a non-launch profile session was reading the process launch state.db when building the user-visible transcript, so verification-candidate rows that only exist in the profile DB disappeared even though a cold resume of the same session still showed them. Route _live_session_payload through the existing profile-aware _session_db(session) helper so all surfaces agree.

Bug Cause

_live_session_payload hard-coded _get_db() (launch SessionDB). App-global remote profile sessions persist display history (including finish_reason=verification_required candidates) under session["profile_home"]/state.db. A miss on the launch DB fell back to collapsed in-memory model history, which already dropped those candidates.

Reproduction Steps

  1. In desktop app-global remote mode, resume a session owned by a non-launch profile that has a persisted verification candidate.
  2. Confirm cold session.resume shows the candidate.
  3. Hit the live fast path via session.activate or a second session.resume that reuses the in-memory session.

Expected: candidate remains in the payload, matching cold resume.
Before fix: candidate missing; only the collapsed model history remains.

Fix

Use with _session_db(session) as db: before _live_visible_history so profile sessions open the correct DB and launch sessions keep the shared handle. Added test_live_session_payload_reads_profile_db_not_launch_db.

Related Issue

No issue

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Changes Made

  • tui_gateway/server.py - _live_session_payload reads history via _session_db(session) instead of launch _get_db()
  • tests/test_tui_gateway_server.py - regression: profile DB has candidate, launch DB does not, live payload keeps candidate

How to Test

  1. Manual: follow reproduction; after fix, live reuse matches cold resume.
  2. Automated (already run locally):
scripts/run_tests.sh tests/test_tui_gateway_server.py -k "live_visible_history or live_session_payload or reconcile_display or session_resume_live" -q
scripts/run_tests.sh tests/tui_gateway/test_failed_turn_retention.py -q

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature
  • I've run scripts/run_tests.sh on relevant tests and they pass
  • I've added tests for my changes
  • I've tested on my platform: Windows 11

Documentation & Housekeeping

  • I've updated relevant documentation - N/A
  • I've updated cli-config.yaml.example if I added/changed config keys - N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows - N/A
  • I've considered cross-platform impact - N/A (DB path logic is cross-platform)
  • I've updated tool descriptions/schemas if I changed tool behavior - N/A

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/tui Terminal UI (ui-tui/ + tui_gateway/) area/profiles Multi-profile isolation, HERMES_HOME scoping sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state labels Jul 26, 2026
@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform area/sessions Session lifecycle, resume, persistence, history labels Jul 30, 2026
Warm/live reuse was hard-coding the launch SessionDB, so app-global remote
profile sessions fell back to collapsed in-memory history and dropped
verification candidates that eager profile resume still showed.
@teknium1
teknium1 force-pushed the fix/live-session-payload-profile-db branch from 653873a to 0a8c844 Compare August 15, 2026 03:56
@teknium1
teknium1 merged commit 86a8928 into NousResearch:main Aug 15, 2026
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/profiles Multi-profile isolation, HERMES_HOME scoping area/sessions Session lifecycle, resume, persistence, history comp/tui Terminal UI (ui-tui/ + tui_gateway/) P2 Medium — degraded but workaround exists sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants