Repository navigation
feat(server): graceful drain + pod lifecycle (ADR-0070 D2) - #611
Conversation
So a rolling-update/restart (incl. the #606 config-checksum auto-roll) drains in-flight turns instead of being SIGKILLed. Helm: values-driven lifecycle — terminationGracePeriodSeconds (default 60, was the k8s default 30) + a gated preStop sleep (preStopSleepSeconds default 5, 0 disables). Rendered in deployment.yaml. App: graceful shutdown previously cancelled the in-flight turn (run status cancelled, indistinguishable from a user cancel) and startup recovery only rewrites still-running runs to interrupted, so the run stayed cancelled. lifespan now calls shutdown_session_runtime(interrupt_active_turn=True); that path rewrites the active stopped run to interrupted with reclaimable metadata. Idle cleanup keeps the default (no interrupt marking). Tests: test_helm_deployment_sets_graceful_drain; test_lifespan_shutdown_marks_active_turn_interrupted. Gate: 388 passed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 5 minutes and 41 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 (6)
✨ 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 (ADR-0070 D2)
A rolling-update/restart (incl. the #606 config-checksum auto-roll) could SIGKILL the process before in-flight turns drained — the chart set no
terminationGracePeriodSeconds(k8s default 30s) and nopreStop. And graceful shutdown left in-flight turns in the wrong durable state.What
Helm (values-driven
lifecycle:):terminationGracePeriodSeconds(default 60) rendered on the pod spec.preStopsleep (preStopSleepSecondsdefault 5;0disables) for drain headroom.App — fix a real shutdown-semantics gap found during implementation:
cancelled(indistinguishable from a user cancel), and startup recovery only rewrites still-runningruns tointerrupted— so the run stayedcancelled.lifespannow callsshutdown_session_runtime(interrupt_active_turn=True); that path rewrites the active stopped run (running/cancelling/cancelled) tointerruptedwith reclaimable metadata. Idle cleanup (D1) keeps the default — no interrupt marking, no deletion.Test
test_helm_deployment_sets_graceful_drain(defaults / overrides / preStop disable)test_lifespan_shutdown_marks_active_turn_interrupteduv run pytest tests/deploy/test_helm_chart.py tests/ui/test_http_server.py tests/ui/test_session_manager_public_api.py→ 388 passed.Completes the ADR-0070 series (#608 docs, #610 D1). ArgoCD (#71) implementation is intentionally deferred until D1+D2 are live.
🤖 Generated with Claude Code