Skip to content

feat: distinguish between a session name and its first prompt#157

Merged
vakovalskii merged 4 commits intovakovalskii:mainfrom
akolotov:feat/distinguish-session-name
Apr 10, 2026
Merged

feat: distinguish between a session name and its first prompt#157
vakovalskii merged 4 commits intovakovalskii:mainfrom
akolotov:feat/distinguish-session-name

Conversation

@akolotov
Copy link
Copy Markdown
Contributor

@akolotov akolotov commented Apr 9, 2026

Summary

This PR distinguishes between a session's metadata-derived name and its first prompt by introducing a separate session_name field in session data.

Before this change, first_message was overloaded:

  • sometimes it held a true session title from agent metadata
  • sometimes it held the first user prompt

That made the model ambiguous and forced the UI to guess whether it was rendering a real session name or just fallback prompt text.

This PR separates those concerns:

  • session_name now stores a trusted metadata-derived session name
  • first_message remains the fallback prompt/display text

Trusted session_name sources in this PR:

  • Claude Code: custom-title
  • Codex: thread_name
  • OpenCode: SQLite session title

Why This Functionality Is Added

The detail view and session lists need to represent two different concepts cleanly:

  • the actual session name when the underlying tool provides one
  • the first prompt when no true name exists

Without a separate field, the UI cannot tell these apart. That causes several problems:

  • session details may show the first prompt as if it were the session name
  • future naming logic becomes harder to reason about
  • search and display logic are forced to treat one field as two different kinds of data

By introducing session_name, the app can now:

  • prefer real session names where they exist
  • keep using the first prompt as a fallback summary where needed
  • support the detail panel rule of AI title -> session_name -> empty

User-Facing Behavior

Session Details

The detail panel now follows this logic for the Name row:

  • if an AI-generated name exists in local storage, use it
  • otherwise, use session_name
  • otherwise, show no name value and keep the Generate AI Name action available

This is intentional: the detail panel is now strict about showing a real name, not the first prompt.

Projects / All Sessions / Related Views

List-style display surfaces continue to show the best available session label, now with explicit fallback:

  • session_name || first_message

This preserves the existing UX expectation that every session row should still show something meaningful about what the session is about.

Search

Search now considers both:

  • session_name
  • first_message

This preserves discoverability whether the user remembers the formal session title or the original first prompt.

Why This Does Not Break Anything

This change is intentionally backward-compatible in behavior.

1. Existing sessions without session_name still work

Most tools do not provide a reliable metadata title. For those sessions:

  • session_name is simply empty
  • the UI falls back to first_message in list/card/search surfaces

So sessions that previously displayed correctly continue to display correctly.

2. No removal of first_message

first_message is not removed or repurposed into something incompatible. It remains available everywhere it was before, and continues to power fallback labeling and prompt-based discovery.

The change is additive in the data model:

  • new field: session_name
  • existing field preserved: first_message

3. Detail panel behavior becomes stricter by design, not broken

The detail panel now prefers:

  • AI-generated title
  • metadata session name
  • empty

This is a deliberate semantic improvement. It avoids showing the first prompt as if it were a true session name. The action to generate an AI name remains available, so no capability is lost.

4. Search remains compatible

If title text moved entirely out of first_message without updating search, users could lose the ability to find sessions by title. This PR avoids that by explicitly searching both session_name and first_message.

So search behavior is preserved and improved.

5. Cloud and related displays stay consistent

Cloud-facing display and serialization now also prefer the best available label. That avoids local/cloud divergence for agents that provide a trusted session name.

Implementation Notes

  • Added session_name population in session loaders for Claude Code, Codex, and OpenCode
  • Preserved first_message as prompt/display fallback text
  • Updated main UI display surfaces to use session_name || first_message
  • Updated detail panel to use AI title -> session_name -> empty
  • Updated search/filter scoring to include both name and first prompt

Risk Assessment

Risk is low because:

  • the change is mostly a data-model clarification
  • fallback behavior is preserved in the main UI surfaces
  • no destructive migration is required
  • untrusted tools are not forced into a fake session_name

The main semantic change is limited to the detail panel, where showing only a real name is the intended new behavior.

@akolotov akolotov changed the title feat: distinguish between a session's metadata-derived name and its first prompt feat: distinguish between a session name and its first prompt Apr 9, 2026
@vakovalskii vakovalskii merged commit 78071c0 into vakovalskii:main Apr 10, 2026
6 checks passed
vakovalskii added a commit that referenced this pull request Apr 10, 2026
Merged: #156 (star sync), #155 (clipboard fallback), #159 (bind URL fix),
#157 (session name vs first prompt), #160 (MCP badges toggle), #100 (Warp launch API)
Closed: #128 (dup), #148 (banned), #161 (bad diff)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@akolotov akolotov deleted the feat/distinguish-session-name branch April 10, 2026 12:17
apstenku123 added a commit to apstenku123/codedash that referenced this pull request Apr 11, 2026
- vakovalskii#155 clipboard copy fallback on non-secure origins (execCommand shim)
- vakovalskii#156 star button sync in detail panel (already applied earlier)
- vakovalskii#159 bind address vs browser URL separation (execFile, safer)
- ca70fd2 dual metrics: user_messages (real) + total_interactions (all)
- d3f4326 Node >= 18 version check at startup with clear error

Skipped: vakovalskii#100 Warp launch config (non-iTerm2), vakovalskii#157 session name refactor
(too many touches), vakovalskii#160 badge display config (non-critical),
analytics totalSessionsAll (already have similar in createCostAggregator).
Sign up for free to 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