Skip to content

fix(tui): keep /title session names in sync#16625

Merged
OutThisLife merged 6 commits into
mainfrom
bb/fix-tui-title-session-sync
Apr 27, 2026
Merged

fix(tui): keep /title session names in sync#16625
OutThisLife merged 6 commits into
mainfrom
bb/fix-tui-title-session-sync

Conversation

@OutThisLife

Copy link
Copy Markdown
Collaborator

Summary

  • route TUI /title through the dedicated session.title RPC instead of the detached slash worker, so title updates always target the live TUI session
  • queue title updates in tui_gateway when the session DB row is not ready yet, then apply them once session initialization creates the row
  • add regression tests for queued/persisted title behavior and local slash handling

Test plan

  • npm test -- createSlashHandler.test.ts (in ui-tui/)
  • scripts/run_tests.sh tests/test_tui_gateway_server.py -k "session_title_queues_when_db_row_not_ready or session_title_clears_pending_after_persist"

Context

Follow-up from the user feedback thread consolidated in #16294 (merged via #16296), addressing the remaining /title sync gap reported in TUI resume/browse flows.

Route TUI /title through session.title RPC and queue titles when the session DB row is still initializing, so renamed sessions reliably appear in /resume and browse flows.
@OutThisLife OutThisLife requested review from Copilot and teknium1 and removed request for teknium1 April 27, 2026 15:54
@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/) labels Apr 27, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Routes the TUI /title command through a dedicated session.title RPC and adds gateway-side support for reading/setting titles (including queuing until persistence is possible), with regression tests across TUI and tui_gateway.

Changes:

  • Add SessionTitleResponse type and implement a local /title slash command that uses session.title RPC (bypassing slash.exec).
  • Implement session.title method in tui_gateway/server.py, including pending_title queuing and an initialization-time flush.
  • Add unit/regression tests for the new /title behavior in both ui-tui and tui_gateway.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
ui-tui/src/gatewayTypes.ts Adds a typed response shape for the new session.title RPC.
ui-tui/src/app/slash/commands/core.ts Implements local /title handling via session.title RPC (get/set).
ui-tui/src/tests/createSlashHandler.test.ts Adds tests ensuring /title uses session.title and bypasses slash.exec.
tui_gateway/server.py Adds pending_title session state, flush-on-init, and the session.title RPC implementation.
tests/test_tui_gateway_server.py Adds regression tests for queued title behavior and pending-clear behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tui_gateway/server.py Outdated
Comment thread tui_gateway/server.py
Comment thread tui_gateway/server.py Outdated
Handle session.title read failures without crashing, distinguish no-op title writes from missing session rows, and use a distinct empty-title error code with regression coverage.
@OutThisLife

Copy link
Copy Markdown
Collaborator Author

Addressed Copilot feedback in 3824b03:\n\n- guarded session.title GET path against DB read failures (fallback to pending_title)\n- fixed set_session_title(rowcount=0) handling to avoid false pending on no-op updates\n- switched empty-title error to distinct code 4021\n- added regression tests covering all three cases\n\nValidation:\n- scripts/run_tests.sh tests/test_tui_gateway_server.py -k "session_title_queues_when_db_row_not_ready or session_title_clears_pending_after_persist or session_title_does_not_queue_noop_when_row_exists or session_title_get_falls_back_to_pending_when_db_read_throws or session_title_rejects_empty_title_with_specific_error_code"\n- npm test -- createSlashHandler.test.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tui_gateway/server.py Outdated
Comment thread tui_gateway/server.py Outdated
Tighten pending-title flush during session init and treat row lookup failures during title-set no-op detection as RPC errors instead of silently queueing.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tui_gateway/server.py
Comment thread tui_gateway/server.py
Retry persisting queued titles on session.title reads and map title validation failures to a user-facing 4022 code instead of generic 5007.
Retry queued pending titles even when the DB already has a non-empty title so explicit user title intents are not silently lost (for example after auto-title). Includes regression coverage.
@OutThisLife

