Skip to content

feat(warp): include session_name in structured payloads#74

Open
nscrdev wants to merge 2 commits into
warpdotdev:mainfrom
nscrdev:feat/session-name-in-payload
Open

feat(warp): include session_name in structured payloads#74
nscrdev wants to merge 2 commits into
warpdotdev:mainfrom
nscrdev:feat/session-name-in-payload

Conversation

@nscrdev

@nscrdev nscrdev commented Jul 18, 2026

Copy link
Copy Markdown

Problem

The Warp sidebar shows the cwd path twice for a Claude Code session — once as the title and once as the subtitle — because the structured payloads only carry session_id, cwd, and project. The human-readable session name never reaches Warp. This is the data half of #34 (tab title not updated on /rename).

Change

Claude Code maintains a session registry at ~/.claude/sessions/<pid>.json — one file per running session containing sessionId, name, updatedAt, etc. The name field is kept current on /rename.

build_payload() now looks up the session name by session_id in that registry and includes it as session_name on every warp://cli-agent payload. Since the lookup happens at payload-build time, any payload sent after a /rename (next prompt submit, tool use, or stop) carries the new name.

Details:

  • Fail-soft: missing registry dir, no matching session, or malformed JSON all yield an empty session_name — hooks never break.
  • If duplicate sessionId entries exist (stale files), the most recently updated entry wins (max_by(.updatedAt)).
  • One extra jq invocation per payload; respects CLAUDE_CONFIG_DIR, and CLAUDE_SESSIONS_DIR overrides the registry location for tests.
  • Field is always present (empty string when unknown), additive to protocol v1.
  • Tests added for hit / miss / missing id / missing dir; suite passes (the 2 pre-existing failures on Windows/MSYS path conversion are unrelated and fail identically on main).

Warp-side note

This PR only supplies the data. To fix the duplicated sidebar line, Warp's sidebar renderer should prefer session_name over cwd for the title row when the field is non-empty.

🤖 Generated with Claude Code

nscrdev and others added 2 commits July 18, 2026 12:34
Claude Code maintains a session registry at ~/.claude/sessions/<pid>.json
containing each session's human-readable name (kept current on /rename).
Look it up by session_id at payload-build time and forward it as
session_name on every warp://cli-agent payload, so Warp can label the
sidebar/tab with the session name instead of duplicating the cwd path.

Addresses the data half of warpdotdev#34; Warp-side rendering can adopt the field
once it is present in payloads.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ntry

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

1 participant