Skip to content

feat: auto-update session title, live preview, and lock override#15

Merged
amahpour merged 8 commits intomainfrom
8-auto-update-session-title-and-live-preview-line-with-lock-override
Mar 30, 2026
Merged

feat: auto-update session title, live preview, and lock override#15
amahpour merged 8 commits intomainfrom
8-auto-update-session-title-and-live-preview-line-with-lock-override

Conversation

@amahpour
Copy link
Copy Markdown
Owner

@amahpour amahpour commented Mar 30, 2026

Summary

  • Auto-title: Session display_name auto-derived from git branch name (cleaned up) or first user message when not locked
  • Live preview line: Collapsible single-line preview of latest agent activity (tool calls prioritized over text), with chevron expand showing last 3 transcript messages with role badges
  • Lock toggle: Lock/unlock button next to title — locked titles are frozen and skip auto-updates; editing does not auto-lock

Changes

  • server/db.py: Add display_name_locked and last_activity_preview columns
  • server/watcher.py: Add _generate_auto_title() (branch-aware), _extract_activity_preview() helpers; wire into _process_file_changes() with WebSocket broadcast; persist file positions to DB
  • server/routes/api.py: Extend SessionPatch with display_name_locked field
  • server/hooks.py: Stop Notification events from clobbering task_description
  • public/js/dashboard.js: Lock button, preview line with expand/collapse, toggleLock() and togglePreview() methods
  • public/js/terminal.js: Increase transcript fetch limit from 200 to 1000
  • public/css/style.css: Styles for lock button, preview line, expanded view, role badges
  • tests/: 17 new tests (watcher helpers, API lock toggle, DB columns) + e2e fix

Test plan

  • pytest — 255 unit tests passed, 0 failed
  • Manual: start server, create session, verify title auto-updates from git branch
  • Manual: click lock icon, verify title freezes and icon changes (🔓→🔒)
  • Manual: click chevron, verify last 3 messages load with role indicators (A/U/T badges)
  • Manual: verify preview line updates in real-time via WebSocket

Closes #8

🤖 Generated with Claude Code

…#8)

Add three related features to improve session card readability:

- Auto-title: derive display_name from first user message (~5 words)
  when not manually locked
- Live preview: show latest agent activity (tool calls, assistant text)
  as a collapsible line with chevron expand for last 3 messages
- Lock toggle: lock/unlock button next to title to freeze auto-updates

Backend: new display_name_locked and last_activity_preview DB columns,
watcher now generates titles/previews and broadcasts via WebSocket,
SessionPatch extended with display_name_locked field.

Frontend: lock button, preview line with expand/collapse, role badges
in expanded view.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@amahpour amahpour linked an issue Mar 30, 2026 that may be closed by this pull request
8 tasks
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 30, 2026

Coverage

Unit Test Coverage
FileStmtsMissCoverMissing
__init__.py00100% 
db.py132298%124–125
hooks.py140298%178, 181
main.py380100% 
pr_lookup.py113298%52–53
sessions.py00100% 
terminal.py990100% 
watcher.py3811695%25–28, 336, 527–528, 562–570
routes
   __init__.py00100% 
   api.py1460100% 
   ws.py106892%59–60, 94–95, 97, 116, 128–129
TOTAL11553097% 

Tests Skipped Failures Errors Time
255 0 💤 0 ❌ 0 🔥 16.784s ⏱️

amahpour and others added 7 commits March 29, 2026 18:09
The preview line was falling back to task_description when
last_activity_preview was null, duplicating text already shown
in the card body.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Notification hook events (e.g., "Claude is waiting for your input")
were clobbering task_description, causing cards to show stale
notification text even when the session was actively working.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Long sessions (1000+ entries) were only fetching the last 200,
causing user prompts from earlier in the conversation to be
missing from the transcript view.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace simple word truncation with claude -p --model haiku
subprocess for intelligent 3-5 word titles. Titles regenerate
every 10 user messages so they evolve with the session.

Includes per-session dedup guard to prevent spawning multiple
claude processes for the same session.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Simplify LLM title trigger to only fire when display_name is
empty. The previous "every 10 messages" logic would trigger for
all sessions at once when file positions reset on restart.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace LLM-based title generation with branch-aware heuristic.
Cleans up branch names by stripping prefixes (feature/, fix/, etc.)
and ticket IDs, then converts kebab-case to Title Case.

Examples:
- feature/PROJ-42-fix-auth-bug → "Fix Auth Bug"
- feat/add-dark-mode → "Add Dark Mode"
- fix/CIT-357-table-inline-filters → "Table Inline Filters"

Falls back to truncated first user message when branch is unhelpful.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
File positions were stored in-memory only, so every server restart
caused the watcher to re-read ALL JSONL files from the beginning,
creating duplicate sessions and flooding the dashboard (142+ sessions).

Now saves positions to the settings table after each file is processed
and restores them on startup.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@amahpour amahpour merged commit 20857a8 into main Mar 30, 2026
4 checks passed
@amahpour amahpour deleted the 8-auto-update-session-title-and-live-preview-line-with-lock-override branch March 30, 2026 02:33
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.

Auto-update session title and live preview line with lock override

1 participant