Skip to content

fix: use array format for sandbox execute files schema#886

Merged
jhaynie merged 1 commit intomainfrom
fix/sandbox-execute-files-schema
Feb 6, 2026
Merged

fix: use array format for sandbox execute files schema#886
jhaynie merged 1 commit intomainfrom
fix/sandbox-execute-files-schema

Conversation

@jhaynie
Copy link
Member

@jhaynie jhaynie commented Feb 6, 2026

Summary

  • Changed ExecuteRequestSchema files field from z.record() (map) to z.array() of {path, content} objects to match the API contract
  • Updated sandboxExecute implementation to send files as an array instead of Object.fromEntries map
  • Fixed test assertion to expect the array format

Fixes failing CI: https://github.com/agentuity/sdk/actions/runs/21744720908/job/62727678710

Summary by CodeRabbit

  • Refactor
    • Restructured sandbox execution API's file submission mechanism from dictionary object format (mapping file paths to base64-encoded content) to an array of objects with explicit path and content fields for improved API consistency and clarity
    • Updated all related tests to validate the new array-based file format

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.
@coderabbitai
Copy link

coderabbitai bot commented Feb 6, 2026

📝 Walkthrough

Walkthrough

Restructures 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

Cohort / File(s) Summary
Sandbox Execution Schema and Implementation
packages/server/src/api/sandbox/execute.ts
Updated ExecuteRequestSchema to define files as an array of objects with path and content properties instead of a record. Modified sandboxExecute function to transform files from an array format to the new structure while maintaining base64 encoding.
Sandbox Client Tests
packages/server/test/sandbox-client.test.ts
Updated test cases to expect files payload in the new array-of-objects format instead of the dictionary format across sandbox execution request scenarios.
🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d6061be and 2a652ba.

📒 Files selected for processing (2)
  • packages/server/src/api/sandbox/execute.ts
  • packages/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.ts
  • packages/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.ts
  • packages/server/src/api/sandbox/execute.ts
packages/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use StructuredError from @agentuity/core for error handling

Files:

  • packages/server/test/sandbox-client.test.ts
  • packages/server/src/api/sandbox/execute.ts
packages/*/test/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

packages/*/test/**/*.{ts,tsx}: Place test files in test/ folder, never in src/ or __tests__/
Import from ../src/ in test files
Use @agentuity/test-utils for 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.ts
  • packages/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.ts
  • packages/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 files field 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 previous Object.fromEntries dictionary 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 ExecuteRequestSchema and sandboxExecute implementation, 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.


Comment @coderabbitai help to get the list of available commands and usage tips.

@jhaynie jhaynie enabled auto-merge (squash) February 6, 2026 09:13
@github-actions
Copy link

github-actions bot commented Feb 6, 2026

📦 Canary Packages Published

version: 1.0.3-2a652ba

Packages
Package Version URL
@agentuity/drizzle 1.0.3-2a652ba https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-drizzle-1.0.3-2a652ba.tgz
@agentuity/react 1.0.3-2a652ba https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-react-1.0.3-2a652ba.tgz
@agentuity/frontend 1.0.3-2a652ba https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-frontend-1.0.3-2a652ba.tgz
@agentuity/workbench 1.0.3-2a652ba https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-workbench-1.0.3-2a652ba.tgz
@agentuity/auth 1.0.3-2a652ba https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-auth-1.0.3-2a652ba.tgz
@agentuity/schema 1.0.3-2a652ba https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-schema-1.0.3-2a652ba.tgz
@agentuity/core 1.0.3-2a652ba https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-core-1.0.3-2a652ba.tgz
@agentuity/server 1.0.3-2a652ba https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-server-1.0.3-2a652ba.tgz
@agentuity/evals 1.0.3-2a652ba https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-evals-1.0.3-2a652ba.tgz
@agentuity/postgres 1.0.3-2a652ba https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-postgres-1.0.3-2a652ba.tgz
@agentuity/runtime 1.0.3-2a652ba https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-runtime-1.0.3-2a652ba.tgz
@agentuity/opencode 1.0.3-2a652ba https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-opencode-1.0.3-2a652ba.tgz
@agentuity/cli 1.0.3-2a652ba https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.3-2a652ba/agentuity-cli-1.0.3-2a652ba.tgz
Install

Add to your package.json:

{
  "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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 | 🟡 Minor

Test 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

📥 Commits

Reviewing files that changed from the base of the PR and between d6061be and 2a652ba.

📒 Files selected for processing (2)
  • packages/server/src/api/sandbox/execute.ts
  • packages/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.ts
  • packages/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.ts
  • packages/server/src/api/sandbox/execute.ts
packages/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use StructuredError from @agentuity/core for error handling

Files:

  • packages/server/test/sandbox-client.test.ts
  • packages/server/src/api/sandbox/execute.ts
packages/*/test/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

packages/*/test/**/*.{ts,tsx}: Place test files in test/ folder, never in src/ or __tests__/
Import from ../src/ in test files
Use @agentuity/test-utils for 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.ts
  • packages/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.ts
  • packages/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 files field 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 previous Object.fromEntries dictionary 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 ExecuteRequestSchema and sandboxExecute implementation, 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.

@jhaynie jhaynie merged commit f77460c into main Feb 6, 2026
15 checks passed
@jhaynie jhaynie deleted the fix/sandbox-execute-files-schema branch February 6, 2026 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant