Repository navigation
Description
Problem Description
A rollout of roadmap-service stops the stage and refine rounds in flight, and the stopped round writes no record.
- The Deployment uses the
Recreatestrategy withterminationGracePeriodSeconds: 150(k8s/devops/roadmap-service/deployment.yaml). - On SIGTERM,
ServiceManager.drain_and_stopwaitsservice.drain_timeout_seconds(120 s) for the workers. During this wait a worker can start a new round, and a round can start a new row and a new item. - The stop does not end a round in flight.
RequestBudget.close()refuses only a request that waits for a full budget window, soServiceStoppingErroralmost never comes. The existing stop path (fix(service): a round that ends because the Service is stopping counts as a failure and three of them suspend a row #2753, fix(roadmap): write each stage and alternatives item when done #4034: record the failures that came before, count the row asstopped) then does not run. - After 120 s the lifespan returns and the process exits. The worker threads stop with the process. The item in progress loses its model work, and a GitHub request in flight fails with "The GitHub session closed before ... was answered". The row counts that error as a failure.
Reproduction Steps
- Let the Service start a stage round that plans an item.
- Roll out the Deployment (
kubectl -n devops rollout restart deployment/roadmap-service). - Read the pod logs: "Waiting for application shutdown." and then "Application shutdown complete." 120 s later, with no "round stopped" line and no end line of the stage round.
Expected vs Actual Behavior
Expected: on SIGTERM, the Service starts no new round, row or item. A round in flight finishes its item within a bounded wait. A round that the bound cuts ends through the stop path: it writes the records of the items it did, counts no failure, and the next round takes the items it did not do. The Deployment grace period covers the bounded wait.
Actual: the drain waits 120 s, the grace period is 150 s, and the round in flight stops with the process. Measured (Loki, Prometheus, 2026-11-11):
- 69 "Shutting down" lines in the last 4 days. In each sample, "Application shutdown complete." comes exactly 120 s after "Waiting for application shutdown.", so a round was still in flight.
- Study of 14 days: since 2026-11-07, 53 of 71 restarts (75%) stopped a running stage round, about 13 a day and 32.4 h of stopped rounds; before that, 18 of 152 (12%).
- 18 "session closed" log lines in 14 days (8 errors) came from rows that the exit cut.
- About 146M tokens a week fall in the 10 minutes before a shutdown (context audit 2.2).
- Stage plan step, 14 days: 403 steps, mean 299 s, 91% end within 600 s, 98% within 900 s.
#3062 (closed) covered only the implement Job.
Environment Diagnostics
roadmap-service on k3s v1.37.2, one replica, Recreate, image from main. Argo CD applies k8s/overlays/homelab/devops from main.
Logs, Traces, or Terminal Output
01:25:52 uvicorn.error Shutting down
01:25:53 uvicorn.error Waiting for application shutdown.
01:27:53 uvicorn.error Application shutdown complete.
01:27:53 uvicorn.error Finished server process [1]
Fix direction: a stop flag that the worker, the row loop and the stage and refine item loops read; a bounded wait (a constant in config/constants.py, from the measured plan step times) that replaces service.drain_timeout_seconds; then a cut that makes the request budget refuse each GitHub request, so the round ends through its stop path; and a grace period in the Deployment that covers both. An Argo CD sync window on the AppProject can batch rollouts; that is a separate change.
Activity
dan-petty commentedon Nov 11, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
fixprefix of the title gives the type.(roadmap)scope of the title gives the scope.75% of restarts kill a running round and 146M tokens per week are lost, so the defect hits every rollout.Prevents loss of in-flight work and wasted model tokens on every Service rollout.The fix touches the stop flag, drain timeout, request budget, and Deployment grace period, but the direction is stated and the scope is bounded.Both concern the Service stop path; #2753 fixed the accounting when that path runs, while the candidate makes the path actually run during a rollout.docs(openspec): plan #4485 a bounded drain of the Service stop
docs(openspec): archive 4485-a-service-rollout-stops-stage-rounds (#4485
devops-cli-service commentedon Nov 11, 2026
Released in v0.111.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.111.0
devops-cli-service commentedon Nov 11, 2026
Live since 2026-11-11 05:46 UTC