test: cover Gemma4 channel-aware close marker decoding - #15682
test: cover Gemma4 channel-aware close marker decoding#15682christian-byrne wants to merge 2 commits into
Conversation
The LTX2 prompt node primes a 'final' channel, so only its close is generated. Decoding that close as </think> made the whole answer read as reasoning and the node returned an empty string.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: 0 reviews are currently available. Based on recent review activity, included reviews refill at 4 per hour. 📜 Recent review details⏰ Context from checks skipped due to timeout. (9)
🧰 Additional context used📓 Path-based instructions (5)**/*📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.py📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.{py,json}📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.{py,md,txt,json}📄 CodeRabbit inference engine (AGENTS.md)
Files:
**⚙️ CodeRabbit configuration file
Files:
🧠 Learnings (1)📚 Learning: 2026-02-21T14:01:41.482ZApplied to files:
🔇 Additional comments (1)
📝 WalkthroughWalkthroughAdded a standalone Gemma4 decode test harness with CPU fallback and a canned tokenizer. Added regression tests for thought-channel conversion, empty and unclosed thought channels, non-thought channel closures, multiple channels, and removal of turn and EOS markers. Merge Risk: ⚪ Minimal · up to This is a localized tests-only change with no production behavior changes; no actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Comment |
Adds decode-side coverage for the channel-marker handling fixed in #15611, which merged without tests.
Gemma4SDTokenizer.decodetranslates channel markers into<think>/</think>. Before #15611 the close was translated unconditionally, so a<channel|>that closed a primed channel became a</think>with no opener.TextGenerateLTX2Promptprimes<|channel>final\nin non-thinking mode, and since only new tokens are decoded the opener is never present — the node's parse then read the entire answer as reasoning and returned an empty string, which fed empty conditioning toCLIPTextEncode.gemma4_template_test.pyalready covers the tokenize side; this is the matching decode side. The load-bearing case istest_close_of_a_non_thought_channel_is_not_reasoning.Tests only — no source changes.
Verified against
master: 22 passed withgemma4_template_test.py. Revertingdecodeto its pre-#15611 form fails 3 of the 6, so they hold the fix in place rather than restating it.