refactor(backends): read one owner for the native reasoning control - #184
Merged
Conversation
Five backends each carried their own canonical-effort to native-control mapping, and agent-runtime carried a sixth copy to check the receipt against. The copies had drifted: agent-runtime expected codex to apply `minimal` for `none` and `high` for `xhigh` and `ultracode`, while `codexReasoningEffort` applies `none`, `xhigh` and `ultra`. Its check throws on a mismatch, so three of the seven rungs refused a legitimate codex run. `nativeReasoningControl` in `@tangle-network/agent-interface` 1.6.0 now owns the map, and both sides read it. `claudeEffort`, `codexReasoningEffort`, `opencodeVariantForEffort` and both `thinkingFlagForEffort` functions are deleted, with the smoke tests that pinned their tables — agent-interface tests the mapping at its owner. Interface moves 1.3.0 -> 1.6.0.
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.
Five backends each hand-rolled the same canonical-effort to native-control mapping, and agent-runtime carried a sixth copy to check the materialization receipt against. The copies had drifted, and the drift was refusing live runs.
The drift
agent-runtime's
expectedBridgeAppliedReasoningexpected codex to applyminimalfornoneandhighfor bothxhighandultracode.codexReasoningEfforthere appliesnone,xhighandultra— its own comment records why: "Codex CLI 0.147.0 accepts the canonical values directly." agent-runtime throwsValidationErroron a mismatch, so three of the seven rungs refused a legitimate codex run.Its
defaultarm also asserted the canonical rung for every harness it did not name. Eleven harnesses fall there and none plumbs a thinking flag, so their receipts carryapplied: nullfromprofile-support.ts:128and those runs were refused too.The fix
nativeReasoningControl(harness, effort)in@tangle-network/agent-interface1.6.0 owns the map.harness-capabilities.tsalready existed for exactly this — its own header says it is where the cli-bridge backends, the sandbox UI pickers and the router read one truth "instead of each hand-rolling a divergent copy" — and it already documented these native spellings in prose while both consumers hand-rolled them.Deleted here, with the smoke tests that pinned their tables:
claudeEffort(claude.ts)codexReasoningEffort(codex.ts)opencodeVariantForEffort(opencode.ts)thinkingFlagForEffort(kimi.ts)thinkingFlagForEffort(pi.ts)agent-interface tests the mapping at its owner, pinning all seven rungs per harness plus
nullfor every harness with no native control.One correction landed in the shared table: the interface docstring claimed a
maxrung for pi. This repo's pi allowlist stops atxhigh, soultracodeclamps there.Interface moves 1.3.0 → 1.6.0.
pnpm typecheckpasses across that jump.Verification
pnpm typecheckclean.pnpm test: 18 failures across 6 files (docker-executor, failure-attribution, jail, mcp-passthrough, pi-inference-isolation, pi-native), identical in count and file set to an unmodifiedorigin/mainrun on this machine — they need Docker, a jail, and real harness binaries. Passing count drops by exactly the 4 mapping tests deleted here.Consumer
tangle-network/agent-runtime#959 deletes its copy and calls the same function.