Skip to content

[3789 by GPT-6.2 Astra] SpritesRuntime (restart, Astra): run agents on Fly Sprites from a restored checkpoint - #3791

Merged
integry merged 4 commits into
3758-epic-runtime-abstraction-sc0from
3789/gpt-6.2-astra-spritesruntime-restart-as-20261124-1821-3dv
Nov 24, 2026
Merged

integry merged 4 commits into
3758-epic-runtime-abstraction-sc0from
3789/gpt-6.2-astra-spritesruntime-restart-as-20261124-1821-3dv

Conversation

@propr-dev

@propr-dev propr-dev Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

AI Implementation Summary

Closes #3789

Branch: 3789/gpt-6.2-astra-spritesruntime-restart-as-20261124-1821-3dv
Commits: ✅ Changes committed (42c115a)


AI Processing Completed

Execution Details:

Summary:
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.

Review digest

Risk-tiered paths

  • High risk (3 files)
    • package-lock.json (+24/−0): lockfile
    • packages/core/package.json (+1/−0): dependency manifest
    • packages/core/src/agents/credentials/hostCredentialStaging.ts (+1/−1): auth-looking path
  • Normal risk (19 files)
    • .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)
  • Low risk (6 files)
    • 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/sprites in packages/core/package.json

Diff 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!

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

integry commented Nov 24, 2026

Copy link
Copy Markdown
Owner

/ultrafix goal=8 max=10

@propr-dev propr-dev Bot added the ultrafix label Nov 24, 2026
@propr-dev

propr-dev Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

🔄 Ultrafix loop started (goal: 8/10, max cycles: 10)

First action: /review

💡 Tip: Remove the ultrafix label from this PR to stop further ultrafix cycles.

@propr-dev

propr-dev Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

🔍 AI Code Review — codex:gpt-6-astra

Overall Evaluation

The 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 blockers

Every finding below was introduced by this PR and must be resolved before merging.

F1: 🔴 Failed retrieval destroys recoverable results

  • Category: correctness

  • Required behavior: Workspace result retrieval failures must not destroy the only recoverable copy of the agent’s work.

  • Evidence: packages/core/src/git/workspaceCloneTransport.ts:319, packages/core/src/agents/runtime/spritesRuntime.ts:62

    1. A Sprite finishes a run whose result could not be pushed and therefore exists only as result.bundle.
    2. Reading that bundle fails, leaving run.result === 'pending'.
    3. Cleanup now calls release() despite the pending result because Sprites sets releaseAfterResultRead: true.
    4. Release restores the clean checkpoint, deleting the bundle and workspace. If restoration fails, the replacement path deletes the Sprite instead.

    The work is permanently lost after a retrieval failure. Waiting for outstanding reads only waits for their settlement; it does not establish that any read succeeded or that a durable copy exists. The changed warning explicitly permits reporting that no recoverable copy remains. static trace: the modified cleanup condition and Sprite release implementation demonstrate this sequence.

  • Minimum fix: Require durable result preservation before restoring or deleting a Sprite containing an unretrieved result. If preservation fails, quarantine that Sprite from reuse and retain a recoverable reference.

F2: 🔴 Additional environment variables are dropped

  • Category: correctness

  • Required behavior: Runtime launch options must deliver explicitly supplied environment variables to the agent.

  • Evidence: packages/core/src/agents/runtime/sprites/spritesRun.ts:33, runEnvironment

    1. A caller supplies an environment variable through options.extraEnvVars whose name is absent from spec.env, spec.repoSetup.env, and the environment files.
    2. runEnvironment() places it in inherited, but initializes the outgoing env map empty.
    3. Only names enumerated by the spec or environment files enter that map.
    4. The uploaded agent environment therefore omits the explicitly supplied variable.

    This silently changes launch behavior for callers using additional environment settings. The supplied Claude and Codex callers explicitly use extraEnvVars for tool-policy environment settings. Secret filtering occurs afterward and does not address the omission. static trace: the map construction establishes the failure for any additional, undeclared key; no execution was performed.

  • Minimum fix: Merge explicit extraEnvVars into the outgoing environment using the established launch precedence, while preserving the subsequent organization-token filtering and transport-token separation.

