Add Ascii Box provider#2
Conversation
|
@pkyanam is attempting to deploy a commit to the OpenCore Team on Vercel. A member of the Team first needs to authorize it. |
Greptile SummaryThis PR adds an Ascii Box provider to the Sandbox SDK. The main changes are:
Confidence Score: 4/5This PR is close, but the snapshot lifecycle bug should be fixed before merging. A single contained issue affects Ascii snapshot creation and cleanup retry timing. The provider exports, metadata, docs, and test coverage otherwise line up with the new integration.
What T-Rex did
Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant App
participant SDK as Sandbox SDK
participant API as Ascii API
participant Runtime as Box Runtime
App->>SDK: Create sandbox with ascii provider
SDK->>API: Create Box
SDK->>API: Poll Box state until ready
App->>SDK: Use files commands processes or ports
SDK->>API: Call file and command endpoints
API->>Runtime: Execute operation in work directory
App->>SDK: Create snapshot
SDK->>API: Archive Box
SDK->>API: Wait for latest snapshot
SDK->>API: Resume Box
App->>SDK: Stop sandbox
SDK->>API: Remove Box
alt Recent snapshot required
SDK->>API: Archive Box and wait for snapshot
SDK->>API: Retry remove
end
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant App
participant SDK as Sandbox SDK
participant API as Ascii API
participant Runtime as Box Runtime
App->>SDK: Create sandbox with ascii provider
SDK->>API: Create Box
SDK->>API: Poll Box state until ready
App->>SDK: Use files commands processes or ports
SDK->>API: Call file and command endpoints
API->>Runtime: Execute operation in work directory
App->>SDK: Create snapshot
SDK->>API: Archive Box
SDK->>API: Wait for latest snapshot
SDK->>API: Resume Box
App->>SDK: Stop sandbox
SDK->>API: Remove Box
alt Recent snapshot required
SDK->>API: Archive Box and wait for snapshot
SDK->>API: Retry remove
end
Reviews (1): Last reviewed commit: "Add Ascii Box provider" | Re-trigger Greptile |
| return poll(options, async () => { | ||
| const snapshot = await latestSnapshot(api, boxId); | ||
| return snapshot && snapshot.id !== previousId ? snapshot : undefined; |
There was a problem hiding this comment.
Wait for completion
waitForSnapshot() returns the first snapshot whose id differs from previousId without checking that Box has finished it. When archive() exposes a new snapshot while it is still pending, sandbox.snapshots.create() returns a not-yet-restorable artifact and removeBox() immediately retries deletion against the same incomplete safety snapshot, so cleanup can still fail despite the intended safeguard. I’m 4/5 confident this should check the snapshot status before returning.
Artifacts
Repro: focused Bun test harness mocking pending then completed Ascii snapshots
- Contains supporting evidence from the run (text/typescript; charset=utf-8).
Repro: Bun test output showing pending snapshot returned before completion poll
- Keeps the command output available without making the summary code-heavy.
Summary
ascii()provider backed by the official@asciidev/box-sdkAsciiBoxraw handleWhy
Ascii Box offers persistent cloud computers and agent workflows, but applications currently need provider-specific code for its lifecycle, command, file, preview, and snapshot APIs. This adapter makes Box available through the same Sandbox SDK surface as the existing providers while retaining native SDK access for Box-specific features.
Implementation notes
/workspacepaths map to Box's work-directory-relative APIrequest()handles Box's same-origin cookie bootstrap on server runtimesValidation
bun run lintbun run typecheckbun run test— 45 passed, 18 credential-gated tests skipped, 0 failedBOX_API_KEY=... bun test tests/live/ascii.test.ts --timeout=360000— 1 passed against a real Box, with one Box active at a time and zero active Boxes after cleanupbun install --frozen-lockfilenpm pack --dry-run