Skip to main content

resolve_cadence_config

Function resolve_cadence_config 

Source
pub fn resolve_cadence_config(project_root: &Path) -> CadenceConfig
Expand description

Resolve a project’s CadenceConfig via the code_harness.* .claude/settings.json precedence chain crate::mode::resolve_mode establishes, adapted to this config’s two knobs.

Why: An operator needs to tune cadence per-project (settings.json) or per-process (the escape-hatch env vars) without a code change, matching every other code_harness.* knob in this crate. Unlike resolve_mode, there is no task.run-request tier — this ticket does not add a per-call cadence override to the wire protocol, so the chain is simply env var (highest) > settings.json > built-in default. What: Starts from .claude/settings.json’s code_harness.cadence_turns/ code_harness.max_overhead_fraction_pct (via [read_settings_json_cadence], falling back to CadenceConfig::default when the file/keys are absent or malformed — never an error, matching crate::mode::read_settings_json_mode’s graceful-degrade convention), then overrides either field from [CADENCE_TURNS_ENV_VAR]/ [CADENCE_OVERHEAD_FRACTION_ENV_VAR] when set to a valid usize (an unparseable value is logged via tracing::warn! and the prior tier’s value is kept, rather than erroring the whole run). Test: cadence::tests::resolve_cadence_config_settings_json_override, cadence::tests::resolve_cadence_config_env_wins_over_settings_json.