F3: 🔴 Cancellation waits for cold provisioning

  • Category: correctness

  • Required behavior: Run cancellation and execution deadlines must bound startup as well as agent execution.

  • Evidence: packages/core/src/agents/runtime/spritesRuntime.ts:52, packages/core/src/agents/runtime/sprites/spritesProvisioning.ts:51

    1. A cold run enters pool.acquire() and begins provisioning, including the setup command with its 20-minute timeout.
    2. The run deadline expires, or the caller invokes stop(), while that awaited operation is still running.
    3. Neither acquisition nor provisioning receives the cancellation signal.
    4. stop() awaits result, which cannot observe cancellation until acquisition finishes. The caller remains blocked and provisioning continues despite the stop or shorter execution deadline.

    The checks before and after acquisition prevent a subsequently cancelled agent launch, but they do not interrupt the active provisioning operation. static trace: cancellation reaches only the checks surrounding acquisition and the later execution function; the provisioning API has no cancellation path.

  • Minimum fix: Make provisioning cancellation-aware and ensure partially created Sprites are cleaned up. Cancellation should settle promptly without allowing a late acquisition to become an untracked resource.

Suggestions

These are optional follow-ups and are not sent to /fix.

S1: 🟢 Verify the deployed SDK environment

The 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 integration

Add integration coverage connecting CloneWorkspaceTransport to the fake Sprite runtime, including failed bundle reads and cleanup. Existing tests demonstrate successful retrieval and restoration separately, but do not exercise their failure interaction.

Score

The 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

  • Model: GPT-6 Astra
  • Time: 1m 33s
  • Tokens: 73,260 (71,030 in / 2,230 out)
  • Cost: $0.71

View Task


💡 Next step: Comment /fix to address every F# merge blocker, /fix all for every pending blocker and suggestion, or name records explicitly, as in /fix F3 S5.
F# and S# IDs increment across review comments and remain permanent, so selectors such as /fix F3 F5 stay unambiguous across cycles. S# suggestions stay optional: they are implemented only when you name them or request /fix all, and they never relax a merge blocker.

Copy and edit to choose records from this review:

/fix F1 F2 F3 S1 S2

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 53d6096

Addressed 1 AI review comment (IDs: 7141238296)

Addressed findings F1, F2, F3

Summary of Changes

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.

Review digest

Risk-tiered paths

  • High risk: none
  • Normal risk (5 files)
    • packages/core/src/agents/runtime/sprites/spritesProvisioning.ts (+39/−11)
    • packages/core/src/agents/runtime/sprites/spritesRun.ts (+1/−1)
    • packages/core/src/agents/runtime/spritesRuntime.ts (+23/−9)
    • packages/core/src/agents/runtime/types.ts (+2/−2)
    • packages/core/src/git/workspaceCloneTransport.ts (+4/−7)
  • Low risk (3 files)
    • docs/docs/architecture/agent-runtime.md (+1/−1)
    • test/helpers/fakeSprites.ts (+1/−1)
    • test/spritesRuntime.test.ts (+149/−1)

Diff size: 8 files changed, +220/−33 lines


🤖 Implementation Details

  • Model: GPT-6.2 Astra (medium)
  • Requested By: @propr-ultrafix
  • Time: 6m 32s
  • Tokens: 1,541,792 (1,534,165 in / 7,627 out)
  • Cost: $1.33

View Task Execution


💡 ProPR Slash Commands
Command Description Example
/merge Merge target branch into this PR and resolve conflicts /merge
/review Request an AI code review /review or /review claude-sonnet
/fix Address review blockers, or blockers and suggestions with /fix all /fix, /fix all, or /fix F3 S5
/switch Change the AI model for this PR /switch claude-opus
/use Override the model for a single follow-up run /use claude-sonnet
/ultrafix Loop review→fix cycles until score goal is met /ultrafix or /ultrafix goal=8 max=10

🤖 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
@propr-dev

