Skip to content

Kill recipes via the StepContext#413

Merged
x46085 merged 2 commits intomainfrom
feat/killable-recipes
Jan 15, 2026
Merged

Kill recipes via the StepContext#413
x46085 merged 2 commits intomainfrom
feat/killable-recipes

Conversation

@x46085
Copy link
Contributor

@x46085 x46085 commented Jan 14, 2026

It can be useful to decide to proactively kill s10 managed recipes at some step in the simulation. This creates that capability.


Note

Introduce graceful external-process termination from simulation callbacks.

  • Add ctx.stop_recipes() to StepContext (passes CancelToken) to signal s10-managed recipes to stop
  • WorldBuilder.run spawns s10 with run_recipe_with_token and injects the cancel token into pre/post StepContext
  • s10 CLI: add run_recipe_with_token and keep Ctrl+C handling; run_recipe wraps it
  • s10 ProcessArgs.run: on cancel, send SIGTERM (Unix), wait ~2s, then force-kill; kill immediately on non-Unix
  • Docs: document stop_recipes() in Python API and update SITL example (MAX_TICKS, max_ticks, time.sleep(0.5))

Written by Cursor Bugbot for commit 8c4177c. This will update automatically on new commits. Configure here.

@x46085 x46085 requested review from shanecelis and zxq82lm and removed request for zxq82lm January 14, 2026 22:19
@github-actions
Copy link
Contributor

📚 Documentation Preview Ready!

Your documentation changes have been deployed to:
🔗 https://docs.elodin.systems/preview/pr-413/

This preview will be automatically updated when you push new commits.
The preview will be removed when this PR is closed or merged.


Preview deployment started at Wed, 14 Jan 2026 22:19:52 GMT

github-actions bot added a commit that referenced this pull request Jan 14, 2026
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cd148a8a13

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 346 to 350
/// Gracefully terminate all s10-managed recipes (external processes).
///
/// This signals all processes managed by s10 (registered via `world.recipe()`) to shut down
/// gracefully. The processes receive SIGTERM and have approximately 2 seconds to clean up
/// before being force-killed.

Choose a reason for hiding this comment

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

P2 Badge Align stop_recipes behavior with its SIGTERM+grace claim

The new stop_recipes API is documented here as sending SIGTERM and allowing ~2 seconds for cleanup, but the implementation only cancels the s10 CancelToken. For common recipe types (e.g., ProcessRecipe/CargoRecipe), cancellation immediately calls child.kill() with no grace period, so external processes will be force‑killed rather than shut down cleanly. Callers who rely on this method to flush state or perform cleanup will still see abrupt termination. Either update the docs/comments to reflect the actual behavior or add a SIGTERM+timeout path in the s10 cancellation logic.

Useful? React with 👍 / 👎.

@github-actions
Copy link
Contributor

📚 Documentation Preview Ready!

Your documentation changes have been deployed to:
🔗 https://docs.elodin.systems/preview/pr-413/

This preview will be automatically updated when you push new commits.
The preview will be removed when this PR is closed or merged.


Preview deployment started at Wed, 14 Jan 2026 22:44:15 GMT

Copy link
Collaborator

@shanecelis shanecelis left a comment

Choose a reason for hiding this comment

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

Looks good to me, but I don't have a ready means of exercising it, so I'm relying on compilation and author's runtime validation.

@x46085 x46085 merged commit 5d844c4 into main Jan 15, 2026
14 checks passed
@x46085 x46085 deleted the feat/killable-recipes branch January 15, 2026 04:08
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

Comments