Repository navigation
fix(gemma): keep reopened thoughts out of answer content - #407
Merged
Merged
Conversation
Add a Gemma-only regression and an isolated opt-in test process. The default process checks existing behavior. Test execution is pending the build hold. AI-assisted: test and CI-map changes prepared with Codex.
This was referenced Nov 13, 2026
jonathan308
added a commit
that referenced
this pull request
Nov 13, 2026
jonathan308
added a commit
that referenced
this pull request
Nov 14, 2026
test-shards.json: #417's map (#414's four native shards and hosted audio shard, with #416's two groups) taken as is, plus #407's gemma-reopened-thought-enabled group and one extra run beside gemma-quoted-number-enabled in shard 2 (+15 s estimate, as for that run). The seven hosted audio tests are unchanged. Every other file merges cleanly; against #417's head this adds exactly #407's lines, the reviewed test case and the reference text.
jonathan308
added a commit
that referenced
this pull request
Nov 14, 2026
Brings in main at f41a5f9 (#407 to #418: opt-in native reasoning budgets, grammar-aware MTP verification and free spans, GLM token constraints, Gemma parsing options, and CI routing #414). One conflict, in fork.yaml: main and this branch each add a paragraph to the core runtime description. Both are kept: the canonical prefill grid paragraph, then main's reasoning budget paragraph. CBv2Contracts.swift, EngineV2.swift, EngineLoopV2.swift and CONTRACT-DECISIONS.md merged without a conflict. Every ordinary submission path (submit, submitWithRetirement, submitWithNativeRetirement and the first-token deadline submit) still cancels a running continuation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
Gemma can reopen
<|channel>thoughtafter answer text; today that thought and stray<channel|>markers leak into content.DARKBLOOM_GEMMA_REOPENED_THOUGHTS=1routes each thought to reasoning and absorbs stray closes in streamed and collected output. Unset/0preserves current behavior. Quoted tool payloads remain opaque.Before
After
flowchart TB A[Gemma output] --> B{Flag enabled?} B -->|No| C[Current parsing] B -->|Yes| D[Scan channel boundaries] D --> E[Separate thought and answer]Evidence
Parent Safari screenshot verification passed both compact Before/After diagrams on2026-11-13 at20:08Z: readable, no overlap, cropping or Mermaid renderer errors.
Before: signed regression commit
421cee20f9cfacbaad7feec45505caf608861619produced eight failing assertions across four chunk sizes in a CPU-only source-matched parser harness. Expanded cases exposed collected-output, opaque-tool and empty-thought bugs; independent review then exposed a bare-prefix compatibility bug (seven failing assertions).After: the exact modified parser/scanner sources pass all 47 tests in eight suites, independently with the switch
1and0. Includes existing Gemma/Harmony/think parsing tests plus split markers, repeated/empty/unclosed thoughts, native/JSON/escape tool strings, reopening after a tool and truncated prefixes. This harness is not a full SDK build.Independent fresh-context correctness and dedicated refactor review: initial finding fixed, final review reports no actionable findings. Test helper cleanup preserves behavior.
Shard-tool tests: 22 pass; unit file-layout check, changed Swift formatting, diff checks and actual upstream merge-base fork-diff coverage pass. New enabled CI process includes both existing Gemma suites and the new conformance suite.
Full SDK Build and the enabled Gemma shard passed. Attempt1 shard10 failed an actual Float bit-pattern equality assertion in unchanged
AudioReaderRetryTests.swift:53. Relevant tracked source and dependency declarations match base859f6415, whose CI passed.Package.resolvedis untracked, so this does not establish identical resolved dependencies/environment; cause is not established. The one targeted retry failed the same assertion at the unchanged head (run43485258980 attempt2/job132108276199); no third retry. Both runs have equal sample counts but small numerical differences, whose origin is not established. Fresh exact-base control #410 reproduces the sameAudioReaderRetryTests.swift:53failure on the exact859f6415 source tree, matching runner class, Xcode27.2(27B52) and all31 actual resolved pins. It also fails an AAC raw-PCM/hash retry check before MLX processing. This establishes current baseline reproduction, not the framework-internal cause or an audio fix. Full CI is not green. GPU/model qualification is skipped, not failed or passed, because the authorized machine's GPU lane is protected. No performance or full vLLM-parity claim.Merge Danger
Door: Two-way — disable the process flag and restart to retain today's behavior.
Blast Radius: Gemma
Only Gemma parsing changes. Native dependency pins remain unchanged for this parser-only change; provider consumption requires an explicit SDK gitlink update. This draft is not release qualification.
Checklist
pre-commit run --all-files(changed-file formatter checks and exact-head CI lint passed; the full local command was not run).AI usage