Repository navigation
feat(cli): gate and apply low-risk project config keys at startup (#208, part 3a) - #345
Merged
Merged
Conversation
…, part 3a) Wire the config trust gate into startup (every command except config, upgrade, approvals), add --config/--no-config as global flags, a pure flag > env > config > default precedence framework, and apply only the low-risk keys (model, base_url, system_prompt, memory, sessions_dir, workspace, [mission] budgets). Security-sensitive keys stay parsed but unapplied. tole config check shows effective values and sources. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
This was referenced Oct 9, 2026
Merged
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.
What
Part 3a of 4 of #208: wire the project-config trust gate into startup, add
--config/--no-configas global flags, add a pure flag > env > config > default precedence framework, and apply ONLY the low-risk keys:model,base_url,system_prompt,memory,sessions_dir,workspace,[mission]max_steps/max_minutes/max_tokens. Security-sensitive keys (trust, allow, mcp_server, hooks, skill, plan_mode, no_auto_mcp, no_skills, mission.verify, mission.verify_timeout) are still only parsed/validated (3b).Why
Parts 1-2 built the loader and the trust store but nothing ran at startup. This makes a trusted
.tole/config.tomltake effect safely, with unchanged behavior for projects that have no config.Changes
Size: 14 files, +1895/-98. Tests ~1000 lines (
tests/config_apply.rs477,config_apply_tests.rs~430,main_gate_tests.rs~80); new codeconfig_apply.rs~430; docs ~60. Kept as one PR because a framework with nothing wired would be dead code.config,upgrade,approvalsskip the gate.run/chat/resume/missionmay prompt only when stdin AND stderr are terminals and not--prompt-file -.sessions,status,serve,acp,mcpnever prompt and fail closed with the exacttole config trustinstruction; the command does not run.--no-configskips discovery/gate/output;--config pis trusted without the store (store path is not even resolved). The gate runs before the update banner. One stderr linetole: using config <path>on success. The gate's vetted bytes are parsed; the file is never re-read.tole_cli::config_apply):Source {Flag, Env, Config, Default}(+Display),resolve,resolve_or,resolve_string,resolve_string_or(blank env/config = unset),Eff<T>,Flags,Settings::resolve(&Flags, &Config, env)shared by startup andconfig check. 3b addsresolve_listand the boolean rule alongside.OnceLock<ProviderFill>in tole-cli is installed only after a config passed the gate and parsed (empty otherwise, so every reader behaves as today).provider_config()replaces everyOpenAiConfig::from_env()call: pass 1 is exactlyfrom_env(complete env triple wins), and only if none is complete may the config fill base_url/model for a prefix that already has an env API key. API keys are never read from config. Acceptable because the cell is write-once, read-only afterwards and a no-op without a loaded config; it avoids threading a parameter through serve/acp/mcp.main.rsdispatch; provider config in run/resume/chat,mission.rs,session_host.rs, ACP probe and advertised model.config checkprintskey = v [config] effective: ... (source)for applied keys and(parsed, not applied yet — 3b)for the rest, using the same resolution as startup.--helpdifferences: per-action--configonconfig check|trust|untrustreplaced by the global one (bothconfig check --config pand--config p config checkwork); two new global flags on every command; updatedconfigsubcommand text. No clap-default flags needed changes. Existing option order unchanged.Testing
sessionswith HOME/CODECORA_HOME removed, asserts empty stderr and stdout byte-identical to--no-config;statuserror unchanged; unit test panics if the store is resolved with no config.--no-config, explicit--config, modified file, serve/acp/mcp fail fast, flag/env beat config, mock provider sees config model and env override).plan_modefails the e2e 3b test.--workspace --all-targets -D warnings,cargo test --workspace, bare-profile and shell-tools checks, tole-core--no-default-features --testsall pass.Part of #208
🤖 Generated with Claude Code