Skip to content

fix(roadmap): a Service stop lets the round in flight end - #4489

Merged
dan-petty merged 3 commits into
mainfrom
fix/4485-service-rollout-stops-stage-rounds
Nov 11, 2026
Merged

dan-petty merged 3 commits into
mainfrom
fix/4485-service-rollout-stops-stage-rounds

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

A rollout of roadmap-service stopped the stage and refine rounds in flight with no record. The drain started new rounds, rows and items, and after 120 s the process exited under the round: the model work of the item was lost, and a GitHub request in flight failed and counted as a failure.

Now the stop has two bounded phases. On SIGTERM no round, row, stage item or refine item starts, and the rounds in flight get 600 s to end (91% of stage plan steps end within 600 s). Then the budget refuses every GitHub request, so a round still in flight ends within 30 s through the stop path of #2753: it writes the items it did and counts no failure. A row that did not start stays due.

The pod grace period goes from 150 s to 660 s. The setting service.drain_timeout_seconds is removed, because the manifest cannot follow a setting.

Closes #4485

Change: openspec/changes/archive/2026-11-11-4485-a-service-rollout-stops-stage-rounds/

@dan-petty dan-petty added type/bug Type bug: the code does not do what it must scope/roadmap The roadmap jobs: intake, refine, stage, implement and the Service that runs them labels Nov 11, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Tests and measurements

  • uv run devops ci fail-to-pass --base origin/main: exit 0. On the base, 5 modules could not collect (the new module roadmap/service_stop.py and the new constants do not exist there), and 3 tests failed: test_a_cut_budget_refuses_a_request_that_the_window_has_room_for (RequestBudget has no cut), test_render_active_devops_configmap_produces_valid_yaml and the variable list of test_config_declarations (the removed setting). 129 tests passed on the base.
  • 240 tests of the changed modules pass after the rebase. A wider run of tests/server, tests/roadmap/stage, tests/roadmap/refine, tests/roadmap/test_roadmap_run*.py, tests/k8s and tests/config: 3,909 passed, and the one failure (the old grace period of 150 in test_k8s_roadmap_service.py) is fixed in this branch.
  • devops ci --only constructs,test-tree,k8s,swallowed-failures,lint,format: all pass. devops ci docs and devops openspec check pass. The pre-push hook passed. I did not run the full local devops ci: other agents held ci.lock, so the GitHub checks are the full gate.
  • Wait from Prometheus, 14 days: devops_cli_roadmap_step_seconds{row="stage",step="plan"}, 403 steps, mean 299 s, 91% within 600 s, 98% within 900 s. Loki: 69 "Shutting down" lines in 4 days, each with exactly 120 s from "Waiting for application shutdown." to "Application shutdown complete.".
  • An Argo CD sync window on the AppProject is not in this change: it delays every sync of the devops Application, self-heal too, and with the drain a rollout no longer stops a round.

Rollout steps for a person

The change has two parts, and each reaches the cluster by itself:

  1. Manifest: no manual apply. Argo CD Application devops syncs k8s/overlays/homelab/devops from main with automated sync. After the merge it sets terminationGracePeriodSeconds: 660 on Deployment devops/roadmap-service. The template change rolls the pod one time on the image it runs now, so that one rollout still uses the old 120 s drain.
  2. Code: with the next image. The service image changes only with a release (k8s/README.md, Service Image Updates). Image Updater puts the devops Application on the new digest, and from that pod on the stop drains in two phases. Until then the old code runs under the longer grace period, which does no harm.
  3. Setting: delete after the merge, in any order. ServiceConfig ignores an unknown key, so the Service does not fail on the old key. Delete these lines:
    • config.yaml, under service:: drain_timeout_seconds: 120
    • the live ConfigMap: kubectl -n devops edit configmap devops-cli-config, and delete drain_timeout_seconds: 120 under service: in devops-cli.yaml. Or run uv run devops k8s deploy-stack --stack devops after the config.yaml edit, which writes the ConfigMap again from the settings.

Checks after the new image runs

  • kubectl -n devops get deploy roadmap-service -o jsonpath='{.spec.template.spec.terminationGracePeriodSeconds}' prints 660.
  • At the next rollout, the pod log shows "Waiting for application shutdown." and then "Application shutdown complete." When a round runs, the gap is the rest of that round's item, not a fixed 120 s. The line "The drain wait of 600 s is over" shows a round that ran past the drain wait.
  • Loki: {namespace="devops", container="service"} |= "session closed" shows no new lines after a rollout.
  • A node drain or kubectl -n devops scale deployment roadmap-service --replicas=0 now waits up to 11 minutes for this pod when a round runs.

@dan-petty
dan-petty force-pushed the fix/4485-service-rollout-stops-stage-rounds branch from d127a87 to d666ef0 Compare November 11, 2026 04:41
@dan-petty
dan-petty marked this pull request as ready for review November 11, 2026 05:05
@dan-petty
dan-petty enabled auto-merge (squash) November 11, 2026 05:06
@dan-petty
dan-petty merged commit 7851db8 into main Nov 11, 2026
32 checks passed
@dan-petty
dan-petty deleted the fix/4485-service-rollout-stops-stage-rounds branch November 11, 2026 05:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/roadmap The roadmap jobs: intake, refine, stage, implement and the Service that runs them type/bug Type bug: the code does not do what it must

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(roadmap): a Service rollout stops stage rounds with no record

1 participant