Soft-deprecate env vars superseded by users.yaml#226
Conversation
When users.yaml exists, log a WARNING for each deprecated env var that is still set: CLAUDE_MODEL, CLAUDE_MAX_BUDGET_USD, CLAUDE_TIMEOUT_SECONDS, CLAUDE_MAX_CONTEXT_WINDOW, CLAUDE_USER, WORKSPACE_BASE, ALLOWED_WORKSPACES, PR_REVIEW_ENABLED, ISSUE_TRIAGE_ENABLED, GITHUB_NOTIFY_CHAT_ID. Each warning includes the specific migration path. Vars continue to work as fallbacks.
When users.yaml exists, the config wizard now skips interactive prompts for deprecated per-user env vars (model, timeout, budget, context window, workspaces, PR review, issue triage, GitHub notifications, CLAUDE_USER). Instead it prints a short migration message and silently preserves existing values. The env file output also omits deprecated keys when users.yaml is present, keeping the generated .env clean. Truly global vars (autocompact, PR_REVIEW_COOLDOWN) are always written. .env.example updated: deprecated vars are commented out with migration notes pointing to users.yaml and Telegram commands.
Three new test classes proving the deprecation path works end-to-end: - TestMinimalEnvWithUsersYaml: config loads with zero deprecated env vars, per-user model/budget/workspace/github overrides work - TestResolutionWithoutEnvVars: resolve_github_settings and resolve_workspace_access produce correct results when env var globals are at defaults and per-user config provides the values - TestLegacyEnvOnlyMode: single-user installs without users.yaml still work exactly as before with no deprecation warnings 12 new tests (91 total in test_config.py, 1424 suite-wide).
Review by KaiPR Review: chore/deprecate-env-varsOverall this is clean, well-structured work. A few issues worth flagging: Warning
In the else:
# PR_REVIEW_COOLDOWN is a global rate limit - always write it
# when review is enabled for any user, even with users.yaml.
if pr_review_enabled and pr_review_cooldown != "300":
env["PR_REVIEW_COOLDOWN"] = pr_review_cooldown
Fix: when if pr_review_cooldown != "300":
env["PR_REVIEW_COOLDOWN"] = pr_review_cooldownSuggestion
Both variables are initialized and updated in lockstep through the
The test relies on No security issues, no auth bypasses, no injection surface introduced. The backward-compatibility story is solid. |
- Fix PR_REVIEW_COOLDOWN gate: drop pr_review_enabled condition in users_yaml_exists branch so non-default cooldown is always written regardless of whether the deprecated global env var was set - Collapse has_users_yaml into users_yaml_exists (redundant variable) - Add explicit caplog.at_level guards to deprecation warning tests so they remain robust if the logger level changes in CI
Review by KaiThis is clean work. The prior review's main bug (PR_REVIEW_COOLDOWN gated on the deprecated flag) was fixed correctly. The Suggestion
The dict is defined inside the Suggestion
In the pr_review_cooldown = existing_env.get("PR_REVIEW_COOLDOWN", "300")
# ...
if pr_review_cooldown != "300":
env["PR_REVIEW_COOLDOWN"] = pr_review_cooldownThe non-users_yaml path validates via Suggestion
resolved = user.model if user.model else config.claude_model
assert resolved == "opus"This duplicates the resolution logic inline rather than calling the actual No security issues, no auth bypasses. The backward-compat story is solid and the 22 new tests cover the meaningful cases well. |
Review by KaiLooking at the diff with the prior review context in mind, I won't re-raise the three open suggestions (module-level dict, cooldown validation asymmetry, inlined pool resolution). Here are new findings: Suggestion
def test_no_deprecation_warnings(self, monkeypatch, caplog):
_set_required(monkeypatch)
monkeypatch.setenv("CLAUDE_MODEL", "opus")
load_config()
assert "deprecated" not in caplog.text.lower()Same false-positive risk that was fixed in Suggestion
Every other deprecated section in print(" Model, timeout, budget, and context window are now per-user.")
print(" Set defaults in users.yaml or let users configure via /settings.")But the Otherwise the PR is clean. The |
Review by KaiThis diff addresses both issues raised in the third review: The three open suggestions from prior rounds (module-level No new issues found. The PR is clean. |
Fixes #199.
Summary
Soft-deprecate 10 env vars that are now superseded by per-user config in users.yaml. No env vars are removed; existing installs continue to work unchanged.
Test plan