Repository navigation
refactor(config): dedupe sidecar path resolution and env overrides - #1161
Conversation
Replace the eleven copy-pasted getEffective<X>ConfigPath functions with one sidecarPath(fileName) resolver, and the nine hand-rolled apply<X>EnvOverrides functions with applySidecarEnv, which runs the existing viper-backed resolveViperEnvironmentVariables walker over each sidecar using an env-only viper instance so legacy blocks in config.yaml still cannot leak in. Closes #1154
|
@infer Can you review this PR? use /ponytail:ponytail /ponytail:ponytail-review /cobra-viper |
|
Model: Todos
Pull Request✅ Infer Result: SuccessAll checks done. The Review complete. Here are my findings: PR #1161 review (ponytail / ponytail-review / cobra-viper)Verdict: approve. This is the right kind of lazy - it deletes 557 lines of copy-paste and reuses the walker the main config already trusts. I traced every deleted hand-rolled function against the sidecar structs' mapstructure tags and found no regressions. One behavior delta deserves a conscious sign-off, and two optional shrinks remain. What I verified
One delta to consciously accept
Minor trivia, no action needed: ponytail-review findingsThe diff is the deletion: -557/+50. Two optional cuts left:
cobra-viper lensThe env-only viper instance is exactly the right idiom: one typed-config path, env applied after load so Test evidence
Follow-up notes
Model: Tokens: 931,725 in · 18,466 out · 950,191 total (16 requests) Tool calls: 35 total · 100% success rate TracesStatsTriggered by edenreich · Infer Action · OSS |
Trim and strictly parse bool/int/uint/float env values in the shared viper walker so a typo like INFER_CHANNELS_REQUIRE_APPROVAL=maybe keeps the file value rather than silently flipping the safety gate to false. Restores the semantics of the hand-rolled sidecar overrides for every sidecar at once.
|
Addressed the require_approval delta: setScalarFromViper now trims and parses bool/int/uint/float strictly and skips on failure, so INFER_CHANNELS_REQUIRE_APPROVAL=maybe or " true " keeps the file value instead of casting to false. Covered by TestApplySidecarEnv_StrictScalars. Prompts shrink and docs pass left for a follow-up. |
|
🎉 This PR is included in version 0.188.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Summary
Closes #1154.
getEffective<X>ConfigPath()functions incmd/runtime/config.gowith a singlesidecarPath(fileName)resolver (project.infer/first, then~/.infer/, then the project default).apply<X>EnvOverridesfunctions (channels, heartbeat, judge, computer_use, browser_use, memory, hooks, reminders, plugins) withapplySidecarEnv(cfg, prefix), which runs the existing viper-backedresolveViperEnvironmentVariableswalker over each sidecar struct. It uses an env-only viper instance, so themapstructure:"-"guarantee that legacy blocks inconfig.yamlcannot leak into sidecars still holds.applyPromptsEnvOverridesandapplyKeybindingEnvOverridesare different shapes and are untouched.Net: 50 insertions, 557 deletions.
Behaviour notes
Sidecar env parsing now matches how every other
INFER_*key already behaves:INFER_JUDGE_TIMEOUT=abc) yields 0/false instead of being silently ignoredINFER_PLUGINS_DIRis no longer trimmed or skipped when blankplugins.max_instructions_chars,reminders.merge) are now env-overridableTest plan
go test ./cmd/runtime/... ./config/...task precommit:run(mod tidy, mocks, fmt, lint) cleandaemon_overlay_test.go(env wins over~/.infer/channels.yaml, legacyconfig.yamlblock stays inert, path precedence),config_memory_test.go,config_reminders_test.go,config_pointer_env_test.go,userspace_first_test.go