docs: add mounts example#752
Conversation
|
CodeAnt AI is reviewing your PR. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
Sequence DiagramThis PR adds a new runnable example that demonstrates how to combine agent, code, and object mounts in one devbox. The flow also shows routing model access through an agent gateway, validating mounted content, and cleaning up temporary resources. sequenceDiagram
participant User
participant ExampleScript
participant RunloopAPI
participant Devbox
User->>ExampleScript: Run devbox mounts example
ExampleScript->>RunloopAPI: Get or create Claude Code agent
ExampleScript->>RunloopAPI: Create gateway secret and upload object with TTL
ExampleScript->>RunloopAPI: Create devbox with agent code and object mounts
RunloopAPI-->>Devbox: Provision devbox with mounts and gateway
ExampleScript->>Devbox: Run Claude and verify repo plus object files
Devbox-->>ExampleScript: Return verification outputs
ExampleScript->>RunloopAPI: Shutdown devbox and delete temporary resources
Generated by CodeAnt AI |
Nitpicks 🔍
|
| const repoPackageJson = | ||
|
|
There was a problem hiding this comment.
Suggestion: The repository verification check uses repoPackageJson.includes(...), but repoPackageJson is never populated with file contents. This makes the check crash instead of reporting pass/fail. Read /package.json from the mounted repo path before calling includes. [logic error]
Severity Level: Critical 🚨
- ❌ examples/registry import chain breaks on devbox-mounts module.
- ❌ examples smoketest suite cannot load this example file.
- ⚠️ Repo mount validation check never executes.| const repoPackageJson = | |
| const repoPackageJson = await devbox.file.read({ | |
| file_path: path.posix.join(repoMountPath, 'package.json'), | |
| }); |
Steps of Reproduction ✅
1. Import the examples test entrypoint at `tests/smoketests/examples/examples.test.ts:2`,
which imports `exampleRegistry`.
2. `exampleRegistry` at `examples/registry.ts:8` imports `runDevboxMountsExample` from
`examples/devbox-mounts.ts`.
3. While parsing `recipe()` in `examples/devbox-mounts.ts:186`, code contains `const
repoPackageJson =` with no initializer.
4. Module load fails before any checks run; the `repoPackageJson.includes(...)` check at
`examples/devbox-mounts.ts:220` is never reachable.
5. Fixing this line by actually reading `/package.json` from `repoMountPath` restores
executable flow for the repo-mount validation check.Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** examples/devbox-mounts.ts
**Line:** 186:187
**Comment:**
*Logic Error: The repository verification check uses `repoPackageJson.includes(...)`, but `repoPackageJson` is never populated with file contents. This makes the check crash instead of reporting pass/fail. Read `/package.json` from the mounted repo path before calling `includes`.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.| const repoPackageJson = | ||
|
|
||
| const mountedExamplePath = path.posix.join(OBJECT_MOUNT_DIR, COPIED_EXAMPLE_FILE_NAME); | ||
| const mountedExampleContents = await devbox.file.read({ path: mountedExamplePath }); |
There was a problem hiding this comment.
Suggestion: devbox.file.read expects a file_path parameter, not path; sending the wrong field means the API request is malformed and the mounted file check will fail. Use file_path to match the SDK contract. [API contract violations]
Severity Level: Major ⚠️
- ⚠️ Object-mount file verification request body is malformed.
- ⚠️ Mounted-file check can fail despite successful mount.| const mountedExampleContents = await devbox.file.read({ path: mountedExamplePath }); | |
| const mountedExampleContents = await devbox.file.read({ file_path: mountedExamplePath }); |
Steps of Reproduction ✅
1. Run `recipe()` in `examples/devbox-mounts.ts` after devbox creation; execution reaches
mounted file verification at line 189.
2. `DevboxFileOps.read()` at `src/sdk/devbox.ts:31-33` forwards params unchanged to API
client.
3. `readFileContents()` at `src/resources/devboxes/devboxes.ts:389-396` POSTs body as-is
to `/read_file_contents`.
4. Contract `DevboxReadFileContentsParams` at `src/resources/devboxes/devboxes.ts:16-22`
requires `file_path`, not `path`.
5. Existing tests consistently call `devbox.file.read({ file_path: ... })` (e.g.,
`tests/objects/devbox.test.ts:165`), confirming this is the expected field.Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** examples/devbox-mounts.ts
**Line:** 189:189
**Comment:**
*Api Contract Violations: `devbox.file.read` expects a `file_path` parameter, not `path`; sending the wrong field means the API request is malformed and the mounted file check will fail. Use `file_path` to match the SDK contract.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.|
CodeAnt AI finished reviewing your PR. |
❌ Object Smoke Tests FailedTest Results❌ Some smoke tests failed Please fix the failing tests before checking coverage. |
User description
Format:
feat[optional scope]: <description>Examples:
feat: add new SDK method·feat(storage): support file uploads·feat!: breaking API changeDescription
Shows how to use our main types of mount and short guidance on when to use each one:
Note that the object mount includes TTL settings and the agent mount uses an agent gateway. This is to increase the chance that an agent generates high quality code from the examples
Motivation
Changes
Testing
Breaking Changes
Checklist
feat:orfeat(scope):)CodeAnt-AI Description
Add a runnable example for combining agent, code, and object mounts
What Changed
runloopai/rl-clirepository, and startup files from an uploaded object.tgzstorage, and extraction onto the devbox at startupImpact
✅ Clearer mount usage examples✅ Easier Claude Code setup on devboxes✅ Fewer mistakes when wiring secrets and startup files💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.