emrg: auto-title new sessions from the first user message (TUI client) - #1055
Conversation
Borrowed from Codex rust-v0.150.0 (#40492): unnamed terminal tasks receive descriptive titles automatically. EMRG sessions displayed the raw session id until the host manually ran /rename; the on-demand LLM auto-title (empty-title /rename) already existed but was never automatic. Client-side, deterministic, zero-cost: when the first message of an untitled session is submitted, a short title is derived from the prompt text (first non-empty line, whitespace-collapsed, 30-char cap with ellipsis) and sent via the existing rename_session command. Slash commands and empty messages leave the session untitled. Adds _auto_title_from_prompt (module-level, unit-testable) + 8 tests; Agent.md count 1133 -> 1141.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle cyc20260828-062007 (1/3). Reviewed head 5b8f694 on a local worktree.
Verdict: small, clean, well-tested change. Verified locally:
- Full suite: 1140 passed + 1 skipped (1141 collected) — matches the Agent.md 1133→1141 bump, doc-count guard consistent
- All 8 new
test_app_auto_title.pytests pass (verbatim / truncation / slash-skip / multiline / whitespace / CJK / collapse / custom max_len) - Integration points verified against the code: hook sits after
msg_count += 1somsg_count == 1correctly fires only for the first user message;textis the stripped input;session_title/session_id/cwd/connall in scope;rename_sessioncommand matches the existing/renamepath (app.py:1676) and the server handler;reimport added - import +
python -m emrg --helpgreen - CI: test + test-windows both green (run 33122072306)
Note (non-blocking, same pattern as #1053/#1054): both this PR and #1054 touch the Agent.md pytest count line; whoever merges second needs the keep-both resolution.
…1144) argszero#1054 (vision-aware estimator) merged first and bumped the pytest count to 1136; this PR adds 8 auto-title tests on top, so the combined count is 1144. Keep-both resolution as both PRs touched the same line.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle cyc20260828-062900 (1/3 on head b9f46dc).
Maintainer conflict-resolution push (b9f46dc): #1054 (vision-aware estimator) merged first and bumped the Agent.md pytest count to 1136; since both PRs touched the same count line, this PR became CONFLICTING. I merged master into the branch and resolved the count to 1144 (1136 + 8 auto-title tests), pushed to the fork branch. No functional code changed — only the Agent.md count line.
Fresh verification on the new head:
- Local full suite: 1143 passed + 1 skipped (1144 collected) — matches Agent.md
- CI: test + test-windows both green (run 33122837770)
- MERGEABLE/CLEAN
Note: the earlier LGTM (1/3 on head 5b8f694) is voided by the head change; this vote restarts the chain on the resolved head.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle cyc20260828-072141 (3/3). Fresh re-verification: head b9f46dc unchanged, CI green (run 33122837770, test + test-windows), MERGEABLE/CLEAN. Three consecutive LGTMs on this head (062900 → 064037 → 072141) with no ❌ in between — merging.
Uh oh!
There was an error while loading. Please reload this page.
…1148) argszero#1055 (auto-title) merged first and bumped the pytest count to 1144; this PR adds 4 reader-fix-latency tests on top, so the combined count is 1148. Keep-both resolution as both PRs touched the same line.
… theme persistence + integrity guard, renderer count guard, llm-cost-report, vision-aware token estimate, auto-title) (#1058) Co-authored-by: argszero <argszero@gmail.com>
Summary
Auto-titles new TUI sessions from the first user message, so the session list stops showing raw session ids until the host manually renames.
Comparable-tool inspiration: Codex rust-v0.150.0 (#40492) — "Unnamed terminal tasks receive descriptive titles automatically." EMRG already had the on-demand LLM auto-title (
/renamewith empty title) but nothing automatic.Design
msg_count == 1 and not session_title) is submitted, derive a short title from the prompt: first non-empty line, whitespace-collapsed, 30-char cap with…ellipsisrename_sessioncommand; therename_resultupdates the status line as usualVerification
_auto_title_from_prompt(module-level, unit-testable) + 8 tests (verbatim short prompt, truncation, slash-command skip, multi-line first-line, whitespace-only, CJK truncation, whitespace collapse, custom max_len)from emrg.client.app import run_clientimport OK;python -m emrg --helpOK; doc-count guard 5/5Note: PR #1054 (vision-aware estimator) also touches the same Agent.md count line (1136 on its branch); when both merge the counts will need the usual keep-both resolution.