Repository navigation
fix(server): make mixed runtime-config update atomic (#607 follow-up) - #609
Conversation
PR #607 applied approval/thinking in-place and persisted BEFORE the fallible replace_session_runtime_config call. A request mixing approval (and/or thinking) with model/provider/base_url would leave the approval policy changed + persisted even when the runtime replacement raised — a partial, non-atomic update. Reorder so the fallible rebuild runs first; only after it succeeds apply thinking_config and approval (to the rebuilt updated_session, so a new pipeline's ApprovalPlugin gets the new policy) and persist once. Approval/thinking-only updates keep the no-rebuild fast path. Add a regression test asserting that when approval+thinking+model are sent together and the replacement raises, the live plugin policy, session.approval_policy, thinking_config, and the persisted store are all unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 45 minutes and 5 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 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 |
Why
PR #607 (mid-session approval) applied approval/thinking in-place and persisted before the fallible
replace_session_runtime_configcall. A request mixingapproval(and/orthinking) withmodel/provider/base_urlwould leave the approval policy changed on the live plugin and persisted even when the runtime replacement raised (5xx/409) — a partial, non-atomic update: session ends with new approval but old provider/model.Fix
Reorder
update_runtime_configso the fallible rebuild runs first; only after it succeeds applythinking_configand approval — and apply them to the rebuiltupdated_sessionso a freshly rebuilt pipeline'sApprovalPlugingets the new policy — then persist once. Approval/thinking-only updates keep the no-rebuild fast path; 409 (turn in progress) and 400 (no fields) behavior preserved.Test
New regression: approval + thinking + model sent together with
replace_session_runtime_configmonkeypatched to raise → live plugin policy,session.approval_policy,thinking_config, and the persisted store all unchanged. (Fails before the reorder.)uv run pytest tests/ui/test_http_server.py→ 268 passed.🤖 Generated with Claude Code