Filter <local-command-caveat>-wrapped caveat messages (Claude Code ≥ ~2.1)#269
Conversation
…~2.1) Newer Claude Code versions wrap the local-command caveat in a <local-command-caveat> XML tag instead of emitting the bare "Caveat: ..." text, so is_system_message() stopped matching it. The wrapped caveat then leaked into session previews / page titles (showing as the "first message" of any session that opens with a slash command) and rendered as a slash-command message in transcripts. It also promoted command-only sessions (e.g. a lone /model invocation) into the session index, which previously had no eligible first user message and were skipped. Match the tag prefix in is_system_message and bump the cache compatibility floor so caches with the caveat baked into first_user_message rebuild on upgrade. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughThis PR extends system message filtering to recognize caveat text wrapped in ChangesWrapped Caveat Filtering
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| # (Claude Code ≥ ~2.1) from session previews: caches built | ||
| # earlier have the caveat text baked into first_user_message | ||
| # for affected sessions. | ||
| "1.4.0": "1.5.0", |
There was a problem hiding this comment.
Glad to see 1.5.0 is brewing ;-)
There was a problem hiding this comment.
I realised we should have done it ages ago 😅 should probably cut a release once a week after every few PRs!
There was a problem hiding this comment.
@cboos also wanted to email you about publishing to PyPI, but the address on your Github profile bounced my email. Mine is working, please drop me a message!
Newer Claude Code versions wrap the local-command caveat in a XML tag instead of emitting the bare "Caveat: ..." text, so is_system_message() stopped matching it. The wrapped caveat then leaked into session previews / page titles (showing as the "first message" of any session that opens with a slash command) and rendered as a slash-command message in transcripts. It also promoted command-only sessions (e.g. a lone /model invocation) into the session index, which previously had no eligible first user message and were skipped.
Match the tag prefix in is_system_message and bump the cache compatibility floor so caches with the caveat baked into first_user_message rebuild on upgrade.
Summary by CodeRabbit