feat(#2481): add a negotiated effortSurface axis and wire invocation-time effort
ADR-1239 gains a ninth negotiated axis, effortSurface (argv | none), declaring how
a host accepts reasoning effort. ADR-443 is amended in the same change because its
recorded deferral is what the axis resolves: its Unblock condition offered paths
(a) and (b) and stated the choice was 'a maintainer call this file records but does
not make'. Path (a) is selected and satisfied here.
Before this, effort reached a runtime only through install-time channels
(EFFORT_RENDERING's frontmatter/api), so reviewer CLIs spawned as subprocesses
silently inherited whatever effort sat in the user's own global CLI config. The
review lane now resolves one universal effort through the ADR-443 cascade and
renders it per host through the negotiated descriptor.
Every per-host value is documentation-sourced, never inferred:
- claude argv -- verified via 'claude --help' (--effort <level>)
- opencode argv -- verified via 'opencode run --help' (--variant)
- codex argv -- codex-rs/exec/src/cli.rs: model_reasoning_effort is NOT a CLI
flag (config.toml key only), so the global -c override is the
only argv route
- 15 hosts undocumented -- their docs state no reasoning setting; the sentinel
fails closed rather than inheriting a profile baseline
No config-file vocabulary member: the only host that ever had one (Gemini CLI's
thinkingConfig) was removed as a sunset runtime by 8f2ebbe9b (#1928, PR #1996),
and neither Antigravity CLI nor ZCode documents a reasoning setting.
Closes #2481
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -34,7 +34,9 @@ const { resolveModelInternal, resolveModelForTier, resolveProviderEscalation, re
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
import agentCommandRouterMod = require('./agent-command-router.cjs');
|
||||
const { AGENT_FAILURE_CLASSES } = agentCommandRouterMod;
|
||||
import { renderEffortForRuntime, RUNTIMES_WITH_FAST_MODE } from './model-catalog.cjs';
|
||||
import { renderEffortForRuntime, renderEffortArgv, RUNTIMES_WITH_FAST_MODE } from './model-catalog.cjs';
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
import hostIntegrationMod = require('./host-integration.cjs');
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
import planningWorkspace = require('./planning-workspace.cjs');
|
||||
const { planningDir, planningPaths } = planningWorkspace;
|
||||
@@ -525,9 +527,9 @@ function cmdResolveGranularity(cwd: string, phaseType: string | undefined, raw:
|
||||
* fast_mode, fast_mode_supported, [unknown_agent] }
|
||||
*
|
||||
* Flags: --effort <level>, --fast-mode <true|false>, --attempt <n>,
|
||||
* --failure-class <class> (#2296)
|
||||
* --failure-class <class> (#2296), --host <runtime-id> (#2481)
|
||||
*/
|
||||
function cmdResolveExecution(cwd: string, agentType: string | undefined, raw: boolean, opts?: { effortOverride?: string; fastModeOverride?: boolean; attempt?: number; failureClass?: string }): void {
|
||||
function cmdResolveExecution(cwd: string, agentType: string | undefined, raw: boolean, opts?: { effortOverride?: string; fastModeOverride?: boolean; attempt?: number; failureClass?: string; host?: string }): void {
|
||||
if (!agentType) {
|
||||
error('agent-type required');
|
||||
}
|
||||
@@ -587,11 +589,55 @@ function cmdResolveExecution(cwd: string, agentType: string | undefined, raw: bo
|
||||
fast_mode: fastMode,
|
||||
fast_mode_supported: fastModeSupported,
|
||||
};
|
||||
// ADR-1239 amendment (#2481) / ADR-443 path (a): invocation-time effort for a
|
||||
// named host. The host's negotiated `effortSurface` decides WHETHER an argument
|
||||
// is emitted; the catalog knows the syntax. Absent --host the contract is
|
||||
// byte-identical to before, so every existing caller is unaffected.
|
||||
if (typeof opts.host === 'string' && opts.host.length > 0) {
|
||||
const surface = effortSurfaceForHost(cwd, opts.host);
|
||||
const argvRendered = renderEffortArgv(opts.host, effort, surface);
|
||||
result['host'] = opts.host;
|
||||
result['effort_surface'] = surface;
|
||||
result['effort_argv'] = argvRendered.argv;
|
||||
result['effort_argv_string'] = argvRendered.argv.join(' ');
|
||||
result['effort_argv_value'] = argvRendered.value;
|
||||
}
|
||||
|
||||
if (!agentModels) result['unknown_agent'] = true;
|
||||
if (escalation) result['escalation'] = escalation;
|
||||
output(result, raw, effort);
|
||||
}
|
||||
|
||||
/**
|
||||
* ADR-1239 amendment (#2481) — resolve a host's negotiated `effortSurface`.
|
||||
*
|
||||
* Reads the host's runtime descriptor from the generated capability registry and
|
||||
* runs it through the Host-Integration negotiation so the trust-boundary invariant
|
||||
* applies here exactly as everywhere else: an unknown host, a missing axis, or the
|
||||
* `undocumented` sentinel all degrade to the safe floor rather than being trusted.
|
||||
* Never throws — a lookup failure yields `'none'`, which renders no argument.
|
||||
*/
|
||||
function effortSurfaceForHost(cwd: string, host: string): string {
|
||||
void cwd;
|
||||
try {
|
||||
// Mirrors the lazy-require pattern from runtime-slash.cts §runtimeSlash —
|
||||
// capability-registry.cjs is generated and carries no type declarations.
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
const { runtimes } = require('./capability-registry.cjs') as {
|
||||
runtimes: Record<string, { runtime?: { hostIntegration?: unknown } }>;
|
||||
};
|
||||
const declared = runtimes[host]?.runtime?.hostIntegration;
|
||||
if (!declared || typeof declared !== 'object') return 'none';
|
||||
// The descriptor is untrusted JSON; negotiation applies the trust-boundary
|
||||
// invariant (effective ⊆ host-declared ∩ engine-known) and fails closed.
|
||||
const negotiated = hostIntegrationMod.negotiateHostCapabilities(declared);
|
||||
const surface: unknown = negotiated?.effective?.effortSurface;
|
||||
return typeof surface === 'string' ? surface : 'none';
|
||||
} catch {
|
||||
return 'none';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* #488 — Replace or inject the `effort:` value in YAML frontmatter.
|
||||
* Unlike injectEffortFrontmatter (install.js), this overwrites an existing value.
|
||||
|
||||
Reference in New Issue
Block a user