propr-dev Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

🔍 AI Code Review — codex:gpt-6-astra

Overall Evaluation

The 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 blockers

No merge blockers.

Suggestions

These are optional follow-ups and are not sent to /fix.

S3: 🟢 Validate the deployment runtime

The 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 failures

The 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.

Score

The 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

  • Model: GPT-6 Astra
  • Time: 54s
  • Tokens: 76,301 (74,713 in / 1,588 out)
  • Cost: $0.70

View Task


💡 Next step: Comment /fix to address every F# merge blocker, /fix all for every pending blocker and suggestion, or name records explicitly, as in /fix F3 S5.
F# and S# IDs increment across review comments and remain permanent, so selectors such as /fix F3 F5 stay unambiguous across cycles. S# suggestions stay optional: they are implemented only when you name them or request /fix all, and they never relax a merge blocker.

Copy and edit to choose records from this review:

/fix S3 S4

🤖 Review by ProPR

@propr-dev propr-dev Bot removed the ultrafix label Nov 24, 2026
@propr-dev propr-dev Bot changed the title 🔨 [3789 by GPT-6.2 Astra] SpritesRuntime (restart, Astra): run agents on Fly Sprites from a restored checkpoint ✅❽ [3789 by GPT-6.2 Astra] SpritesRuntime (restart, Astra): run agents on Fly Sprites from a restored checkpoint Nov 24, 2026
@integry

integry commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Live run of test/spritesRuntime.live.test.ts on real Sprites (2026-11-24, Ubuntu 26.04.1 Sprite)

I ran this against real Sprites. Three bugs block it in turn, and one is a platform fact that breaks the "restore makes leakage impossible" premise.

1. 🔴 Sprite checkpoints do not cover /tmp (platform)

On a Sprite, /tmp is a separate 20 GB disk (/dev/vdb), not part of the overlay root. Direct probe: create checkpoint, touch /tmp/x, ~/x and /var/tmp/x, restore (3.9 s). Result: /tmp/x still exists, while ~/x and /var/tmp/x are gone.

The live test shows the consequence: the claude run passes, and the codex run after the restore fails at test ! -e /tmp/previous-run. Anything a run writes under /tmp reaches the next run, including the Antigravity disposable HOME (/tmp/propr-antigravity-home, which holds antigravity-oauth-token), logs or scratch under /tmp, and /tmp/propr-workspace-result.

Required: do not put run-scoped state under /tmp on Sprites; use a path on the checkpointed root, for example under /var/lib/propr/run or /home/node. In addition, at release, after every run process is stopped and before the restore, have root wipe /tmp contents without following symlinks (find /tmp -xdev -mindepth 1 -delete). Keep the live assertion that a second run sees no /tmp leftovers, and add a fake-Sprite test that models /tmp as not checkpointed.

2. 🔴 The sudo check always fails on Sprites

if sudo -l -U node >/dev/null 2>&1; then die "node has sudo privileges"; fi refuses on every Sprite. With the Sprite's sudo, sudo -l -U <user> exits 0 even when it prints User node is not allowed to run sudo (verified; nobody also exits 0). Check the output instead, for example sudo -l -U node 2>/dev/null | grep -q "may run the following", or parse /etc/sudoers and /etc/sudoers.d plus group membership. (Sprite sudoers: %sudo ALL=(ALL:ALL) ALL, %admin ALL=(ALL) ALL, /etc/sudoers.d/sprite; node is in no group.)

3. 🔴 The clone transport fails under root with detected dubious ownership in repository at '/home/node/workspace'

