fix: use array format for sandbox execute files schema#886
Conversation
Change ExecuteRequestSchema files field from z.record (map) to z.array
of {path, content} objects to match the API contract. Update the
implementation and test assertion accordingly.
📝 WalkthroughWalkthroughRestructures the files field in sandbox execution requests from a dictionary mapping paths to base64-encoded content to an array of objects with explicit path and content properties. Updates corresponding schema validation and test cases to match the new structure. Changes
🚥 Pre-merge checks | ✅ 1✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used📓 Path-based instructions (6)**/*.{ts,tsx,js,jsx,json,md}📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.{ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
packages/**/*.{ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
packages/*/test/**/*.{ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
packages/server/src/**/*.ts📄 CodeRabbit inference engine (packages/server/AGENTS.md)
Files:
packages/server/src/api/**/*.ts📄 CodeRabbit inference engine (packages/server/AGENTS.md)
Files:
🧠 Learnings (3)📚 Learning: 2025-12-21T00:31:41.858ZApplied to files:
📚 Learning: 2025-12-30T00:13:37.849ZApplied to files:
📚 Learning: 2025-12-19T14:19:33.765ZApplied to files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
🔇 Additional comments (3)
✏️ Tip: You can disable this entire section by setting Comment |
📦 Canary Packages Publishedversion: PackagesInstallAdd to your {
"dependencies": {
"@agentuity/drizzle": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-drizzle-1.0.3-2a652ba.tgz",
"@agentuity/react": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-react-1.0.3-2a652ba.tgz",
"@agentuity/frontend": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-frontend-1.0.3-2a652ba.tgz",
"@agentuity/workbench": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-workbench-1.0.3-2a652ba.tgz",
"@agentuity/auth": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-auth-1.0.3-2a652ba.tgz",
"@agentuity/schema": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-schema-1.0.3-2a652ba.tgz",
"@agentuity/core": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-core-1.0.3-2a652ba.tgz",
"@agentuity/server": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-server-1.0.3-2a652ba.tgz",
"@agentuity/evals": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-evals-1.0.3-2a652ba.tgz",
"@agentuity/postgres": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-postgres-1.0.3-2a652ba.tgz",
"@agentuity/runtime": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-runtime-1.0.3-2a652ba.tgz",
"@agentuity/opencode": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-opencode-1.0.3-2a652ba.tgz",
"@agentuity/cli": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-cli-1.0.3-2a652ba.tgz"
}
}Or install directly: bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-drizzle-1.0.3-2a652ba.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-react-1.0.3-2a652ba.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-frontend-1.0.3-2a652ba.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-workbench-1.0.3-2a652ba.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-auth-1.0.3-2a652ba.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-schema-1.0.3-2a652ba.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-core-1.0.3-2a652ba.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-server-1.0.3-2a652ba.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-evals-1.0.3-2a652ba.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-postgres-1.0.3-2a652ba.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-runtime-1.0.3-2a652ba.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-opencode-1.0.3-2a652ba.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-cli-1.0.3-2a652ba.tgz |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/server/test/sandbox-client.test.ts (1)
258-258:⚠️ Potential issue | 🟡 MinorTest name is now inaccurate — files are sent as an array, not a map.
The test description still says "send files as map in request body", but the assertion (and implementation) now uses an array format. Consider updating the name to reflect the current behavior.
✏️ Suggested fix
- test('execute with files should send files as map in request body', async () => { + test('execute with files should send files as array in request body', async () => {
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/server/src/api/sandbox/execute.tspackages/server/test/sandbox-client.test.ts
🧰 Additional context used
📓 Path-based instructions (6)
**/*.{ts,tsx,js,jsx,json,md}
📄 CodeRabbit inference engine (AGENTS.md)
Use Prettier for code formatting with tabs (width 3), single quotes, and semicolons
Files:
packages/server/test/sandbox-client.test.tspackages/server/src/api/sandbox/execute.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use TypeScript in strict mode with ESNext target and bundler moduleResolution
Files:
packages/server/test/sandbox-client.test.tspackages/server/src/api/sandbox/execute.ts
packages/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use
StructuredErrorfrom@agentuity/corefor error handling
Files:
packages/server/test/sandbox-client.test.tspackages/server/src/api/sandbox/execute.ts
packages/*/test/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
packages/*/test/**/*.{ts,tsx}: Place test files intest/folder, never insrc/or__tests__/
Import from../src/in test files
Use@agentuity/test-utilsfor mocks in tests
Files:
packages/server/test/sandbox-client.test.ts
packages/server/src/**/*.ts
📄 CodeRabbit inference engine (packages/server/AGENTS.md)
packages/server/src/**/*.ts: All code must be written in TypeScript
Use zod for runtime validation of schemas and data
Files:
packages/server/src/api/sandbox/execute.ts
packages/server/src/api/**/*.ts
📄 CodeRabbit inference engine (packages/server/AGENTS.md)
Organize API clients by feature domain in src/api/ subdirectories (apikey, db, eval, org, project, queue, region, sandbox, session, thread, user)
Files:
packages/server/src/api/sandbox/execute.ts
🧠 Learnings (3)
📚 Learning: 2025-12-21T00:31:41.858Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 274
File: packages/cli/src/cmd/build/vite/server-bundler.ts:12-41
Timestamp: 2025-12-21T00:31:41.858Z
Learning: In Bun runtime, BuildMessage and ResolveMessage are global types and are not exported from the bun module. Do not import { BuildMessage } from 'bun' or similar; these types are available globally and should be used without import. This applies to all TypeScript files that target the Bun runtime within the repository.
Applied to files:
packages/server/test/sandbox-client.test.tspackages/server/src/api/sandbox/execute.ts
📚 Learning: 2025-12-30T00:13:37.849Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 355
File: packages/server/src/api/sandbox/util.ts:2-6
Timestamp: 2025-12-30T00:13:37.849Z
Learning: In the packages/server tree, treat code as runtime-agnostic between Node.js and Bun. Ensure TypeScript files (e.g., util.ts) import and use APIs in a way that works under both runtimes. It is acceptable to rely on Bun’s Node.js compatibility for built-ins accessed via the node: namespace (e.g., node:events, node:stream, node:buffer). During reviews, prefer patterns and imports that remain compatible with Bun's environment, and flag any hard dependencies on runtime-specific globals or non-portable Node APIs.
Applied to files:
packages/server/test/sandbox-client.test.tspackages/server/src/api/sandbox/execute.ts
📚 Learning: 2025-12-19T14:19:33.765Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 259
File: packages/cli/src/cmd/build/vite/registry-generator.ts:306-312
Timestamp: 2025-12-19T14:19:33.765Z
Learning: Route files under src/api should use the .ts extension only (no .tsx) and regex patterns for such paths should anchor to \.ts$ (e.g., /\/.ts$/). Agent files may support both .ts and .tsx, but route files in the Agentuity SDK codebase are restricted to .ts. This guideline applies to all similar route files under src/api across the repository.
Applied to files:
packages/server/src/api/sandbox/execute.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: Playwright E2E Smoke Test
- GitHub Check: Sandbox CLI Tests
- GitHub Check: SDK Integration Test Suite
- GitHub Check: Cloud Deployment Tests
- GitHub Check: Build
🔇 Additional comments (3)
packages/server/src/api/sandbox/execute.ts (2)
9-17: LGTM — schema correctly models the array-of-objects contract.The
filesfield now cleanly represents each file as{ path, content }with proper descriptions, and the.optional()chain is preserved.
70-73: LGTM — serialization matches the updated schema.The
.map()correctly produces the{ path, content }array format with base64-encoded content, replacing the previousObject.fromEntriesdictionary approach.packages/server/test/sandbox-client.test.ts (1)
317-320: LGTM — test assertion correctly validates the new array format.The expected structure now matches the updated
ExecuteRequestSchemaandsandboxExecuteimplementation, with each file as a{ path, content }object containing base64-encoded content.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
Summary
ExecuteRequestSchemafiles field fromz.record()(map) toz.array()of{path, content}objects to match the API contractsandboxExecuteimplementation to send files as an array instead ofObject.fromEntriesmapFixes failing CI: https://github.com/agentuity/sdk/actions/runs/21744720908/job/62727678710
Summary by CodeRabbit