Skip to content

feat(engine): language-drift flag on subagent result envelopes (#88) - #100

Merged
rz1989s merged 2 commits into
mainfrom
feat/88-language-drift-flag
Sep 2, 2026
Merged

rz1989s merged 2 commits into
mainfrom
feat/88-language-drift-flag

Conversation

@rz1989s

@rz1989s rz1989s commented Sep 2, 2026

Copy link
Copy Markdown
Member

Closes #88 (flag half). The optional resultLanguage system-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.md

Summary

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)

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)

  • Detector ×8: English clean; pure-CJK drift; half-mixed drift (the observed mode); quoted-CJK clean; Hangul; Kana; sub-floor no-flag with honest ratio; empty.
  • Wiring ×3: drifted child → prefix + details; English child → no prefix/undefined; journaled run:ended carries flag + ratio (RunLog replay).
  • RED verified first (missing module + 2 wiring failures); gates standalone: typecheck ✅, 835/835 ✅.

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.
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.

enh: flag suspected non-English drift in subagent result envelopes (glm-5.3-flash observed 4/7 dispatches)

1 participant