feat(engine): language-drift flag on subagent result envelopes (#88) - #100
Merged
Merged
Conversation
glm-5.3-flash drifted into Chinese for all/part of the final report in 4/7 dispatches (even with explicit English-only prompt instructions) — findings were sound, but the controller had no cheap signal and had to eyeball every verdict line. - new src/engine/language-drift.ts: pure CJK-family letter-ratio detector (Han/Hiragana/Katakana/Hangul >= 30% of letters, min 40 letters; tunable constants; quoted-CJK-inside-English stays clean; Latin non-English deliberately out of scope — spec N3) - finishRun computes it on every terminal path (both backends) and journals languageDrift/languageDriftRatio on run:ended (additive — post-hoc diagnosability per the #59/#60/#61 pattern) - tool result prefixed with a one-line warning on drifted runs (mirrors the #61 zero-tool prefix; composes with it) + details fields - README 'Model-quality drift signals' section (also documents the #89 reviewer-reference guidance for controllers) - spec: docs/superpowers/specs/2026-09-02-spec-language-drift-flag.md - +11 tests (detector x8, wiring x3); 835/835
…w NITs) NIT-1: journal↔live-bus parity — the conditional-spread allowlists in event-bus + rpc-server observe now forward languageDrift/languageDriftRatio (clean runs stay key-free). Pinned by 2 new tests (live + replay). NIT-2: detector comment documents the deliberately-uncounted Unicode blocks (plane-2 Han ext, Hangul Jamo, halfwidth kana). 837/837.
This was referenced Sep 2, 2026
Merged
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.
Closes #88 (flag half). The optional
resultLanguagesystem-side preference is explicitly deferred (spec N2) — re-file standalone if wanted.Spec first (design-first per repo convention):
docs/superpowers/specs/2026-09-02-spec-language-drift-flag.mdSummary
glm-5.3-flash drifted into Chinese for all/part of the final report in 4 of 7 dispatches — including two with an explicit English-only instruction. Findings were sound every time; the missing piece was a cheap machine-readable signal. This lands exactly that: flagging, not blocking (the #61 surfacing-only precedent).
Design (D1–D4 in the spec)
finishRun— the single composition point for every terminal path (direct/fallback/turn-budget, pi + claude backends).languageDrift+languageDriftRatioon SpawnResultdetails; one-line[FLEET] language drift — …warning prefix (composes with the subagent: premature return after a single planning statement (zero work, no turn-budget exhaustion) — re-dispatch succeeds #61 zero-tool prefix); journaled additively onrun:ended(the subagent: explicit model string fails where inherited session model succeeds (same model) #59/#49 regression: filesTouched empty on real edit-tool runs — args serialized as empty, run:ended missing the field #60/subagent: premature return after a single planning statement (zero work, no turn-budget exhaustion) — re-dispatch succeeds #61 post-hoc pattern). No renames — frozen surface stays additive-only.resultLanguagesystem-prompt preference — it changes every child's substrate and dispatch-prompt placement demonstrably isn't enough; separate decision if wanted.README
New "Model-quality drift signals" section documents the flag and the #89 controller guidance (reviewer cross-domain references are suspect; verify by git + files, never prose) — #89's armory-fleet-docs half. Its SDD-template half lands in the skills repo separately.
Tests (+11, 835/835)
run:endedcarries flag + ratio (RunLog replay).