Repository navigation
O5 on the phase-D cumulative SDK: #407 merged onto #416 + #417 (opt-in Gemma reopened thoughts) - #418
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.
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.
Composition with #409 (4A grammar-aware MTP), both opt-in: - CBv2MTPConfig carries both constrainedSpeculation and freeSpanSpeculation. - Planning: history eligibility admits constrained rows when grammar verification is on or the constraint offers free spans; drafting admits them when grammar verification is on or the row is in a free span. - A row takes exactly one path per round: a row whose committed state is an opted-in free span keeps the pure same-state preview (masked window, per-token confirmation at finalize); grammar verification (retained raw logits, ordinary sampler per committed position) owns every other constrained row. - The free-span window mask applies only when a free-span row is in the batch, and raw logits are retained only when a grammar-verified row is, so either opt-in alone behaves exactly as its own PR.
Composition: a request with a reasoning budget stays target-only. Its guard sits in mtpHistoryEligible, which mtpBasicEligible includes, so a budgeted row neither drafts nor keeps assistant history, exactly as on #411 alone (where mtpBasicEligible gated both). Budgeted requests carry no token constraint (EngineV2 refuses the pair), so they never reach grammar verification or free spans.
Both opt-ins on, in every verification mode: the protected-span request decodes exactly the constrained oracle's tokens, and a mixed batch keeps the constrained and the ordinary row equal to their non-speculative runs. A naive composition that lets a free-span row also take grammar verification confirms its tokens twice and fails the protected span.
The native-tracked engine refused every token constraint in validateRequest, so a provider could not constrain a GLM-5.3-Flash answer (a JSON response_format grammar) at all. The GLM page-bank profiles that qualify logprob capture qualify token constraints for the same reason: every target row samples with the engine's ordinary sampler, which masks a constrained row as on a generic engine, and a constrained row never drafts or verifies (EngineLoopV2.mtpBasicEligible; grammar-aware and free-span speculation already exclude native engines). CBv2NativeExecutionContract gains supportsTokenConstraints (those profiles), EngineV2 acceptsTokenConstraints, and validateRequest refuses a constraint only where neither holds. MiMo profiles and contract-less tracked engines still refuse (grammarOptInCannotBypassNativeContractRefusal still holds). Tests: on the protected GLM engine a constrained row follows its constraint (never the greedy token), proposes no draft, and the next plain request still speculates (serial and rectangular verification); a constrained row beside a plain row keeps both streams exact. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On the cumulative SDK #416 (#409 + #413 + #411 + #408 on main 859f641). test-shards.json: gemma-reopened-thought-enabled kept beside gemma-quoted-number-enabled as its own extra run in the same shard (the shard tool refuses one run mixing different env). Every other file merges unchanged: the merge adds exactly #407's lines.
From the independent review of this change: a constraint that opts into chained decode (the provider's JSON answers do) would chain on GLM's protected engine, where a lone constrained row has no MTP step to break the chain. The redraw of an invalidated successor then evaluates outside the native work protocol the step launches follow (no requireNativeWork / nativeWorkSubmitted, no withError). Constrained rows now chain only on untracked engines, as grammar-aware and free-span speculation already exclude native engines; on GLM each constrained step is confirmed on the host before the next is built. Test: a chaining constraint at temperature 0.8 on the protected engine follows its sequence, a cancel mid-row stops on its prefix, no constrained successor is ever redrawn, and native work is quiescent at shutdown. The contract comment states the cohort cost: GLM's target has no row-exact fallback, so no row of a decode step with a constrained row drafts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of the O5 merge (SHOULD-FIX 2, nits 5-6): enabled, the collected parser runs the streaming state machine, so a <channel|> that no <|channel> opened is a stray marker and the text before it stays in the answer, where today's collected parser routes it to reasoning. The new case pins both processes. The reference now says that any value other than 1 keeps today's handling, that callers pre-opening the thought in the prompt should leave the switch off, and where enabled parsing drops <turn|> and <eos>.
…the cumulative SDK Only .github/test-shards.json conflicted. Resolution = #414's replanned map (4 native shards + the hosted audio shard, hosted_tests, rest run in shard 4) byte for byte, plus what this branch had added to the old map, each once: - groups native-reasoning-budget (#411) and gemma-quoted-number-enabled (#408, extra pass with DARKBLOOM_GEMMA_SCHEMA_COERCION=1), unchanged; - a run for each group (shards 1 and 2) and one units run in shard 3 for CBv2FreeSpanTests + QwenFreeSpanHistoryTests (#413, was its own shard) and CBv2GrammarNonFiniteTests + CBv2GrammarQwen4Tests (#409, was the rest run); - estimated_seconds of those three shards raised accordingly. Every other #414 file is main's version; no Swift file differs from the cumulative head eaed116. Checked: test_shards.py load_map/resolve_runs (36 groups each used once, one rest run, no unit listed twice; each new suite selected by exactly one main run); test_shards_test.py 27/27 OK.
… (delta review) From the delta review (APPROVE WITH NITS): the protected-engine test now asserts chainedStepCount == 0 (the property the fix makes) beside the redraw count, and drops its cancel half, which raced a fast 8-token row; the loop's header comment states the native-tracked exception, and the contract comment is two lines. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ed/glm-native-token-constraints
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
marked this pull request as ready for review
November 14, 2026 00:56
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
#407 (O5: Gemma reopened thoughts, off by default, on with
DARKBLOOM_GEMMA_REOPENED_THOUGHTS=1) on the phase-D cumulative SDK, for provider 0.10.13 phase D (provider #2116, which re-pins #2089).1c8168d49af96a2ee5f5onto #416eaed116569(#409 + #413 + #411 + #408 onmain859f641529). It adds exactly #407's lines: for each of #407's 7 files, the+/-lines are identical to #407's own diff againstmain. One mechanical conflict,.github/test-shards.json: #408'sgemma-quoted-number-enabledand #407'sgemma-reopened-thought-enabledextra groups are both kept, each as its own run (the shard tool refuses one run that mixes differentenv).73dcc01913e8b588dd(#416 + GLM token constraints). The phase-D SDK pin ismainafter #416, then #417, then #407. #417 shares no file with #407.b7ae6040bc16aebe836a(head)e29eeebd8e, which carries #416's new headc1f8525d04= SDKmain4342a661ac(#414) + #416.test-shards.jsontakes #417's map (#414's four native shards + hosted audio shard, with #416's groups) as is, and adds #407'sgemma-reopened-thought-enabledgroup with its own extra run in shard 2, besidegemma-quoted-number-enabled. #414's seven hosted audio tests are untouched. Against #417's head this adds exactly #407's lines plus the reviewed test case and reference text.#416 touches none of #407's files. #408's Gemma changes are in tool-argument parsing (
GemmaFunctionParser,GemmaArgumentStreamer), not in the reasoning parser.Merge order: #416 → #417 → #418, each on green at its posted head. If the owner merges them as plain merge commits, the final
maincommit (F) has this head's tree. Provider #2116 pins this head and re-pins to F (gitlink only).#407's red CI: the audio failure is pre-existing and unrelated to #407
#407's shard 10 failed
AudioReaderRetryTests.swift:53. That assertion checks that the Float bit patterns of a retried decode ofaudio_only.movequal those of a baseline decode. The same assertion fails on the unchanged base and predates #407:f084cbc89955078288damain859f641529bb013bd81a712d86ab87=main859f641529's treecccf49e79b,1e736f037b,d65ae8b61cf96a2ee5f5The test's failures follow the runner class. Before #414, Fork Tests asked the Darkbloom plane only for pull requests; push and dispatch runs used GitHub-hosted xcode-27. Since 11-12 12:00Z:
894949e486.f084cbc899(attempt 3),55078288da(attempt 2), andmain's push run 43408681875.The hosted platform reader is not proven deterministic either. On hosted run 43515150576 (#415 at
3d6cc05e92), the diagnostic matrix test from #412 (not one of the strict tests) saw different sample-buffer partitions between two reader passes. Only the PCM values matched there.Signature:
MiMoV26EncodedAACAudioTestsshows the same pattern at the native 32 kHz rate: 36,366 of 64,000 values differ, and the SHA-256 identity differs. The differences are already in the platform decoder's PCM, before MLX.#407 changes Gemma text parsing only:
It touches nothing on the AVFoundation/audio path.
Tracked separately: #414 (now on
main) runs the seven strict audio tests in a hosted job, with no assertion changed. The cause in native decoding is not established. This PR changes no audio code, assertion, hash or tolerance.Evidence: a per-job survey of every Fork Tests shard job since 11-12 12:00Z, the failing logs, and
cmp.py, which reports differing indices and ULP sizes from an assertion line.Evidence for this head
1c8168d49a: APPROVE WITH NITS, no must-fix.b7ae6040bc. With the switch on, a collected close with no opener is a stray marker, as designed. Today's collected parser routes the text before it to reasoning. That text is now pinned in both processes and documented. The provider never pre-opens a Gemma thought in the prompt: its only prompt-side use is the closed empty thought inGemmaJSONAnswerPolicy.ToolCallProcessor.16aebe836a(ci: route Swift LM with a temporary hosted audio exception #414's routing: native Darkbloom shards plus the required hosted audio job): run 43532754503, pending. Earlier dispatch runs on superseded heads were cancelled in favour of this one.11eb3ed4a4(branchastra/conformance-o5-v-red, do not merge): Cumulative SDK for provider 0.10.13: #409 + #413 + #411 + #408 (opt-in) #416 plus only fix(gemma): keep reopened thoughts out of answer content #407's conformance test file and its enabled extra run (identical to this head's), without the parser change. Dispatch run 43531884729: pending. Expected: the enabled run fails and the default runs pass.Merge Danger
Door: Two-way. Unset, or any value other than
1, keeps today's parsing. Blast radius: Gemma 4 reasoning parsing only, and only with the switch set. Merge after #416 and #417 (this PR contains both).AI disclosure: prepared by Claude (Opus 5.5) under the repository owner's direction; #407's change is Astra's (Codex), unchanged here except the review test and docs in
b7ae6040bc.