Skip to content

fix: live session names sync with /rename + SPA fallback - #37

Merged
aterrylu merged 1 commit into
mainfrom
terry/fix-session-name-sync
Mar 17, 2026
Merged

fix: live session names sync with /rename + SPA fallback#37
aterrylu merged 1 commit into
mainfrom
terry/fix-session-name-sync

Conversation

@aterrylu

Copy link
Copy Markdown
Owner

Summary

  • Session name sync: Live sessions in the sidebar now pick up /rename changes. The GET /api/sessions endpoint enriches session names with the latest customTitle from JSONL files via batchGetTitles. Previously, names were frozen at creation time.
  • SPA fallback fix: The catch-all route was serving index.html for /api/* and /ws/* paths, causing the preview pane to get HTML instead of JSON. Now returns JSON 404 for API/WS/MCP routes. (Supersedes fix: SPA fallback returning HTML for API routes #36)

Test plan

  • Start a session, /rename it in the terminal — sidebar live session name should update within 5s
  • Open markdown preview (Ctrl+click .md link) — should render, not show JSON error
  • Open external preview (/preview?file=...) — should work
  • Hit non-existent API route — should get JSON 404, not HTML

🤖 Generated with Claude Code

@aterrylu
aterrylu enabled auto-merge (squash) March 17, 2026 23:48
- Enrich GET /api/sessions with latest JSONL titles via batchGetTitles.
  When a user /renames in the terminal, the live session sidebar now
  picks up the new name on the next 5s poll.
- Title enrichment is best-effort with try-catch — filesystem errors
  log a warning but never block the session list response.
- Returns new objects to avoid mutating the in-memory session store.
- SPA catch-all now returns JSON 404 for /api/*, /ws/*, /mcp paths
  (all HTTP methods) with path context for debugging.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@aterrylu
aterrylu force-pushed the terry/fix-session-name-sync branch from bdba797 to eb4a5eb Compare March 17, 2026 23:52
@aterrylu
aterrylu merged commit ff164ca into main Mar 17, 2026
1 check passed
@aterrylu
aterrylu deleted the terry/fix-session-name-sync branch March 17, 2026 23:53

@nox-0x nox-0x left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Clean fix on both fronts. The best-effort title enrichment in GET /api/sessions is well-structured — mtime-based caching keeps repeated polls cheap, error handling falls back gracefully, and new objects are returned instead of mutating the in-memory store. The SPA fallback ordering is correct: serveStatic passes through on missing files, and the explicit JSON 404 guards for /api/*//ws/*//mcp catch the preview pane HTML-bleeding bug. No issues blocking merge.

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