Skip to content

fix: allow resume of stopped coderunner container#22

Merged
mkagenius merged 2 commits into
instavm:mainfrom
mvanhorn:fix/4-coderunner-resume-after-stop
May 16, 2026
Merged

fix: allow resume of stopped coderunner container#22
mkagenius merged 2 commits into
instavm:mainfrom
mvanhorn:fix/4-coderunner-resume-after-stop

Conversation

@mvanhorn

Copy link
Copy Markdown
Contributor

Summary

install.sh always launched the sandbox with container run --rm, which destroys the container on container stop. There was no documented or supported path to stop the sandbox and resume it later: the next ./install.sh ran container image pull and container run --rm again, starting from a fresh state every time.

Two changes:

  1. Try container start coderunner at the top of install.sh. If the container exists, resume it and exit early. If it doesn't, fall through to the pull + run path.
  2. Drop --rm from container run so the sandbox survives a container stop.

README adds a ## Stop and resume section documenting both paths (resume the same sandbox, or container delete + re-install for a clean start).

Why this matters

#4 (filed by @mkagenius in July 2025) asks for the ability to resume coderunner after stopping it. The current install script makes that impossible by design (--rm). Keeping uploads, kernels, and pip-installed packages across restarts is a reasonable workflow for an MCP-served sandbox; the alternative is reinstalling deps every restart, which defeats the persistent-assets dir the installer already creates at ~/.coderunner/assets.

Closes #4

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces container persistence by removing the --rm flag from the container run command and adding logic to resume existing containers in install.sh. The README.md has been updated with instructions for stopping and resuming the sandbox. A review comment suggests updating a log message in the installation script to accurately reflect the volume mounts being used, which would improve clarity for users debugging their setup.

Comment thread install.sh Outdated

# Run the command to start the sandbox container
echo "Running: container run --name coderunner --detach --rm --cpus 8 --memory 4g instavm/coderunner"
echo "Running: container run --name coderunner --detach --cpus 8 --memory 4g instavm/coderunner"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The echo message is misleading as it omits the --volume flags that are actually being used in the subsequent container run command. Since persistence is a key feature of this PR, showing the volume mounts in the log (or using a more generic message) would improve clarity for users debugging their setup.

Suggested change
echo "Running: container run --name coderunner --detach --cpus 8 --memory 4g instavm/coderunner"
echo "Running: container run --volume \"$ASSETS_SRC/skills/user:/app/uploads/skills/user\" --volume \"$ASSETS_SRC/outputs:/app/uploads/outputs\" --name coderunner --detach --cpus 8 --memory 4g instavm/coderunner"

The log message printed before starting the coderunner container
omitted the --volume mounts that are actually applied. With the
volumes added in this PR for state persistence, surfacing them in
the echo helps users debug their setup.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mvanhorn

Copy link
Copy Markdown
Contributor Author

Fixed in 8462521 — the startup echo now includes both --volume flags so it matches the actual container run invocation. Thanks for the catch.

@abhishek-anand abhishek-anand requested a review from mkagenius May 16, 2026 01:43
@mkagenius mkagenius merged commit 948095e into instavm:main May 16, 2026
1 check passed
@mkagenius

Copy link
Copy Markdown
Collaborator

Thank you! @mvanhorn

@mvanhorn

Copy link
Copy Markdown
Contributor Author

Thanks for landing this, @mkagenius. Resume-on-stopped was a niggle worth fixing.

@mvanhorn

Copy link
Copy Markdown
Contributor Author

@mkagenius appreciate the container-resume fix. Dropping --rm so the sandbox survives container stop is a small change with a big quality-of-life payoff; resuming is the obvious user expectation.

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.

Ability to resume/start coderunner after stop

2 participants