Repository navigation
Runs keep going while they make progress; a step's time never fails a run - #357
Merged
Merged
Conversation
… run A new-feature run triaged, planned, built eight files and reached the generator check with 30 seconds of its 15 minute invocation left. The check declined to start a sandbox build and the run failed "not enough time left", with the work done and the generator never run (the coder had not called run_codegen). - Every place that lacked time hands off instead: the run continues in a fresh step (a new queue message, its own 15 minutes) at the exact point: after implement (generators, test, security), the generator check, or the checks before the pull request. The skipped stages' results (the security verdict and its parked round) travel on the checkpoint. - The fixed bounds (3 continuations, 45 minutes) are replaced by a progress rule: a run continues while its steps move the branch head or reach a later gate; two steps in a row without progress stop it with what was stuck; the team's usage limit and cancelling still stop it; a 50 step ceiling guards against a runaway loop only. - The worker runs a generator itself right after the implement work when the work changed its inputs, and commits the output; the late generator gate verifies (no second build when nothing it reads changed since). - A codegen build CodeBuild timed out is a tooling failure. - The run record's progress notes and pass history are bounded under the 400 KB item limit (older notes move to S3). - The stuck-run sweep leaves a run alone while its next step is queued. - Worker queues: visibility 5,400 s (6x the 900 s function timeout) and a redrive count of 5, as AWS asks for SQS sources of Lambda.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A new-feature run triaged, planned (about 6 minutes of plan review), built eight files and reached the generator check with 30 seconds of its 15 minute invocation left. The check declined to start a sandbox build and failed the run: "the generator couldn't run here to regenerate them (not enough time left)". No generator build ran during the whole run, because the coder never called
run_codegen.Now a step's time never fails a run. Every place that lacked time hands the run to a fresh step (a new queue message with its own 15 minutes) that resumes at exactly that point, and the worker runs generators itself right after the implement work. The fixed continuation bounds are replaced by a progress rule: a run keeps going while its steps make progress.
Changes
Steps and progress (
services/worker/src/passes/steps.rs, new;mod.rs)Gate::Verify(worker generator run, adversarial test, security audit),Gate::GeneratorsandGate::Checks(proof, links, test-fix and new-feature checks, then the PR). The gate and what the skipped stages carry (the security verdict and its parked round) live on the run's checkpoint item. The message carries only the run id and step number.MAX_CONTINUATIONS = 3,MAX_CONTINUATION_WALL_SECS = 45 min(and the first step's time was not counted). After: no count or wall-clock cap. Each step compares the branch head and resume point with where the previous step started. Two steps in a row without progress stop the run, naming the steps, the commit and where it was stuck. The team's usage limit (check_budget_exceeded) stops it before the next step is queued, and every step still starts with that check. Cancelling still stops it (resume_run_to_running).MAX_RUN_STEPS = 50is only a runaway ceiling and logs an error if it is ever hit.try_auto_continuereturns why it couldn't continue, sends a new message (never a retry or redelivery of the current one), writes "...: continuing in step N with its own time budget" to the run page, and recordsrun_stepandstep_queued_aton the run.Where time used to fail or cut a run (
mod.rsrun_passes,hand_off_at)GateStop::NeedsTimehands off atGenerators(it used to fail with "not enough time left").TimeBudgetthat remembers when it refused a fix round for time. A check that then blocks the PR hands off atChecksinstead of failing.Checks.Verify(the adversarial test used to be skipped silently).Generators run with the work (
generators.rs)after_step: when the branch changes files a detected generator reads, the worker runs it in the sandbox right after implement and commits the output. It does not depend on the coder callingrun_codegen.gate(.., fresh)only verifies, with no second build, when nothing the generator reads changed since that run.Ran::OutOfTime/Pass::OutOfTimeseparate a step without runway from a real failure.TIMED_OUT) is reported as a tooling failure (sandbox.rs).Run record size (
run_lists.rs, new)implement.rs, are appended with asize(progress_notes) < 250condition.runs/<team>/<run>/notes/<ms>.json). The item keeps the newest 200 and counts the moved notes innotes_archived.pass_historyis bounded the same way (200, keeping 150).Stuck-run sweep (
lambda/stuck-run-cleanup/handler.py)runningrun whose next step is queued and hasn't started (step_queued_atafterupdated_at, for less than 6 h) is not swept.Queues (
infra/lib/api-stack.ts)maxReceiveCount5, as AWS recommends for SQS sources of Lambda.Future options, not in this PR: Lambda durable functions (checkpointed long-running execution) and Lambda Managed Instances (longer invocations) could replace the self-continuation. Both are larger migrations.
Verification
cargo fmt --all --check: clean.cargo clippy --workspace --all-targets -- -D warnings: clean.cargo test --workspace: common 1281, gateway 605, worker 970, 2 more; 0 failed.python3 -m unittestfor the stuck-run sweep: 18 passed.infranpm test: 78 passed.maxReceiveCount.TIMED_OUT.Gaps:
feedback.rs) is still appended unbounded (one entry per round).