Repository navigation
Conversation
This was referenced Oct 31, 2026
pthombre
force-pushed
the
pranav/envckpt-8-hold-pause
branch
2 times, most recently
from
November 2, 2026 06:16
bdd2ef3 to
d37376c
Compare
pthombre
force-pushed
the
pranav/envckpt-8-hold-pause
branch
from
November 3, 2026 03:22
d37376c to
4aee956
Compare
pthombre
force-pushed
the
pranav/envckpt-8-hold-pause
branch
from
November 3, 2026 06:40
4aee956 to
122b586
Compare
…s its processes A VM memory snapshot (AgentENV) captures the whole sandbox at one instant, processes included, so a checkpoint does not need the harness frozen to get a consistent copy; freezing it there only adds the pause failures a process in uninterruptible sleep causes. The supervisor gains `--pause-mode hold`: a pause is acknowledged at once without signalling anything, the deadline stops counting until the continue as before, and the checkpoint holds the harness's model calls instead. The default stays `stop` (SIGSTOP/SIGCONT), which a files-only snapshot still needs. Each acknowledgement now names the pause mode and the supervisor's identity (`PID.START`, the marker it gives the processes it launches). `SandboxSession(pause_mode=...)` launches in that mode, and `checkpoint_state()` records the pause the supervisor holds and its identity, so a restore of a process-keeping snapshot can find the launch again. The sandbox checkpointer records whether the provider's snapshots keep processes (`keeps_processes`, false for older records), and the docs say what a restore keeps is provider-dependent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Pranav Thombre <pthombre@nvidia.com>
…pause Every pause and continue acknowledgement now carries the sandbox's wall clock (epoch seconds) and uptime (seconds since boot) at the moment it was written. A held pause keeps them in the session's checkpoint state as `pause_wall` and `pause_uptime`. A provider that resumes a snapshot's processes but sets the guest's wall clock to the host's (AgentENV does, on every resume) leaves uptime running from the snapshot, so a restore can set the wall clock back to `pause_wall + (uptime now - pause_uptime)`: the sandbox then reads as if it had never stopped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Pranav Thombre <pthombre@nvidia.com>
pthombre
force-pushed
the
pranav/envckpt-8-hold-pause
branch
from
November 5, 2026 20:07
122b586 to
42dabe5
Compare
This branch has not been deployed
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.
What changed and why
At a checkpoint, the process supervisor (#5268) freezes the harness with
SIGSTOPand continues it withSIGCONTafterwards. That is needed when the snapshot copies only files, as on OpenSandbox. But a process in uninterruptible sleep cannot be stopped, so the pause is then not confirmed and the harness is killed and relaunched.A VM memory snapshot (AgentENV, #5410) captures the whole sandbox at one instant, processes included, so the harness does not need to be frozen for a consistent copy. This PR adds a pause that holds the harness without signalling it, and records what a later restore needs to find the paused launch again.
Hold pause
stop.SandboxSession(pause_mode=...)launches the supervisor in that mode.What each acknowledgement records
Every pause and continue acknowledgement now carries:
mode:stoporhold.identity: the supervisor's PID and process start time.wallanduptime: the sandbox's wall clock and its seconds since boot when the acknowledgement was written.SandboxSession.checkpoint_state()records the held pause, its identity, andpause_wallandpause_uptime. After a restore of a process-keeping snapshot, #5412 uses these to recognise the same launch and to set the clock back: AgentENV sets a resumed guest's wall clock to the host's, while uptime continues from the snapshot.Checkpointer record
The sandbox checkpointer (#5265) records whether the provider's snapshots keep processes (
keeps_processes). Older records read asfalse.How it works
sequenceDiagram participant G as Gym (prepare and resume) participant S as Process supervisor participant H as Harness (OpenCode) G->>S: pause N alt stop mode (OpenSandbox) S->>H: SIGSTOP S-->>G: ack with seq N, mode stop, identity, wall, uptime else hold mode (AgentENV) Note over H: keeps running unless frozen (PR 5412), model calls held by the relay S-->>G: ack with seq N, mode hold, identity, wall, uptime end Note over G: snapshot the sandbox G->>S: continue N S->>H: SIGCONT (stop mode only)Where this sits in the stack
This stack checkpoints environment-server episodes whose agent harness runs in a sandbox the resources server lends. PRs 1 to 7 add it for OpenCode and SWE-bench on OpenSandbox. PRs 8 to 11 add AgentENV (E2B API, VM memory snapshots), where a restored sandbox still runs the harness's processes, so OpenCode continues in place instead of being relaunched, with the sandbox's clock kept continuous. Each PR's diff shows only that PR's change.
Issue
No tracking issue exists. This is the checkpoint-side half of AgentENV in-place resume. #5412 and #5413 build on the pause mode and the recorded identity, wall clock and uptime.
Validation
checkpoint_state(), unchanged stop mode, and thekeeps_processesrecord; existing suites pass; lint is clean.main: the stack's suites pass, and two 16-node AgentENV RL training runs of the rebased stack, a checkpoint run and a restore from its checkpoint, commit every checkpoint with no sandbox loss; the restore resumes in place every held session whose image can run the model relay.Compatibility
pause_modedefaults tostop, so OpenSandbox and every existing harness behave as before.pause_wallandpause_uptime. Checkpointer records gainkeeps_processes, which reads asfalsewhen absent.🤖 Generated with Claude Code