refactor(cli,config)!: withdraw --trace-output and --mode explain (OX-H5) - #36
Merged
Conversation
Audit OX-H5, DECISIONS §62. Both were parsed, validated against an enum, threaded through the file -> env -> CLI precedence chain, frozen onto ResolvedConfig -- and read by nothing. traceOutput appears at ten sites in src/; every one is a write or a type declaration. The trace is emitted by a literal io.stderr.write(...), so `--trace-output stdout` reported success and changed nothing, and a caller redirecting it to capture a trace in a pipe concluded the tool had ignored them. It had. Nothing branched on `explain` at all. This is the defect audit H4 already removed three flags for. These two survived that sweep only because they sit on ResolvedConfig rather than OptimizationBudget. Withdrawn on H4's terms: the surfaces go, the model fields stay, documented as unconsumed, because ARCHITECTURE.md pins the model as frozen and a field awaiting an implementation is not the same defect as a dial that reports success. Withdraw rather than implement, though implementing would have been two lines: the only caller in this repo that passed the flag -- tools/corpus-harness/measure.js, with `--trace-output stderr` -- has been reading stderr correctly the whole time while passing a flag that did nothing. The sole user asked for the default. --mode is narrowed by value, not removed. `--mode bench` rewrites the command, which is a live effect; it lives in the parser rather than in anything that reads appMode. An earlier pass concluded "appMode has no consumers, so remove --mode" -- true about the field, false about the flag, and it would have deleted a working route to bench. BREAKING (nominally): --trace-output is now `Unknown argument`, and `explain` is rejected rather than ignored from all three surfaces, per the rule 1.6.0 set for the TOKENDAMPER_* enums. Nothing that took effect stops taking effect, because none of it ever did. A config file still carrying a traceOutput key keeps loading -- the key is no longer validated or read, and withdrawing a knob must not turn a file that loaded yesterday into a hard error. The trace itself has not moved. measure.js was updated in the same change; leaving it would have turned the measurement harness into a parse error. Verified end to end after the change: the file route exits 0 and its trace still parses out of stderr. Also corrects a superseded claim found in the same comment block: --target-reduction-ratio was documented as "nearly as inert -- the planner reads it only as > 0", false since §48 made it a real ceiling. The README carried it too. Verified: typecheck, lint and build clean, 84 files / 778 tests. The six withdrawal cases were confirmed failing against the unfixed tree first. Co-Authored-By: Claude Opus 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.
Audit OX-H5, decided as withdraw rather than implement. DECISIONS §62.
Both knobs were parsed, validated against an enum, threaded through the file → env → CLI precedence
chain, frozen onto
ResolvedConfig— and read by nothing.traceOutputappears at ten sites insrc/; every one is a write or a type declaration. The trace is emitted by a literal:So
--trace-output stdoutaccepted the value, validated it, stored it, and the trace went tostderr. A user setting it to capture a trace in a pipe concluded the tool had ignored them. It had.
Nothing branched on
appMode === 'explain'at all.This is the defect audit H4 already removed three flags for (
--max-output-tokens,--max-latency-ms,--risk-tolerance, README "removed in 1.2.0"). These two survived that sweeponly because they sit on
ResolvedConfigrather thanOptimizationBudget.Withdrawn on H4's terms
The surfaces go, the model fields stay —
ResolvedConfig.appModeandResolvedConfig.traceOutputremain withUnconsumeddoc comments, becauseARCHITECTURE.mdpinsthe model as frozen and a field awaiting an implementation is not the same defect as a dial that
reports success. If
traceOutputis ever implemented,cli/main.tsreads the field first and thesurfaces come back after — never the reverse.
Implementing it would have been two lines. The argument against: the only caller in this
repository that passed the flag —
tools/corpus-harness/measure.js, with--trace-output stderr—has been reading stderr correctly the whole time while passing a flag that did nothing. The sole
user asked for the default.
--modeis narrowed by value, not removed--mode benchrewrites the command:That is a live effect — and it lives in the parser, not in anything that reads
appMode. Anearlier pass through this finding concluded "
appModehas no consumers, so remove--modeentirely": true about the field, false about the flag, and it would have deleted a working route to
bench. The distinction is why this was checked rather than assumed, and both halves are pinned.What changes for existing setups
--trace-outputis nowUnknown argument.TOKENDAMPER_TRACE_OUTPUTis simply not read,matching how the H4 variables were retired.
--mode explain,TOKENDAMPER_APP_MODE=explainandapp.mode: "explain"are hard errors,per the rule 1.6.0 set for the
TOKENDAMPER_*enums. Nothing that took effect stops takingeffect, because none of it ever did.
traceOutputkeeps loading. The key is no longer validated orread, and unknown keys were always ignored — withdrawing a knob must not turn a file that loaded
yesterday into a hard error.
tools/corpus-harness/measure.jsis updated in the same commit; leaving it would have turned themeasurement harness into a parse error.
Also corrected in passing
The comment above
COMMON_FLAGSclaimed--target-reduction-ratiois "nearly as inert — theplanner reads it only as
> 0". False since DECISIONS §48, which resolves the ratio into anabsolute token ceiling both
pruning:topology-prunerandcompression:token-hashingrespect, with§50 narrowing the adherence gap via sub-region elision. The README's environment-variable table
carried the same stale claim. Comments record decisions here; one recording a superseded decision
argues for undoing the fix.
Verification
Six withdrawal cases confirmed failing against the unfixed tree first; three "deliberately
kept" cases pin the halves that survive. Verified end to end on the built binary — the harness's
new invocation exits 0 and its trace still parses out of stderr,
--trace-outputis rejected, and--mode explainreportsAccepted values: optimize, bench.npm run typecheck,npm run lint,npm run buildandnpx vitest runall pass: 84 files /778 tests.
🤖 Generated with Claude Code