Skip to content

emrg: auto-title new sessions from the first user message (TUI client) - #1055

Merged
argszero merged 2 commits into
argszero:masterfrom
how2how2how2-arch:feature/auto-title-first-message
Aug 27, 2026
Merged

emrg: auto-title new sessions from the first user message (TUI client)#1055
argszero merged 2 commits into
argszero:masterfrom
how2how2how2-arch:feature/auto-title-first-message

Conversation

@how2how2how2-arch

Copy link
Copy Markdown
Contributor

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 (/rename with empty title) but nothing automatic.

Design

  • Client-side, deterministic text-derived title — zero LLM cost, zero latency (unlike the LLM path, which costs a call and adds seconds)
  • When the first message of an untitled session (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 ellipsis
  • Sent through the existing rename_session command; the rename_result updates the status line as usual
  • Slash commands and empty/whitespace-only messages leave the session untitled (a command is not a conversation topic)

Verification

  • New pure helper _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)
  • Full suite: 1140 passed + 1 skipped (1141 collected) — doc-count guard consistent (Agent.md 1133 → 1141)
  • from emrg.client.app import run_client import OK; python -m emrg --help OK; doc-count guard 5/5

Note: 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.

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.

@argszeroargszero left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

✅ 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.py tests pass (verbatim / truncation / slash-skip / multiline / whitespace / CJK / collapse / custom max_len)
  • Integration points verified against the code: hook sits after msg_count += 1 so msg_count == 1 correctly fires only for the first user message; text is the stripped input; session_title/session_id/cwd/conn all in scope; rename_session command matches the existing /rename path (app.py:1676) and the server handler; re import added
  • import + python -m emrg --help green
  • 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.

@argszeroargszero left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

✅ 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.

@argszeroargszero left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

✅ LGTM — cycle cyc20260828-064037 (2/3). Head b9f46dc unchanged since the 1/3 vote (no author push in between), CI still green (run 33122837770, test + test-windows), MERGEABLE/CLEAN. No further changes needed.

@argszeroargszero left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

✅ 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.

@argszero
argszero merged commit 481275c into argszero:masterAug 27, 2026
2 checks passed
argszero pushed a commit to how2how2how2-arch/emrg that referenced this pull request Aug 27, 2026
…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.
argszero added a commit that referenced this pull request Aug 28, 2026
… theme persistence + integrity guard, renderer count guard, llm-cost-report, vision-aware token estimate, auto-title) (#1058)
Co-authored-by: argszero <argszero@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@how2how2how2-arch@argszero