Skip to content

A step whose ending the plan gate refused queues the owed step - #962

Merged
coderhelm[bot] merged 2 commits into
mainfrom
plan-gate-refused-step
Dec 4, 2026
Merged

coderhelm[bot] merged 2 commits into
mainfrom
plan-gate-refused-step

Conversation

@nambok

@nambok nambok commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Follows #956. When a run's plan still owes a repository, the end gate refuses its done or waiting ending. Before this change, a step whose ending was refused left the run "running" with no step queued. The plan sweep read every running run as building, so nothing queued the owed repository; the stuck-run sweep later ended the run as a timeout or an unfinished round.

Now the step that was refused queues the owed step as it ends, and the plan sweep restarts a running run that has had no step for longer than a step can take.

Changes

  • common::run_ending: records each run a gated (done or waiting) ending was asked for in this process (take_gated, bounded).
  • worker::plan_continue::after_step: the Ticket, Feedback and Resume handlers call it when a step ends. For each recorded run that is still running, has no step queued since the step began, and still owes a repository, it queues the owed step. The claim requires that no step was queued since, so it never starts a second one.
  • worker::plan_continue::orphaned: the plan sweep's backstop. A running run that owes a repository, with no step queued after its last write and no write for 20 minutes, gets its step queued. The claim only goes through if the record is unchanged.
  • lambda/stuck-run-cleanup: leaves a running run that owes part of its plan to the worker for 60 minutes before ending it as usual (plan_owed is now read by its scan).

Verification

  • Unit tests: a gated ending is recorded and taken once, and a working write is not. A run left running with nothing queued is found after its step; a step that queued the next one, a run with nothing owed and a finished run are left alone. The sweep acts only past the lease, and only when no step is waiting in the queue. The handlers are wired, and the stuck-run sweep waits longer than the lease. Lambda: the plan-owed wait and its end.
  • cargo fmt --all --check, rustfmt --check on the incident files, cargo clippy -p common -p worker -p gateway --all-targets -- -D warnings, cargo test -p common -p worker -p gateway, the lambda unit tests and node tests, brand_spelling.py and domain_examples.py.

A done or waiting ending the end gate refuses (the run's plan still owes a
repository) left the run "running" with nothing queued. The plan sweep read
any running run as building, and the stuck-run sweep later ended it as a
timeout or an unfinished round after 20 minutes, never building what the
plan owed.

- run_ending remembers each run a gated ending was asked for in this
  process. When a ticket step, a feedback round or a resume ends, each such
  run that is still running with no step queued since the step began, and
  whose plan owes a repository, gets the owed step queued
  (plan_continue::after_step). The claim requires that no step was queued
  since, so it never starts a second step.
- The plan sweep is the backstop: a running run that owes a repository,
  with no step queued after its last write and no write for 20 minutes,
  gets its step queued (plan_continue::orphaned), claimed only while the
  record is unchanged.
- The stuck-run sweep leaves a running run that owes part of its plan to
  the worker for 60 minutes before ending it as usual.
@nambok nambok added the ch-review CoderHelm reviews this pull request label Dec 4, 2026
coderhelm[bot]

This comment was marked as outdated.

@coderhelm

coderhelm Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

🟡 Post-merge health check: deploy cancelled: the deploy for f27f64d was cancelled; nothing later deployed it.

@coderhelm coderhelm Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Approved eaa8c67 (merged)

@coderhelm
coderhelm Bot merged commit f27f64d into main Dec 4, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ch-review CoderHelm reviews this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant