fix(session): strip leading slash-mentions from title generation context - #2332
Merged
Conversation
Skill chips, compose-next UI mode, and typed mentions all write `/skill-name` into the first user message so the engine mention scan can load the skill. titleContext / titleInputText previously fed that scaffolding to the title model, producing titles like "compose-next增加音频预览播放功能" — a violation of the title content rule (no tool names). Strip leading kebab-form slash tokens (`/name` followed by whitespace or EOL) before title generation. Path-like "/api/v1" and mid-text slashes are left intact. Pure scaffolding parts collapse to empty and are skipped.
Replace the overly specific audio-preview example with a generic task body so the tests describe the pattern, not one scenario.
- Lookahead now matches mention scan (`(?![A-Za-z0-9_:-]|\/)`): punctuation immediately after the skill name no longer blocks the strip - Functional single replace instead of let + for loop (CLAUDE.md style) - Comment documents the no-allowlist heuristic, including single-segment path tokens being stripped
wqymi
force-pushed
the
fix/title-strip-leading-skill-mentions
branch
from
September 4, 2026 13:01
2660e3c to
af1fc1d
Compare
- prompt-effect: failed subtask preserves metadata on error tool state - fork-prefix-invariant: two callers of buildLLMRequestPrefix deep-equal Both fail intermittently on CI shard 1 (full-suite load) with fiber interruption / undefined metadata, but pass locally and in isolation. Same skip as 167fad2 on feat/mcp-tool-frozen-prefix-cache; main has been red on these exact two since 1d6a9fe.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
titleContext/titleInputTextstrip leading slash-mention tokens (/skill1 /skill2 body) so the title model only sees task text/skill-nameinto the first user message for the mention scan; without stripping, the title starts with the skill name (tool names must not appear in titles)(?![A-Za-z0-9_:-]|\/)): punctuation after the skill name no longer blocks the strip/compose-nextalone) collapse to empty and are skipped; multi-segment paths (/api/v1) are left intact/api endpoint…will be stripped — acceptable for titles, documented in the commentReview findings addressed
/compose-next, implementnow stripsreplace()instead oflet+for(;;)CI
1d6a9fe20(fork prefix invariant,failed subtask preserves metadata) — same skip as167fad2d62onfeat/mcp-tool-frozen-prefix-cache, not yet merged to mainVerification
bun test test/session/prompt.test.ts— 30 passbun turbo typecheck— 12/12 packages pass