Repository navigation
[3789 by GPT-6.2 Astra] SpritesRuntime (restart, Astra): run agents on Fly Sprites from a restored checkpoint - #3791
Conversation
Implemented `SpritesRuntime` for Claude Code, Codex, and Antigravity. Each run gets an exclusive Sprite and a cloned workspace. Release restores the clean checkpoint after result retrieval and credential write-back. A failed restore destroys the Sprite and provisions a replacement. Provider entrypoints run as `node`. Credentials are uploaded in one batch, and only size-capped regular files can pass through the export directory to the broker. The runtime configuration is documented in `.env.example` and the architecture guide. Verification: 121 tests passed, 2 skipped. Core typechecking and runtime linting passed. The skips require a live Sprites token and local root privileges, respectively. Remaining live verification: Run `test/spritesRuntime.live.test.ts` with `PROPR_SPRITES_LIVE_TOKEN`, then run authenticated Claude Code, Codex, and Antigravity tasks on real Sprites. Verify GitHub clone and result return, provider credential refresh, and clean reuse after successful and interrupted runs. The SDK declares Node 24 or newer, so the live check should use the deployment’s actual worker image. ProPR-Agent: codex/gpt-6.2-astra
|
/ultrafix goal=8 max=10 |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 10) First action:
|
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds a coherent Sprites runtime with exclusive allocation, credential staging, and checkpoint-based reuse. It needs changes before merge because result-recovery failures can destroy work, launch environment overrides are incompletely applied, and cancellation does not interrupt provisioning. ✅ Exclusive allocation — A Sprite leaves the idle pool on acquisition and returns only after checkpoint restoration completes. ✅ Bounded credential exports — The launcher rejects symlinks, nonregular files, and oversized credentials before broker write-back. This review is a static analysis of the supplied code; no commands were run. Current checks report 18 passed, five pending, and no failures. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F1: 🔴 Failed retrieval destroys recoverable results
F2: 🔴 Additional environment variables are dropped
F3: 🔴 Cancellation waits for cold provisioning
SuggestionsThese are optional follow-ups and are not sent to S1: 🟢 Verify the deployed SDK environmentThe dependency declares Node 24 or newer, while the supplied production worker image uses Node 22. Run the live test against that actual image and authenticated provider launches. The declared engine mismatch alone does not prove a runtime failure, so this is a verification follow-up rather than a separate code blocker. S2: 🟢 Exercise transport failure integrationAdd integration coverage connecting ScoreThe isolation and credential handling are promising, but the demonstrated data-loss and launch-lifecycle defects prevent merge readiness. Passing checks do not cover these failure sequences. Score: 5/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit 53d6096
Summary of ChangesAddressed F1, F2, and F3 on PR #3791.
Verification: 58 tests passed. Two integration tests were skipped because the container lacked a live Sprites token and root privileges. Core typechecking and linting of the changed production files passed. Review digestRisk-tiered paths
Diff size: 8 files changed, +220/−33 lines 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
Addressed F1, F2, and F3 on PR #3791. - **F1:** Failed bundle reads and verification failures now keep the Sprite out of the reuse pool. Recovery errors identify the Sprite and result directory. Cleanup still revokes the repository token. - **F2:** Sprite launches now deliver undeclared `extraEnvVars` while preserving environment-file and spec precedence, organization-token filtering, and transport-token separation. - **F3:** Stops and deadlines now interrupt startup. If Sprite creation completes after cancellation, cleanup deletes that Sprite. A cancelled run cannot proceed to agent launch. **Verification:** 58 tests passed. Two integration tests were skipped because the container lacked a live Sprites token and root privileges. Core typechecking and linting of the changed production files passed. PR: #3791 Comment by: @propr-ultrafix (ID: 0) Model: GPT-6.2 Astra ProPR-Agent: codex/gpt-6.2-astra
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds Sprites execution with exclusive sandbox allocation, clone-based workspaces, credential write-back, and checkpoint restoration. The implementation appears merge-ready within the supplied scope; no concrete merge blocker was established by static review. ✅ Exclusive reuse — A Sprite returns to the idle pool only after checkpoint restoration; failed restoration triggers deletion and replacement. ✅ Credential boundary — Credential exports reject symlink components, nonregular files, and oversized content before broker write-back. ✅ Result recovery — Failed bundle retrieval preserves the Sprite and reports its recovery location instead of releasing it. The authoritative checks show 24 passed and 17 neutral/skipped, with no failures or pending checks. This review used only the supplied code; no commands were run. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S3: 🟢 Validate the deployment runtimeThe new SDK declares Node ≥24, while the production worker image uses Node 22. The supplied checks do not establish authenticated Sprites execution on that image. A live compatibility run would clarify deployment support; the engine declaration alone does not demonstrate a runtime failure. S4: 🟢 Exercise real provisioning failuresThe fake SDK always resolves setup execution successfully, so it does not establish how a nonzero setup command behaves through the actual SDK. Add coverage confirming that failed CLI installation cannot produce a reusable checkpoint. This is additional integration assurance rather than a verified defect. ScoreThe implementation has coherent lifecycle handling and focused regression coverage, with all current checks passing. Remaining uncertainty concerns real SDK and deployment integration rather than a demonstrated code blocker. Score: 8/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
Live run of
|
|
✅ Applied the requested follow-up changes in commit e7c0352 Summary of ChangesImplemented all four follow-ups for PR #3791. Sprite runs now mount checkpoint-backed storage at Setup now recognizes an explicit sudo denial even when Verification: 37 tests passed. Core typechecking and linting passed. Two tests skipped locally: the real-Sprite test requires Review digestRisk-tiered paths
Diff size: 9 files changed, +104/−26 lines 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
|
/ultrafix goal=8 max=6 Fix the live-run blockers in comment #3791 (comment). They were verified on real Sprites, so treat them as merge blockers even though the static review scored 8:
|
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 6) First action:
|
Implemented all four follow-ups for PR #3791. Sprite runs now mount checkpoint-backed storage at `/tmp`, covering Antigravity credentials, logs, scratch files, and tools with hardcoded paths. Release restarts the Sprite to stop detached processes, wipes the physical `/tmp` as root without following symlinks, then restores the checkpoint. A cleanup failure triggers replacement before reuse. Setup now recognizes an explicit sudo denial even when `sudo` exits successfully. The shared Git transport trusts the exact workspace path on both Sprites and Fly Machines. Provisioning errors retain their cause and report the setup stderr tail. **Verification:** 37 tests passed. Core typechecking and linting passed. Two tests skipped locally: the real-Sprite test requires `PROPR_SPRITES_LIVE_TOKEN`, and the privileged Git test requires root or passwordless sudo. A separate Git check reproduced the ownership rejection and verified the fix. PR: #3791 Comment by: @integry (ID: 7142367992) Model: GPT-6.2 Astra ProPR-Agent: codex/gpt-6.2-astra
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds pooled Sprites execution with clone-based workspaces, credential transfer, and checkpoint restoration. The supplied code addresses the four reported live-run blockers. No merge-blocking code defect was verified, but live verification remains a material gap. ✅ Run-state isolation — The launcher bind-mounts checkpointed scratch storage over ✅ Live-blocker corrections — Setup checks sudo’s output, Git invocations explicitly trust the workspace path, and provisioning errors preserve their cause and setup stderr tail. ✅ Recovery coverage — Added tests cover cancellation during provisioning, failed restoration, credential export rejection, and retaining a Sprite when bundle retrieval fails. This was a static review of the supplied diff and context. No commands were run, as requested. Authoritative checks show 21 passed, two pending, and no failures. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S5: 🟢 Verify the deployed worker runtimeRun the planned live test using the actual deployment worker image. S6: 🟢 Exercise authenticated provider runsFollow the live provisioning test with authenticated Claude Code, Codex, and Antigravity tasks, including credential refresh and an interrupted run. The supplied live test primarily exercises CLI versions and synthetic credentials; actual provider execution would strengthen confidence in entrypoint compatibility and credential persistence. This is additional integration evidence, rather than a verified missing implementation. ScoreThe implementation has substantial targeted coverage and addresses the reported failures in code. Confidence remains limited by outstanding live verification, particularly the SDK’s declared Node requirement versus the shipped worker image. Score: 7/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
|
Live verification on real Sprites at head e7c0352 (2026-11-24)The fixes from the previous round work live. The 1. 🔴 The Antigravity credential export fails with
|
| agent | exit | wall (incl. clone + first-run provisioning for claude) | result |
|---|---|---|---|
| claude | 0 | 82.7 s | file correct |
| codex | 0 | 69.1 s | file created (hi from codex., the period carried over from my ambiguous prompt) |
| antigravity | 0 | 63.3 s | file correct |
- Credentials: the Claude copy changed only in
subscriptionTypeSourcemetadata, with tokens unchanged. Codex was unchanged. The Antigravity copy received a refreshed token through the export path, so write-back works end to end. No Sprites token appeared in run env or logs. - The result push correctly fell back to a bundle, because the test run had no push token.
|
/ultrafix goal=8 max=4 Fix the two live findings in #3791 (comment): |
|
✅ Applied the requested follow-up changes in commit fb18274 Summary of ChangesFixed Antigravity credential export through Graceful worker shutdown now drains jobs and deletes idle Sprites. Leased Sprites remain available for result recovery until release. The worker logs each Sprite it creates, and the architecture guide documents how to identify and reap orphans after a crash. Verification: 42 tests passed, including shutdown during a failed restore. The core build, typecheck, and lint passed. The live Sprite test was skipped because Review digestRisk-tiered paths
Diff size: 9 files changed, +106/−15 lines 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 4) First action:
|
Fixed Antigravity credential export through `0711` directories using `O_PATH`. A non-root regression test verifies that `regular()` can read the credential through a search-only directory while preserving the existing symlink and file-size checks. Graceful worker shutdown now drains jobs and deletes idle Sprites. Leased Sprites remain available for result recovery until release. The worker logs each Sprite it creates, and the architecture guide documents how to identify and reap orphans after a crash. **Verification:** 42 tests passed, including shutdown during a failed restore. The core build, typecheck, and lint passed. The live Sprite test was skipped because `PROPR_SPRITES_LIVE_TOKEN` was unavailable. PR: #3791 Comment by: @integry (ID: 7143580494) Model: GPT-6.2 Astra ProPR-Agent: codex/gpt-6.2-astra
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR implements pooled Sprites execution with clone transport, credential write-back, and checkpoint restoration. Both requested follow-up fixes are present. Based on static review of the supplied diff and caller context, it is merge-ready within scope, subject to the remaining check completing successfully. ✅ Traversal permissions fixed — ✅ Shutdown cleanup implemented — Worker shutdown calls ✅ Recovery preserved — Failed bundle retrieval keeps the Sprite available for recovery, and documentation explains how to identify and reap orphaned Sprites. No commands or tests were run during this review. Current checks report 23 passed, none failed, and one pending. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S7: 🟢 Exercise the production Node versionThe new SDK declares Node ≥24, while ScoreThe requested corrections are implemented with focused regression coverage, and no merge-blocking defect was verified in the supplied code. The remaining pending check should finish before merging. Score: 9/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
Live re-verification at head fb18274 (unmodified)
Merging into the epic. |
|
ℹ️ Analyzed the follow-up request by @integry Analysis SummaryPR #3791 is at No code changes were necessary based on the current state of the branch. 🤖 Analysis Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
I fixed F30: a caller who cancels a Fly run while its output is being read back now gets a rejected `wait()` and the Machine is destroyed. Before, that run returned a successful result and the Machine was left running.
**The fix** (`packages/core/src/agents/runtime/flyMachinesRunHandle.ts`)
- **Reads now hear the cancel.** `collect()` takes the run's cancellation signal and passes it to the stdout and stderr capture reads, so pending reads are abandoned when the caller cancels.
- **Checked again after reading.** `execute()` checks for cancellation once more after `collect()` returns, before either the normal return or the timeout path. A cancelled run goes through the existing path: destroy the Machine, then reject with the caller's error. This covers reads the Fly API answers even though the caller cancelled.
- **Small cleanup.** The same "destroy the Machine, then reject" code was now needed in three places, so it is one helper, `discardIfAborted()`.
**What I checked nearby**
- **`stop()` doesn't trigger this.** A `stop()` that arrives after the agent has exited still waits for the reads to finish and keeps the Machine. The new check only acts on a cancellation from the caller or from the task that owns the run.
- **Other wait points were already covered.** The waits for the Machine to start, log polling, status checks and the timeout stop all respond to cancellation already. Results are only read from a Machine after the run has finished, so a cancelled run never reaches them.
**Regression test** (`test/flyMachinesRuntime.test.ts`, "cancellation while the capture files are read back destroys the Machine and rejects")
The fake Fly client can now hold exec requests open, and optionally reject them when they are aborted. The test covers two cases:
1. Cancel while the capture reads are pending: the run rejects within 3 s without the reads being released, the pending reads were aborted, the Machine is destroyed, and nothing more can be read from it.
2. Cancel, then let the held reads answer anyway: the run still rejects and destroys the Machine instead of returning the output.
**Verification**
- **Each half is needed.** Against the unfixed handle, case 1 times out ("still running"). With only the signal passed to the reads and no second check, case 2 resolves successfully.
- **Suites pass.** The three Fly suites plus `workspaceTransport` give 77 passed, 0 failed, 1 skipped. The skipped test needs root to start the transport wrapper.
- **Typecheck and lint are clean.** `tsc` passes on `packages/core`, and ESLint shows no warnings on the changed file.
- **Run with `PROPR_DEMO_MODE=true`.** Without it, `flyMachinesRuntime.test.ts` stops on the GitHub-auth banner and reports a file-level failure even though every test in it passed.
**Separate observation, not changed:** the Sprites runtime merged from #3791 has no separate step for reading results back. Its exec stream already rejects when cancelled, so this gap doesn't appear there.
PR: #3784
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
ProPR-Agent: claude/claude-opus-5-5
AI Implementation Summary
Closes #3789
Branch:
3789/gpt-6.2-astra-spritesruntime-restart-as-20261124-1821-3dvCommits: ✅ Changes committed (42c115a)
AI Processing Completed
Execution Details:
Summary:
Implemented
SpritesRuntimefor Claude Code, Codex, and Antigravity. Each run gets an exclusive Sprite and a cloned workspace. Release restores the clean checkpoint after result retrieval and credential write-back. A failed restore destroys the Sprite and provisions a replacement.Provider entrypoints run as
node. Credentials are uploaded in one batch, and only size-capped regular files can pass through the export directory to the broker. The runtime configuration is documented in.env.exampleand the architecture guide.Verification: 121 tests passed, 2 skipped. Core typechecking and runtime linting passed. The skips require a live Sprites token and local root privileges, respectively.
Remaining live verification: Run
test/spritesRuntime.live.test.tswithPROPR_SPRITES_LIVE_TOKEN, then run authenticated Claude Code, Codex, and Antigravity tasks on real Sprites. Verify GitHub clone and result return, provider credential refresh, and clean reuse after successful and interrupted runs. The SDK declares Node 24 or newer, so the live check should use the deployment’s actual worker image.Review digest
Risk-tiered paths
package-lock.json(+24/−0): lockfilepackages/core/package.json(+1/−0): dependency manifestpackages/core/src/agents/credentials/hostCredentialStaging.ts(+1/−1): auth-looking path.env.example(+5/−0)docker/Dockerfile.app.prod(+1/−0)packages/core/src/agents/AgentRegistry.ts(+3/−0)packages/core/src/agents/agentImagePreparation.ts(+21/−1)packages/core/src/agents/runtime/dockerRuntime.ts(+1/−1)packages/core/src/agents/runtime/registry.ts(+23/−7)packages/core/src/agents/runtime/runtimeSelection.ts(added, +26/−0)packages/core/src/agents/runtime/sprites/spritesCliVersions.ts(added, +39/−0)packages/core/src/agents/runtime/sprites/spritesExecution.ts(added, +106/−0)packages/core/src/agents/runtime/sprites/spritesProvisioning.ts(added, +78/−0)packages/core/src/agents/runtime/sprites/spritesRun.ts(added, +121/−0)packages/core/src/agents/runtime/spritesRuntime.ts(added, +92/−0)packages/core/src/agents/runtime/types.ts(+19/−1)packages/core/src/config/configManagerAgents.ts(+2/−0)packages/core/src/git/workspaceCloneTransport.ts(+3/−3)packages/core/src/git/workspaceTransportScript.ts(+9/−15)packages/core/src/index.ts(+1/−0)scripts/sprites-agent-setup.sh(added, +140/−0)scripts/sprites-launcher.py(added, +176/−0)docs/docs/architecture/agent-runtime.md(+11/−3)test/agentRuntimeRegistry.test.ts(+3/−2)test/helpers/fakeSprites.ts(added, +78/−0)test/nativeGoalLaunchBoundary.test.ts(+1/−1)test/spritesRuntime.live.test.ts(added, +82/−0)test/spritesRuntime.test.ts(added, +141/−0)New dependencies (1):
@fly/spritesinpackages/core/package.jsonDiff size: 28 files changed, +1,208/−35 lines
View task for the run's logs and conversation.
This PR was created automatically by ProPR after processing issue #3789.
💡 Need changes?
Comment on this PR to request refinements — the AI agent monitors comments and will update the implementation based on your feedback. Keep iterating until you're satisfied!