Skip to content

fix(hooks): stop hijacking Claude Code session name + humanize auto-task titles (0.14.3)#30

Merged
Shahinyanm merged 1 commit into
mainfrom
fix/session-name-pollution
Jun 12, 2026
Merged

fix(hooks): stop hijacking Claude Code session name + humanize auto-task titles (0.14.3)#30
Shahinyanm merged 1 commit into
mainfrom
fix/session-name-pollution

Conversation

@Shahinyanm

Copy link
Copy Markdown
Member

What & why

Two related fixes for the SessionStart hook polluting the user's Claude Code session name and the task list. Reported by a user who saw sessions named TJ — tj-qqay98cpc2 and tasks titled 685] INFO: Mapped {/rest-api/...}.

1. SessionStart no longer hijacks the session name

The v0.10.1 "X2" experiment emitted two undocumented fields:

  • sessionTitle: "TJ — <task_id> (<n> open)"overrode Claude Code's native, prompt-derived session name with our internal task id.
  • initialUserMessage: "[Task Journal resumed: …]" — injected a banner into the next prompt, which auto-open then captured as a new garbage-titled task.

Both removed. Resume context still rides in additionalContext; the tab label belongs to Claude Code. Dead TJ_INITIAL_USER_MESSAGE gate gone.

2. Auto-opened tasks get human-readable titles

auto_open_task_from_prompt took the prompt's first non-empty line verbatim — so a session opening on scrollback got titled 685] INFO: Mapped {...}. Titles now run through tj_core::title::humanize_title, which rejects logs, timestamps, shell prompts, JSON/paths and the resume banner, and picks the first human-intent line. Pure machine noise → declines to auto-open.

Base note

Cut from v0.14.2, which shipped from feature branches and never merged to main (main sat at 0.13.1). Merging this reconciles the drift: brings 0.14.0–0.14.2 and this 0.14.3 fix onto main.

Tests

  • New title:: unit suite (11).
  • SessionStart envelope tests flipped to assert both fields absent; obsolete env test removed.
  • New CLI test: log-scrollback prompt does not auto-open.
  • fmt + clippy clean; full suite green (pre-existing migrate_project WSL-only env failures unrelated).

🤖 Generated with Claude Code

…to-task titles (0.14.3)

Two related fixes for the SessionStart hook polluting the user's Claude
Code session name and the task list with machine-derived junk.

SessionStart envelope: drop the `sessionTitle` and `initialUserMessage`
fields (the v0.10.1 "X2" experiment). `sessionTitle` was set to
"TJ — <task_id> (<n> open)", which overrode Claude Code's native,
prompt-derived session name with our internal task id. `initialUserMessage`
injected a "[Task Journal resumed: …]" banner into the next prompt, which
the auto-open path then captured as a brand-new garbage-titled task. The
resume context the model needs still rides in `additionalContext`; the tab
label belongs to Claude Code. Removes the now-dead TJ_INITIAL_USER_MESSAGE
gate.

Auto-open titles: route `auto_open_task_from_prompt` through a new
`tj_core::title::humanize_title`. It skips log lines ("685] INFO: …"),
timestamps, shell prompts ("user@host:~$ …"), JSON/paths and the resume
banner, and returns the first line that reads like human intent. When the
prompt is only machine noise it returns None and the caller declines to
auto-open — better no task than a task titled "685] INFO: Mapped {/x, POST}".

Tests: new title:: unit suite (11) for the heuristic; flipped the
SessionStart envelope tests to assert sessionTitle/initialUserMessage are
absent; removed the obsolete TJ_INITIAL_USER_MESSAGE test; added a cli
integration test proving a log-scrollback prompt does not auto-open a task.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Shahinyanm Shahinyanm merged commit 6330a04 into main Jun 12, 2026
7 checks passed
@Shahinyanm Shahinyanm deleted the fix/session-name-pollution branch June 12, 2026 09:32
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