The transport sets its own GIT_CONFIG_COUNT, so env from outside cannot add safe.directory. Verified fix: add GIT_CONFIG_KEY_n=safe.directory GIT_CONFIG_VALUE_n=<workspace path> to its local_git, g() and isolated invocations. With that change the clone succeeded (cloned … into /home/node/workspace). The same bug blocks the Fly Machines runtime (#3784), so fix it once in workspaceTransportScript.ts.

4. 🟡 SpritePool.provision swallows the setup error

catch { … throw new Error('Failed to provision the clean Sprite checkpoint') } drops the cause, so the operator never sees the setup script's message. Log or attach it as cause, with the setup stderr tail.

Verified working with local fixes for 2 and 3

  • Provisioning: Node symlinks, pinned CLIs and checkpoint in about 36 s on a fresh Sprite.
  • The claude run: clone transport, runs as node, no Sprites token in env, pinned CLI version.

@propr-dev propr-dev Bot changed the title ✅❽ [3789 by GPT-6.2 Astra] SpritesRuntime (restart, Astra): run agents on Fly Sprites from a restored checkpoint 🔨 [3789 by GPT-6.2 Astra] SpritesRuntime (restart, Astra): run agents on Fly Sprites from a restored checkpoint Nov 24, 2026
@propr-dev

propr-dev Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit e7c0352

Summary of Changes

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.

Review digest

Risk-tiered paths

  • High risk: none
  • Normal risk (6 files)
    • packages/core/src/agents/runtime/sprites/spritesExecution.ts (+1/−1)
    • packages/core/src/agents/runtime/sprites/spritesProvisioning.ts (+14/−4)
    • packages/core/src/agents/runtime/sprites/spritesRun.ts (+3/−2)
    • packages/core/src/git/workspaceTransportScript.ts (+13/−9)
    • scripts/sprites-agent-setup.sh (+13/−2)
    • scripts/sprites-launcher.py (+6/−0)
  • Low risk (3 files)
    • test/helpers/fakeSprites.ts (+10/−3)
    • test/spritesRuntime.live.test.ts (+3/−0)
    • test/spritesRuntime.test.ts (+41/−5)

Diff size: 9 files changed, +104/−26 lines


🤖 Implementation Details

  • Model: GPT-6.2 Astra (medium)
  • Requested By: @integry
  • Time: 6m 3s
  • Tokens: 1,058,791 (1,052,516 in / 6,275 out)
  • Cost: $1.03

Undo Changes • View Task Execution


💡 ProPR Slash Commands
Command Description Example
/merge Merge target branch into this PR and resolve conflicts /merge
/review Request an AI code review /review or /review claude-sonnet
/fix Address review blockers, or blockers and suggestions with /fix all /fix, /fix all, or /fix F3 S5
/switch Change the AI model for this PR /switch claude-opus
/use Override the model for a single follow-up run /use claude-sonnet
/ultrafix Loop review→fix cycles until score goal is met /ultrafix or /ultrafix goal=8 max=10

🤖 Generated by ProPR
Processing comment ID: 7142367992✓

integry commented Nov 24, 2026

Copy link
Copy Markdown
Owner

/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:

  1. Sprite checkpoints do NOT cover /tmp (it is a separate /dev/vdb disk). Move all run-scoped state (Antigravity HOME, logs, scratch, workspace result) off /tmp to the checkpointed root, AND have root wipe /tmp contents without following symlinks at release, after run processes stop and before restore. Add a fake-Sprite test that models /tmp as not checkpointed. Keep the live assertion that the next run sees no /tmp leftovers.
  2. The sudo check in scripts/sprites-agent-setup.sh always fails on Sprites, because sudo -l -U node exits 0 even when the user is not allowed. Check the output (for example grep "may run the following") instead of the exit code.
  3. The clone transport fails as root with "dubious ownership in /home/node/workspace". Add safe.directory= to the GIT_CONFIG_COUNT/KEY/VALUE sets inside packages/core/src/git/workspaceTransportScript.ts (local_git, g(), and the isolated invocations). This was verified live to fix the clone.
  4. SpritePool.provision swallows the setup error. Attach it as cause and log the setup stderr tail.
    Run the unit tests. A maintainer will rerun test/spritesRuntime.live.test.ts on real Sprites after this.

@propr-dev

propr-dev Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

🔄 Ultrafix loop started (goal: 8/10, max cycles: 6)

First action: /review

💡 Tip: Remove the ultrafix label from this PR to stop further ultrafix cycles.

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
@propr-dev

propr-dev Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

🔍 AI Code Review — codex:gpt-6-astra

Overall Evaluation

The 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 /tmp; release restarts the Sprite, wipes the separate /tmp disk, and restores its checkpoint. The fake models /tmp surviving restoration.

✅ 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 blockers

No merge blockers.

Suggestions

These are optional follow-ups and are not sent to /fix.

S5: 🟢 Verify the deployed worker runtime

Run the planned live test using the actual deployment worker image. @fly/sprites declares Node ≥24, while docker/Dockerfile.app.prod uses Node 22. This discrepancy does not alone demonstrate a runtime defect, but the fake client cannot establish SDK compatibility. Evidence from the deployed environment would resolve that uncertainty without requiring a speculative runtime upgrade.

S6: 🟢 Exercise authenticated provider runs

Follow 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.

Score

The 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

  • Model: GPT-6 Astra
  • Time: 1m 34s
  • Tokens: 77,157 (75,481 in / 1,676 out)
  • Cost: $0.71

View Task


💡 Next step: Comment /fix to address every F# merge blocker, /fix all for every pending blocker and suggestion, or name records explicitly, as in /fix F3 S5.
F# and S# IDs increment across review comments and remain permanent, so selectors such as /fix F3 F5 stay unambiguous across cycles. S# suggestions stay optional: they are implemented only when you name them or request /fix all, and they never relax a merge blocker.

Copy and edit to choose records from this review:

/fix S5 S6

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

⚠️ Ultrafix stopped before reaching its goal. Requested goal: 8/10. Last score: 7/10. Stopped in cycle 1 of 6. The review has no actionable blockers, so no fix was scheduled. Manual review and merge are now required.

@propr-dev propr-dev Bot removed the ultrafix label Nov 24, 2026
@propr-dev propr-dev Bot changed the title 🔨 [3789 by GPT-6.2 Astra] SpritesRuntime (restart, Astra): run agents on Fly Sprites from a restored checkpoint ⚠️❼ [3789 by GPT-6.2 Astra] SpritesRuntime (restart, Astra): run agents on Fly Sprites from a restored checkpoint Nov 24, 2026
@integry

integry commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Live verification on real Sprites at head e7c0352 (2026-11-24)

The fixes from the previous round work live. The /tmp bind to checkpoint-backed scratch held: the next run saw no leftovers. The sudo check, safe.directory and the provisioning error cause also work. Two items remain.

1. 🔴 The Antigravity credential export fails with PermissionError: [Errno 13] Permission denied: 'run'

regular() in scripts/sprites-launcher.py pins each directory with os.open(part, O_DIRECTORY | O_NOFOLLOW, dir_fd=parent). That opens the directory for reading, but /opt/propr/run is 0711, so the node subprocess (read-live) can traverse it but not open it. Every per-run credential export (Antigravity) fails with invalid live credential.

Verified fix: open the traversal fds with O_PATH, which needs only search permission: os.open('/', os.O_PATH | os.O_DIRECTORY) and os.open(part, os.O_PATH | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=parent). The final lstat/os.open(name, O_RDONLY | O_NOFOLLOW, dir_fd=parent) work with an O_PATH dirfd. With that change test/spritesRuntime.live.test.ts passes: it provisions, runs Claude, Codex and Antigravity, restores between runs, leaves no /tmp leftovers and writes back synthetic-after (168 s). Please add a unit test that runs regular() as a non-root user through a 0711 directory.

2. 🟡 The pool leaks warm Sprites when the worker exits

After a real E2E, the process exited and the idle pooled Sprite (propr-<uuid>) stayed alive. provision() intentionally never adopts by name, so every worker restart orphans up to the pool size. On the Free plan (3 Sprites) that exhausts the quota quickly. Add a close()/shutdown hook that deletes idle Sprites, and document how to reap orphans. For example, propr could list propr-* Sprites that no live worker owns, or Sprites could carry a worker-instance label or comment.

Real-credential E2E (with the O_PATH fix applied locally)

Real provider run specs, clone transport, credential copies; task: create hello-<agent>.txt.

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 subscriptionTypeSource metadata, 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.

@propr-dev propr-dev Bot changed the title ⚠️❼ [3789 by GPT-6.2 Astra] SpritesRuntime (restart, Astra): run agents on Fly Sprites from a restored checkpoint 🔨 [3789 by GPT-6.2 Astra] SpritesRuntime (restart, Astra): run agents on Fly Sprites from a restored checkpoint Nov 24, 2026

integry commented Nov 24, 2026

Copy link
Copy Markdown
Owner

/ultrafix goal=8 max=4

Fix the two live findings in #3791 (comment):
(1) BLOCKER: in scripts/sprites-launcher.py regular(), open the directory-traversal fds with os.O_PATH (that is, os.open('/', os.O_PATH | os.O_DIRECTORY) and os.open(part, os.O_PATH | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=parent)), because /opt/propr/run is 0711 and the node read-live subprocess cannot open it for reading. This fix was verified live: with it, test/spritesRuntime.live.test.ts passes end to end. Add a test that runs regular() as non-root through a 0711 directory.
(2) Delete idle pooled Sprites on worker shutdown (a close() hook wired into worker shutdown), and document how to reap orphaned propr-* Sprites, since the Free plan allows only 3.
Keep the change small. Everything else has been verified live with real Claude, Codex and Antigravity credentials.

@propr-dev

propr-dev Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit fb18274

Summary of Changes

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.

Review digest

Risk-tiered paths

  • High risk: none
  • Normal risk (7 files)
    • packages/core/src/agents/runtime/registry.ts (+6/−0)
    • packages/core/src/agents/runtime/sprites/spritesProvisioning.ts (+16/−4)
    • packages/core/src/agents/runtime/spritesRuntime.ts (+11/−5)
    • packages/core/src/agents/runtime/types.ts (+1/−0)
    • packages/core/src/index.ts (+1/−1)
    • scripts/sprites-launcher.py (+2/−2)
    • src/worker.ts (+2/−1)
  • Low risk (2 files)
    • docs/docs/architecture/agent-runtime.md (+3/−1)
    • test/spritesRuntime.test.ts (+64/−1)

Diff size: 9 files changed, +106/−15 lines


🤖 Implementation Details

  • Model: GPT-6.2 Astra (medium)
  • Requested By: @integry
  • Time: 5m 22s
  • Tokens: 911,399 (907,452 in / 3,947 out)
  • Cost: $0.78

Undo Changes • View Task Execution


💡 ProPR Slash Commands
Command Description Example
/merge Merge target branch into this PR and resolve conflicts /merge
/review Request an AI code review /review or /review claude-sonnet
/fix Address review blockers, or blockers and suggestions with /fix all /fix, /fix all, or /fix F3 S5
/switch Change the AI model for this PR /switch claude-opus
/use Override the model for a single follow-up run /use claude-sonnet
/ultrafix Loop review→fix cycles until score goal is met /ultrafix or /ultrafix goal=8 max=10

🤖 Generated by ProPR
Processing comment ID: 7143580494✓

@propr-dev propr-dev Bot added the ultrafix label Nov 24, 2026
@propr-dev

propr-dev Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

🔄 Ultrafix loop started (goal: 8/10, max cycles: 4)

First action: /review

💡 Tip: Remove the ultrafix label from this PR to stop further ultrafix cycles.

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
@propr-dev

propr-dev Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

🔍 AI Code Review — codex:gpt-6-astra

Overall Evaluation

The 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 — regular() uses O_PATH for directory traversal, with a regression test exercising an unprivileged reader through a 0711 directory.

✅ Shutdown cleanup implemented — Worker shutdown calls closeAgentRuntimes(). Pool tests cover idle deletion, leased Sprites, and shutdown during failed restoration.

✅ 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 blockers

No merge blockers.

Suggestions

These are optional follow-ups and are not sent to /fix.

S7: 🟢 Exercise the production Node version

The new SDK declares Node ≥24, while docker/Dockerfile.app.prod uses Node 22. A targeted SDK smoke test using the production worker image would help detect compatibility problems during future dependency updates. This is optional: the engine declaration alone does not demonstrate a runtime failure, and the supplied context reports successful live verification.

Score

The 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

  • Model: GPT-6 Astra
  • Time: 39s
  • Tokens: 78,190 (77,378 in / 812 out)
  • Cost: $0.70

View Task


💡 Next step: Comment /fix to address every F# merge blocker, /fix all for every pending blocker and suggestion, or name records explicitly, as in /fix F3 S5.
F# and S# IDs increment across review comments and remain permanent, so selectors such as /fix F3 F5 stay unambiguous across cycles. S# suggestions stay optional: they are implemented only when you name them or request /fix all, and they never relax a merge blocker.

Copy and edit to choose records from this review:

/fix S7

🤖 Review by ProPR

@propr-dev propr-dev Bot removed the ultrafix label Nov 24, 2026
@propr-dev propr-dev Bot changed the title 🔨 [3789 by GPT-6.2 Astra] SpritesRuntime (restart, Astra): run agents on Fly Sprites from a restored checkpoint ✅❾ [3789 by GPT-6.2 Astra] SpritesRuntime (restart, Astra): run agents on Fly Sprites from a restored checkpoint Nov 24, 2026
@integry

integry commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Live re-verification at head fb18274 (unmodified)

  • test/spritesRuntime.live.test.ts on a real Sprite: pass (170 s). It covers provisioning, Claude, Codex and Antigravity, restores between runs, no /tmp leftovers, and token write-back.
  • Real-credential E2E with real provider run specs, the clone transport and credential copies. All three exited 0 and each produced its file: Claude 90 s (including first-run provisioning), Codex 58 s, Antigravity 54 s.
  • runtime.close() deleted the idle pooled Sprite, and no propr-* Sprite was left behind.
  • Credential copies: tokens unchanged; Claude's subscriptionTypeSource metadata was the only difference. No Sprites token appeared in run env or logs.

Merging into the epic.

@propr-dev propr-dev Bot changed the title ✅❾ [3789 by GPT-6.2 Astra] SpritesRuntime (restart, Astra): run agents on Fly Sprites from a restored checkpoint 🔨 [3789 by GPT-6.2 Astra] SpritesRuntime (restart, Astra): run agents on Fly Sprites from a restored checkpoint Nov 24, 2026
@integry
integry merged commit 24003d5 into 3758-epic-runtime-abstraction-sc0 Nov 24, 2026
44 checks passed
@propr-dev

propr-dev Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

ℹ️ Analyzed the follow-up request by @integry

Analysis Summary

PR #3791 is at fb182746d, the head covered by the reported live verification. All three provider runs passed, and runtime.close() removed the idle Sprite. The latest comment requests no further changes, so I left the branch as verified.

No code changes were necessary based on the current state of the branch.


🤖 Analysis Details

  • Model: GPT-6.2 Astra (medium)
  • Time: 3m 17s
  • Tokens: 42,595 (42,396 in / 199 out)
  • Cost: $0.08

View Task Execution


💡 ProPR Slash Commands
Command Description Example
/merge Merge target branch into this PR and resolve conflicts /merge
/review Request an AI code review /review or /review claude-sonnet
/fix Address review blockers, or blockers and suggestions with /fix all /fix, /fix all, or /fix F3 S5
/switch Change the AI model for this PR /switch claude-opus
/use Override the model for a single follow-up run /use claude-sonnet
/ultrafix Loop review→fix cycles until score goal is met /ultrafix or /ultrafix goal=8 max=10

🤖 Generated by ProPR
Processing comment ID: 7144480748✓

@propr-dev propr-dev Bot changed the title 🔨 [3789 by GPT-6.2 Astra] SpritesRuntime (restart, Astra): run agents on Fly Sprites from a restored checkpoint [3789 by GPT-6.2 Astra] SpritesRuntime (restart, Astra): run agents on Fly Sprites from a restored checkpoint Nov 24, 2026
propr-dev Bot pushed a commit that referenced this pull request Nov 24, 2026
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant