Skip to content

refactor(backends): read one owner for the native reasoning control - #184

Merged
drewstone merged 1 commit into
mainfrom
refactor/one-reasoning-control-owner
Aug 21, 2026
Merged

refactor(backends): read one owner for the native reasoning control#184
drewstone merged 1 commit into
mainfrom
refactor/one-reasoning-control-owner

Conversation

@drewstone

Copy link
Copy Markdown
Owner

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 expectedBridgeAppliedReasoning expected codex to apply minimal for none and high for both xhigh and ultracode. codexReasoningEffort here applies none, xhigh and ultra — its own comment records why: "Codex CLI 0.147.0 accepts the canonical values directly." agent-runtime throws ValidationError on a mismatch, so three of the seven rungs refused a legitimate codex run.

Its default arm 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 carry applied: null from profile-support.ts:128 and those runs were refused too.

The fix

nativeReasoningControl(harness, effort) in @tangle-network/agent-interface 1.6.0 owns the map. harness-capabilities.ts already 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 null for every harness with no native control.

One correction landed in the shared table: the interface docstring claimed a max rung for pi. This repo's pi allowlist stops at xhigh, so ultracode clamps there.

Interface moves 1.3.0 → 1.6.0. pnpm typecheck passes across that jump.

Verification

pnpm typecheck clean. 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 unmodified origin/main run 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.

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.
@drewstone
drewstone merged commit ad261e8 into main Aug 21, 2026
1 check passed
@drewstone
drewstone deleted the refactor/one-reasoning-control-owner branch August 21, 2026 17:37
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.

1 participant