Copy link
Copy Markdown
Collaborator Author

Self-review follow-up pushed in 27936ee:\n\nFound and fixed an additional edge case before re-review: if a queued exists but DB already has a non-empty title (e.g. auto-title), we now still retry applying the queued explicit user title instead of silently dropping it.\n\nAdded regression: .\n\nValidation: ▶ running pytest with 4 workers, hermetic env, in /home/bb/hermes-agent
(TZ=UTC LANG=C.UTF-8 PYTHONHASHSEED=0; all credential env vars unset)
============================= test session starts ==============================
platform linux -- Python 3.14.2, pytest-9.0.3, pluggy-1.6.0
rootdir: /home/bb/hermes-agent
configfile: pyproject.toml
plugins: xdist-3.8.0, split-0.11.0, asyncio-1.3.0, anyio-4.12.1
asyncio: mode=Mode.STRICT, debug=False, asyncio_default_fixture_loop_scope=None, asyncio_default_test_loop_scope=function
created: 4/4 workers
4 workers [9 items]

......... [100%]
=============================== warnings summary ===============================
tests/test_tui_gateway_server.py::test_session_title_get_retries_persist_for_pending_title
tests/test_tui_gateway_server.py::test_session_title_rejects_empty_title_with_specific_error_code
tests/test_tui_gateway_server.py::test_session_title_does_not_queue_noop_when_row_exists
tests/test_tui_gateway_server.py::test_session_title_queues_when_db_row_not_ready
tests/test_tui_gateway_server.py::test_session_title_get_retries_pending_even_when_db_has_title
tests/test_tui_gateway_server.py::test_session_title_clears_pending_after_persist
tests/test_tui_gateway_server.py::test_session_title_set_maps_valueerror_to_user_error
tests/test_tui_gateway_server.py::test_session_title_get_falls_back_to_pending_when_db_read_throws
tests/test_tui_gateway_server.py::test_session_title_set_errors_when_row_lookup_fails_after_noop
/home/bb/hermes-agent/tests/conftest.py:448: DeprecationWarning: 'asyncio.get_event_loop_policy' is deprecated and slated for removal in Python 3.16
loop = asyncio.get_event_loop_policy().get_event_loop()

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================== 9 passed, 9 warnings in 0.62s =========================

@OutThisLife

Copy link
Copy Markdown
Collaborator Author

Correction: self-review follow-up is in commit 27936ee.\n\nFix: queued user titles are now retried even when DB already has a non-empty title (for example auto-title), so explicit queued titles are not dropped.\n\nRegression added: test_session_title_get_retries_pending_even_when_db_has_title.\n\nFocused suite remains green (9 session.title regressions).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tui_gateway/server.py
Handle queued-title ValueError cleanup during session init, harden Discord message source building for test stubs, and fix the Dockerfile contract test syntax error. Also refresh the TUI lockfile and Nix build flags so nix ubuntu-latest no longer fails on npm lock/peer resolution drift.
@OutThisLife OutThisLife merged commit d5a8928 into main Apr 27, 2026
11 of 12 checks passed
@OutThisLife OutThisLife deleted the bb/fix-tui-title-session-sync branch April 27, 2026 17:05
ulasbilgen pushed a commit to ulasbilgen/hermes-adhd-agent that referenced this pull request May 1, 2026
…tle-session-sync

fix(tui): keep /title session names in sync
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…tle-session-sync

fix(tui): keep /title session names in sync
dannyJ848 pushed a commit to dannyJ848/hermes-agent that referenced this pull request May 17, 2026
…tle-session-sync

fix(tui): keep /title session names in sync
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…tle-session-sync

fix(tui): keep /title session names in sync
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
…tle-session-sync

fix(tui): keep /title session names in sync
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tui Terminal UI (ui-tui/ + tui_gateway/) P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants