Skip to content

fix(gemma): keep reopened thoughts out of answer content - #407

Merged
jonathan308 merged 3 commits into
mainfrom
astra/conformance-o5-a
Nov 14, 2026
Merged

jonathan308 merged 3 commits into
mainfrom
astra/conformance-o5-a

Conversation

@jonathan308

@jonathan308 jonathan308 commented Nov 13, 2026 •

Copy link
Copy Markdown

Summary

Gemma can reopen <|channel>thought after answer text; today that thought and stray <channel|> markers leak into content. DARKBLOOM_GEMMA_REOPENED_THOUGHTS=1 routes each thought to reasoning and absorbs stray closes in streamed and collected output. Unset/0 preserves current behavior. Quoted tool payloads remain opaque.

Before

flowchart TB
  A[Answer text] --> B[Reopened thought]
  B --> C[Leaks into answer]
Loading

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]
Loading

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 421cee20f9cfacbaad7feec45505caf608861619 produced 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 1 and 0. 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 base 859f6415, whose CI passed. Package.resolved is 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 same AudioReaderRetryTests.swift:53 failure 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

  • I have read CONTRIBUTING.md.
  • I have run pre-commit run --all-files (changed-file formatter checks and exact-head CI lint passed; the full local command was not run).
  • Tests demonstrate the fix.
  • Necessary documentation and fork coverage updated.

AI usage

  • I have read this PR description in full and approve it as my own, and it accurately describes the code changes.
  • AI usage disclosure: Codex implemented and tested this change under explicit user authorization to publish draft PRs. An independent fresh-context Codex reviewer assessed correctness and refactoring. The human acknowledgment remains unchecked.

jonathan308 and others added 3 commits November 13, 2026 10:08
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.
jonathan308 added a commit that referenced this pull request Nov 13, 2026
The phase-D SDK pin is main after #416, #417 and #407. #417 is #416's
head plus two commits and shares no file with #407: clean merge, no
change to either side.
jonathan308 added a commit that referenced this pull request Nov 14, 2026
Same conformance test file as the green head b7ae604; still without #407's parser change.
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
jonathan308 merged commit 1c8168d into main Nov 14, 2026
40 of 42 checks passed
jonathan308 added a commit that referenced this pull request Nov 14, 2026
O5 on the phase-D cumulative SDK: #407 merged onto #416 + #417 (opt-in Gemma reopened thoughts)
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>
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