Skip to content

feat(runner)!: submit() continues a stored instance, and a kept run is left up for its submitter - #256

Merged
AlexS-scale merged 4 commits into
mainfrom
AlexS/runner-resume-and-keep
Oct 19, 2026
Merged

AlexS-scale merged 4 commits into
mainfrom
AlexS/runner-resume-and-keep

Conversation

@AlexS-scale

@AlexS-scale AlexS-scale commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Second step towards task run and eval run always going through the configured [runner] (discussed on #236). Two CLI options only worked in-process because the Runner contract couldn't carry them.

Resume (--context-json + --start-step). Runner.submit() takes an optional instance_id. Given one, the run continues that instance from its stored context, at metadata["start_step"]. A caller resumes by naming the instance rather than by shipping a context, so contexts stay out of runner payloads (Temporal limits one to 2 MB).

  • LocalRunner seeds the run from the stored context, then lays the submitted metadata (per-run overrides, keys) over it.
  • With no task_version given, it runs the version the instance records, so a newer version never runs over an older instance's context.
  • An instance that records another task or version is refused: the run fails without running.
  • Task.run now drops the recorded failures of the steps it is about to run again. A resumed run whose failed step now passes therefore ends COMPLETED, under any runner.

--keep. A run whose metadata[KEEP_KEY] is set and that ends on its own, passed or failed, is left up. Its submitter tears it down, for example from the instance's stored context with teardown_run. A cancelled run is torn down either way: what a step in flight deployed is only in the runner's live context.

Breaking: Runner.submit gains a parameter, so an override with the old signature no longer matches. LocalRunner is the only implementation in this repo.

Tests: a kept run that completes is left up, and one that is cancelled is torn down. A run given an existing instance, with no version, gets that instance's stored context, its id, start_step and the stored version. One given an instance of another version fails without running. A run drops the recorded failures of the steps it runs again.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; the previous version-mismatch finding is fixed.

Summary

Adds stored-instance resume and lets submitters keep resources after a run finishes.

  • The runner can continue a stored task instance from its saved context.
  • Kept runs leave their deployments up when they finish on their own.
  • Rerunning a step clears its earlier failure from the run result.

The latest change rejects mismatched tasks and versions. No new actionable issues were found. Tests were inspected, not run.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A["Runner.submit"] --> B{"Stored instance?"}
  B -->|Yes| C["Use recorded version unless supplied"]
  C --> D{"Task and version match?"}
  D -->|No| E["Fail before running"]
  D -->|Yes| F["Restore context and apply overrides"]
  B -->|No| G["Create context"]
  F --> H["Task.run"]
  G --> H
  H --> I{"Finished on its own with keep?"}
  I -->|Yes| J["Leave resources up"]
  I -->|No| K["Tear down resources"]
Loading

Reviews (3) · Last reviewed commit: "fix(runner): a resume refuses an instanc..." · Reviewed by Greptile

@AlexS-scale
AlexS-scale requested a review from a team as a code owner October 19, 2026 16:34
Comment thread src/agent_env/runner/local_runner.py
Comment thread src/agent_env/runner/local_runner.py Outdated
@AlexS-scale
AlexS-scale merged commit 42b65fa into main Oct 19, 2026
15 checks passed
@AlexS-scale
AlexS-scale deleted the AlexS/runner-resume-and-keep branch October 19, 2026 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants