Repository navigation
feat: three-state base_url semantics for runtime config switching - #565
Conversation
Distinguish "not provided" (UNSET, keep current) from explicit None (reset to provider default) across the runtime replacement chain: RuntimeReplacementService, LocalDaemonRuntimePreparationService, SessionManager.replace_session_runtime_config, and the local CLI session manager protocol. Previously None was overloaded as "keep", so a session's base_url could never be cleared back to the provider default once set. Verified: tests/coding_agent/test_runtime_replacement_service.py (5 passed, including new clear + rollback-after-clear cases). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Use model_fields_set to distinguish omitted fields from explicit null: omitted = unchanged, base_url null = reset to provider default, value = set. Explicit null for model/provider/thinking has no meaningful reset target and is rejected with 422 via a field validator. Empty body still returns 400. Verified: tests/coding_agent/test_runtime_config_schema.py (6 passed). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A mode that names a provider now fully describes that provider's config: an omitted base_url resets to the provider default instead of leaking the previous mode's endpoint onto the new provider. Model-only modes (no provider, no base_url) keep the session's current endpoint. Also updates three stale test assertions that predate the #563 modes feature (initialize response now advertises modes; unknown-modeId error message changed) and adds FakeManager.replace_session_runtime_config. Verified: tests/acp (63 passed, was 3 pre-existing failures). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The repl fakes for replace_session_runtime_config and _build_session_runtime were not updated when #563 added provider_name, leaving two tests failing on main with TypeError. Widen the fake signatures to match the real call sites. Verified: tests/cli/test_repl.py (53 passed, was 2 failures). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (12)
📝 WalkthroughWalkthroughThis PR introduces a sentinel-based ChangesThree-State base_url Configuration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Follow-up to #563/#564.
base_urlhandling across the runtime-config switching stack was two-state (None= keep), which meant a session'sbase_urlcould never be cleared back to the provider default once set. This PR introduces three-state semantics end to end:UNSET— keep the session's current valuenull/None— reset to the provider defaultCore (
coding_agent/runs)UNSETsentinel inreplacement.py, threaded throughRuntimeReplacementService,LocalDaemonRuntimePreparationService,SessionManager.replace_session_runtime_config, and the local CLI session-manager protocol.base_url_overridepath).HTTP (
PATCH /sessions/{id}/runtime-config)model_fields_setdistinguishes omitted fields from explicitnull.base_url: nullresets to provider default;nullformodel/provider/thinkingis rejected with 422 (no meaningful reset target); empty body still 400.ACP (
session/set_mode)base_urlresets to the provider default instead of leaking the previous mode's endpoint onto the new provider. Model-only modes keep the current endpoint.Test repairs in touched areas
provider_namekwarg added in feat: runtime config switching across REPL, ACP, and HTTP #563 (failing on main with TypeError).Tests
tests/coding_agent/test_runtime_replacement_service.py— 5 passed (new: clear, rollback-after-clear)tests/coding_agent/test_runtime_config_schema.py— new, 6 passedtests/acp— 63 passed (was 3 pre-existing failures)tests/cli/test_repl.py— 53 passed (was 2 pre-existing failures)tests/coding_agent tests/cli tests/acp tests/ui/test_session_manager_runtime.py): failure-set diff vs main shows exactly 5 failures fixed, 0 introduced (37 → 32; remaining 32 are pre-existing on main).🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
Refactor
nullvalues (reset where applicable), and provided values (update configuration).nullvalues for non-resettable configuration fields.