Support Coder workspace snapshot inputs#1432
Conversation
|
The latest Agentuity deployment details.
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds workspace snapshot inputs (dependencies, setupScript), new workspace APIs and client methods for update/refresh/validation, shared CLI helpers and new/updated workspace subcommands (create/get/list/update/refresh/validate-dependencies), expanded tests, and a README Quick Start demonstrating workspace-based session and snapshot workflows. ChangesWorkspace snapshot inputs, API surface, CLI, tests, and docs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Review rate limit: 2/5 reviews remaining, refill in 30 minutes and 31 seconds. Comment |
📦 Canary Packages Publishedversion: PackagesInstallAdd to your {
"dependencies": {
"@agentuity/db": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-db-2.0.12-ce26d25.tgz",
"@agentuity/runtime": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-runtime-2.0.12-ce26d25.tgz",
"@agentuity/schema": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-schema-2.0.12-ce26d25.tgz",
"@agentuity/migrate": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-migrate-2.0.12-ce26d25.tgz",
"@agentuity/task": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-task-2.0.12-ce26d25.tgz",
"@agentuity/webhook": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-webhook-2.0.12-ce26d25.tgz",
"@agentuity/react": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-react-2.0.12-ce26d25.tgz",
"@agentuity/schedule": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-schedule-2.0.12-ce26d25.tgz",
"@agentuity/sandbox": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-sandbox-2.0.12-ce26d25.tgz",
"@agentuity/opencode": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-opencode-2.0.12-ce26d25.tgz",
"@agentuity/core": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-core-2.0.12-ce26d25.tgz",
"@agentuity/auth": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-auth-2.0.12-ce26d25.tgz",
"@agentuity/vector": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-vector-2.0.12-ce26d25.tgz",
"@agentuity/email": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-email-2.0.12-ce26d25.tgz",
"@agentuity/coder-tui": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-coder-tui-2.0.12-ce26d25.tgz",
"@agentuity/claude-code": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-claude-code-2.0.12-ce26d25.tgz",
"@agentuity/coder": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-coder-2.0.12-ce26d25.tgz",
"@agentuity/frontend": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-frontend-2.0.12-ce26d25.tgz",
"@agentuity/workbench": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-workbench-2.0.12-ce26d25.tgz",
"@agentuity/queue": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-queue-2.0.12-ce26d25.tgz",
"@agentuity/postgres": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-postgres-2.0.12-ce26d25.tgz",
"@agentuity/server": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-server-2.0.12-ce26d25.tgz",
"@agentuity/evals": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-evals-2.0.12-ce26d25.tgz",
"@agentuity/drizzle": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-drizzle-2.0.12-ce26d25.tgz",
"@agentuity/cli": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-cli-2.0.12-ce26d25.tgz",
"@agentuity/keyvalue": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-keyvalue-2.0.12-ce26d25.tgz"
}
}Or install directly: bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-db-2.0.12-ce26d25.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-runtime-2.0.12-ce26d25.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-schema-2.0.12-ce26d25.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-migrate-2.0.12-ce26d25.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-task-2.0.12-ce26d25.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-webhook-2.0.12-ce26d25.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-react-2.0.12-ce26d25.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-schedule-2.0.12-ce26d25.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-sandbox-2.0.12-ce26d25.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-opencode-2.0.12-ce26d25.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-core-2.0.12-ce26d25.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-auth-2.0.12-ce26d25.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-vector-2.0.12-ce26d25.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-email-2.0.12-ce26d25.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-coder-tui-2.0.12-ce26d25.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-claude-code-2.0.12-ce26d25.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-coder-2.0.12-ce26d25.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-frontend-2.0.12-ce26d25.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-workbench-2.0.12-ce26d25.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-queue-2.0.12-ce26d25.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-postgres-2.0.12-ce26d25.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-server-2.0.12-ce26d25.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-evals-2.0.12-ce26d25.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-drizzle-2.0.12-ce26d25.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-cli-2.0.12-ce26d25.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-ce26d25/agentuity-keyvalue-2.0.12-ce26d25.tgz |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/coder/README.md`:
- Around line 31-36: The README example uses client.createSession with a
workspaceId field which is not yet part of the session-create contract; remove
the workspaceId property from the example (or replace it with a supported field
like task only) so the documented usage matches the current createSession
validation, and keep the reference to workspaceSession.sessionId and
client.createSession unchanged; add a short note or TODO comment that
workspaceId will be added once the API/schema is updated.
In `@packages/core/test/coder-client.test.ts`:
- Around line 495-530: The test is asserting that CoderClient.createSession
forwards workspaceId, but CoderCreateSessionRequestSchema currently
strips/rejects that field so fetch() will never see it; either (A) update the
test to use only fields allowed by CoderCreateSessionRequestSchema (remove
workspaceId from the payload passed to CoderClient.createSession and assert the
expected body), or (B) if workspaceId must be supported, extend
CoderCreateSessionRequestSchema to include workspaceId and update
CoderClient.createSession to preserve/forward that field so the mocked fetch
receives it; locate references to CoderClient.createSession and
CoderCreateSessionRequestSchema in the diff and apply the chosen change
consistently (schema + client change for option B, or test-only change for
option A).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 73d02916-3516-4c11-b33f-d842fb30df02
📒 Files selected for processing (2)
packages/coder/README.mdpackages/core/test/coder-client.test.ts
📜 Review details
⏰ 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). (16)
- GitHub Check: Framework Integration Tests (TanStack & Next.js)
- GitHub Check: Package Installation & Usage Test
- GitHub Check: Queue SDK Tests
- GitHub Check: Queue CLI Tests
- GitHub Check: Cloud Deployment Tests
- GitHub Check: Standalone Agent Test
- GitHub Check: Playwright E2E Smoke Test
- GitHub Check: Template Integration Tests
- GitHub Check: Sandbox CLI Tests
- GitHub Check: Storage CLI Tests
- GitHub Check: Postgres SSL Integration Test
- GitHub Check: SDK Integration Test Suite
- GitHub Check: Pack & Upload
- GitHub Check: Build
- GitHub Check: Windows WSL CLI Smoke Test
- GitHub Check: Agentuity Deployment
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use Biome as code formatter with tabs (width 3), single quotes, semicolons, lineWidth 100, and trailingCommas es5
Files:
packages/core/test/coder-client.test.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx}: Use TypeScript Strict mode with ESNext target and bundler moduleResolution
UseStructuredErrorfrom@agentuity/corefor error handling
Files:
packages/core/test/coder-client.test.ts
**/test/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/test/**/*.{ts,tsx}: Place tests intest/folder, never insrc/or__tests__/directories
Import from../src/in test files
Use@agentuity/test-utilsfor mocks in tests
Files:
packages/core/test/coder-client.test.ts
packages/core/**/*.test.ts
📄 CodeRabbit inference engine (packages/core/AGENTS.md)
Use Bun's built-in test runner with
bun testcommand
Files:
packages/core/test/coder-client.test.ts
🧠 Learnings (2)
📚 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/core/test/coder-client.test.ts
📚 Learning: 2026-02-21T02:05:57.982Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 1010
File: packages/drizzle/test/proxy.test.ts:594-603
Timestamp: 2026-02-21T02:05:57.982Z
Learning: Do not rely on StructuredError from agentuity/core in test files or simple error handling paths. In tests and straightforward error handling, use plain Error objects to represent failures, reserving StructuredError for more complex error scenarios in application logic.
Applied to files:
packages/core/test/coder-client.test.ts
| // Create a session from a saved workspace | ||
| const workspaceSession = await client.createSession({ | ||
| task: 'Test workspace startup', | ||
| workspaceId: 'ws_...', | ||
| }); | ||
| console.log(`Created workspace session: ${workspaceSession.sessionId}`); |
There was a problem hiding this comment.
Don't document workspaceId until the session-create contract accepts it.
createSession() is still validated against the current session request schema, which does not include workspaceId, so this example will mislead users unless the underlying API change lands in the same PR.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/coder/README.md` around lines 31 - 36, The README example uses
client.createSession with a workspaceId field which is not yet part of the
session-create contract; remove the workspaceId property from the example (or
replace it with a supported field like task only) so the documented usage
matches the current createSession validation, and keep the reference to
workspaceSession.sessionId and client.createSession unchanged; add a short note
or TODO comment that workspaceId will be added once the API/schema is updated.
| test('createSession sends workspaceId in the request body', async () => { | ||
| mockFetch(async (url, init) => { | ||
| expect(url).toBe('https://coder.example/api/hub/session'); | ||
| expect(init?.method).toBe('POST'); | ||
| expect(JSON.parse(String(init?.body))).toMatchObject({ | ||
| task: 'Start from workspace', | ||
| workspaceId: 'hworkspace_test123', | ||
| }); | ||
| return new Response( | ||
| JSON.stringify({ | ||
| sessionId: 'codesess_workspace_create', | ||
| status: 'creating', | ||
| }), | ||
| { | ||
| status: 201, | ||
| headers: { 'content-type': 'application/json' }, | ||
| } | ||
| ); | ||
| }); | ||
|
|
||
| const client = new CoderClient({ | ||
| apiKey: 'ag_test', | ||
| url: 'https://coder.example', | ||
| orgId: 'org_test', | ||
| }); | ||
|
|
||
| await expect( | ||
| client.createSession({ | ||
| task: 'Start from workspace', | ||
| workspaceId: 'hworkspace_test123', | ||
| }) | ||
| ).resolves.toMatchObject({ | ||
| sessionId: 'codesess_workspace_create', | ||
| status: 'creating', | ||
| }); | ||
| }); |
There was a problem hiding this comment.
This test asserts behavior the current session schema doesn't support.
CoderClient.createSession() will only forward fields accepted by CoderCreateSessionRequestSchema, so workspaceId will be rejected or stripped before fetch() sees it unless the schema/client changes first.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/core/test/coder-client.test.ts` around lines 495 - 530, The test is
asserting that CoderClient.createSession forwards workspaceId, but
CoderCreateSessionRequestSchema currently strips/rejects that field so fetch()
will never see it; either (A) update the test to use only fields allowed by
CoderCreateSessionRequestSchema (remove workspaceId from the payload passed to
CoderClient.createSession and assert the expected body), or (B) if workspaceId
must be supported, extend CoderCreateSessionRequestSchema to include workspaceId
and update CoderClient.createSession to preserve/forward that field so the
mocked fetch receives it; locate references to CoderClient.createSession and
CoderCreateSessionRequestSchema in the diff and apply the chosen change
consistently (schema + client change for option B, or test-only change for
option A).
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/cli/src/cmd/coder/workspace/common.ts`:
- Around line 24-26: Replace the plain Error thrown when both input.setupScript
and input.setupScriptFile are provided with a StructuredError-based error:
import StructuredError from '@agentuity/core', create a factory like
SetupScriptValidationError = StructuredError('SetupScriptValidationError'), and
throw a new SetupScriptValidationError with an object containing the message
"Use either --setup-script or --setup-script-file, not both." — update the check
in the same block that references input.setupScript and input.setupScriptFile to
use this new StructuredError factory.
In `@packages/cli/src/cmd/coder/workspace/create.ts`:
- Around line 109-114: The current truthy guard after calling readSetupScript in
createWorkspace (setupScript variable in
packages/cli/src/cmd/coder/workspace/create.ts) drops valid explicit
empty-string values; change the conditional from a truthy check to an explicit
undefined check (i.e., only skip assigning when setupScript === undefined) so
that '' and other falsy but intentional values are preserved when setting
body.setupScript.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: cca10220-02f6-46b4-bdc4-cc3e4df28acb
📒 Files selected for processing (13)
packages/cli/src/cmd/coder/workspace/common.tspackages/cli/src/cmd/coder/workspace/create.tspackages/cli/src/cmd/coder/workspace/get.tspackages/cli/src/cmd/coder/workspace/index.tspackages/cli/src/cmd/coder/workspace/list.tspackages/cli/src/cmd/coder/workspace/refresh.tspackages/cli/src/cmd/coder/workspace/update.tspackages/cli/src/cmd/coder/workspace/validate-dependencies.tspackages/coder/README.mdpackages/core/src/services/coder/client.tspackages/core/src/services/coder/types.tspackages/core/src/services/coder/workspaces.tspackages/core/test/coder-client.test.ts
✅ Files skipped from review due to trivial changes (1)
- packages/coder/README.md
📜 Review details
⏰ 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). (16)
- GitHub Check: Pack & Upload
- GitHub Check: Build
- GitHub Check: Sandbox CLI Tests
- GitHub Check: Standalone Agent Test
- GitHub Check: Windows WSL CLI Smoke Test
- GitHub Check: Template Integration Tests
- GitHub Check: Framework Integration Tests (TanStack & Next.js)
- GitHub Check: Postgres SSL Integration Test
- GitHub Check: Storage CLI Tests
- GitHub Check: Playwright E2E Smoke Test
- GitHub Check: Cloud Deployment Tests
- GitHub Check: Queue CLI Tests
- GitHub Check: Package Installation & Usage Test
- GitHub Check: Queue SDK Tests
- GitHub Check: SDK Integration Test Suite
- GitHub Check: Agentuity Deployment
🧰 Additional context used
📓 Path-based instructions (8)
packages/cli/src/cmd/**/index.ts
📄 CodeRabbit inference engine (packages/cli/AGENTS.md)
packages/cli/src/cmd/**/index.ts: Each command must be structured as a directory insrc/cmd/with anindex.tsfile as the entry point
Always define interfaces or Zod schemas for command options; never useanytype for type safety
Usetui.*helpers (header, info, success, warning, error, table, progress) for formatted TUI output instead of raw console methods
Usectx.loggerfor logging instead of console methods; uselogger.fatal()for fatal errors which logs and exits with code 1
Always checkisJSONMode()before outputting data and provide machine-readable output when in JSON mode
UserequireAuth(ctx)for commands that require authentication oroptionalAuth(ctx)for commands that support optional authentication
Files:
packages/cli/src/cmd/coder/workspace/index.ts
packages/cli/**/*.ts
📄 CodeRabbit inference engine (packages/cli/AGENTS.md)
Use
Bun.file(f).exists()instead ofexistsSync(f)for file existence checks
Files:
packages/cli/src/cmd/coder/workspace/index.tspackages/cli/src/cmd/coder/workspace/list.tspackages/cli/src/cmd/coder/workspace/update.tspackages/cli/src/cmd/coder/workspace/validate-dependencies.tspackages/cli/src/cmd/coder/workspace/refresh.tspackages/cli/src/cmd/coder/workspace/get.tspackages/cli/src/cmd/coder/workspace/common.tspackages/cli/src/cmd/coder/workspace/create.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use Biome as code formatter with tabs (width 3), single quotes, semicolons, lineWidth 100, and trailingCommas es5
Files:
packages/cli/src/cmd/coder/workspace/index.tspackages/cli/src/cmd/coder/workspace/list.tspackages/cli/src/cmd/coder/workspace/update.tspackages/cli/src/cmd/coder/workspace/validate-dependencies.tspackages/cli/src/cmd/coder/workspace/refresh.tspackages/cli/src/cmd/coder/workspace/get.tspackages/core/src/services/coder/workspaces.tspackages/cli/src/cmd/coder/workspace/common.tspackages/cli/src/cmd/coder/workspace/create.tspackages/core/src/services/coder/client.tspackages/core/src/services/coder/types.tspackages/core/test/coder-client.test.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx}: Use TypeScript Strict mode with ESNext target and bundler moduleResolution
UseStructuredErrorfrom@agentuity/corefor error handling
Files:
packages/cli/src/cmd/coder/workspace/index.tspackages/cli/src/cmd/coder/workspace/list.tspackages/cli/src/cmd/coder/workspace/update.tspackages/cli/src/cmd/coder/workspace/validate-dependencies.tspackages/cli/src/cmd/coder/workspace/refresh.tspackages/cli/src/cmd/coder/workspace/get.tspackages/core/src/services/coder/workspaces.tspackages/cli/src/cmd/coder/workspace/common.tspackages/cli/src/cmd/coder/workspace/create.tspackages/core/src/services/coder/client.tspackages/core/src/services/coder/types.tspackages/core/test/coder-client.test.ts
**/index.ts
📄 CodeRabbit inference engine (AGENTS.md)
Use named exports from package
index.tsfiles
Files:
packages/cli/src/cmd/coder/workspace/index.ts
packages/core/src/**/*.ts
📄 CodeRabbit inference engine (packages/core/AGENTS.md)
packages/core/src/**/*.ts: Build TypeScript withbun run buildcommand
Run TypeScript type checking withbun run typecheckcommand
Ensure runtime compatibility with both Browser and Node/Bun environments with no runtime-specific code
Build target must be ESNext with TypeScript declaration files
Prefer interfaces for public APIs
Use generics for reusable type utilities
Ensure no side effects in all exports - all exports must be pure with no global mutations
All relative imports in TypeScript files MUST include the.tsextension
Runbun run buildbefore publishing to compile TypeScript
Files:
packages/core/src/services/coder/workspaces.tspackages/core/src/services/coder/client.tspackages/core/src/services/coder/types.ts
**/test/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/test/**/*.{ts,tsx}: Place tests intest/folder, never insrc/or__tests__/directories
Import from../src/in test files
Use@agentuity/test-utilsfor mocks in tests
Files:
packages/core/test/coder-client.test.ts
packages/core/**/*.test.ts
📄 CodeRabbit inference engine (packages/core/AGENTS.md)
Use Bun's built-in test runner with
bun testcommand
Files:
packages/core/test/coder-client.test.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/cli/src/cmd/coder/workspace/index.tspackages/cli/src/cmd/coder/workspace/list.tspackages/cli/src/cmd/coder/workspace/update.tspackages/cli/src/cmd/coder/workspace/validate-dependencies.tspackages/cli/src/cmd/coder/workspace/refresh.tspackages/cli/src/cmd/coder/workspace/get.tspackages/core/src/services/coder/workspaces.tspackages/cli/src/cmd/coder/workspace/common.tspackages/cli/src/cmd/coder/workspace/create.tspackages/core/src/services/coder/client.tspackages/core/src/services/coder/types.tspackages/core/test/coder-client.test.ts
📚 Learning: 2026-02-17T14:23:15.448Z
Learnt from: potofpie
Repo: agentuity/sdk PR: 974
File: packages/cli/src/cmd/git/account/list.ts:39-40
Timestamp: 2026-02-17T14:23:15.448Z
Learning: In the Agentuity CLI framework (packages/cli), when a subcommand declares requires: { auth: true }, the framework will automatically call requireAuth() before invoking the handler. Do not call requireAuth(ctx) manually inside command handlers. This applies to all TypeScript command files under packages/cli/src, including paths like packages/cli/src/cmd/git/account/list.ts.
Applied to files:
packages/cli/src/cmd/coder/workspace/index.tspackages/cli/src/cmd/coder/workspace/list.tspackages/cli/src/cmd/coder/workspace/update.tspackages/cli/src/cmd/coder/workspace/validate-dependencies.tspackages/cli/src/cmd/coder/workspace/refresh.tspackages/cli/src/cmd/coder/workspace/get.tspackages/cli/src/cmd/coder/workspace/common.tspackages/cli/src/cmd/coder/workspace/create.ts
📚 Learning: 2026-02-21T02:05:57.982Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 1010
File: packages/drizzle/test/proxy.test.ts:594-603
Timestamp: 2026-02-21T02:05:57.982Z
Learning: Do not rely on StructuredError from agentuity/core in test files or simple error handling paths. In tests and straightforward error handling, use plain Error objects to represent failures, reserving StructuredError for more complex error scenarios in application logic.
Applied to files:
packages/core/test/coder-client.test.ts
🔇 Additional comments (3)
packages/cli/src/cmd/coder/workspace/get.ts (1)
67-67: Nice reuse of shared workspace renderingUsing
printWorkspaceSummary(workspace)here keeps output consistent with other workspace commands.packages/cli/src/cmd/coder/workspace/index.ts (1)
45-47: Subcommand registration looks good
update,refresh, andvalidate-dependenciesare correctly wired into the workspace command tree.packages/cli/src/cmd/coder/workspace/update.ts (1)
85-152: No changes needed. The workspace command handlers correctly usetui.fatal()for error reporting and exit, which is the established pattern across all CLI command handlers in the codebase. TheStructuredErrorguideline applies to utility functions and internal error handling, not to command handler exit paths.> Likely an incorrect or invalid review comment.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/cli/test/cmd/coder/workspace.test.ts (1)
16-57: Replace manual process/fetch monkeypatching with@agentuity/test-utilsmocks.This test file directly monkeypatches
globalThis.fetch,process.exit, andprocess.stderr.writeinstead of using the standard mocking utilities. Use@agentuity/test-utilsto align with the repository's test-mocking standard for consistency and maintainability across CLI tests.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/cli/test/cmd/coder/workspace.test.ts` around lines 16 - 57, The tests are manually monkeypatching globals (globalThis.fetch, process.exit, process.stderr.write) via helper functions like interceptFatal; replace these with the standard mocks from `@agentuity/test-utils`: import and use its fetch, processExit/processStderr utilities (or the documented equivalents) instead of globalThis.fetch and interceptFatal, update tests that call interceptFatal to use the test-utils' mock APIs to capture stderr and exit codes, and ensure proper setup/teardown (beforeEach/afterEach or returned restore functions) so mocks are restored after each spec; update references to makeContext only if its opts/json shape needs adapting to the test-utils mocks.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/cli/src/cmd/coder/workspace/common.ts`:
- Around line 34-35: Wrap the raw file read of input.setupScriptFile in a
try/catch and convert any IO error into a structured validation error: instead
of letting Bun.file(input.setupScriptFile).text() throw, call it inside try {
... } and on error throw a SetupScriptValidationError (which should extend
StructuredError from `@agentuity/core` or use the existing
SetupScriptValidationError type) with a clear message, include the original
error as the cause/detail, and ensure you import StructuredError/@agentuity/core
or the existing SetupScriptValidationError symbol; update the code path that
returns the file text (the snippet referencing input.setupScriptFile and
Bun.file(...).text()) to return the text on success and throw the structured
error on failure.
---
Nitpick comments:
In `@packages/cli/test/cmd/coder/workspace.test.ts`:
- Around line 16-57: The tests are manually monkeypatching globals
(globalThis.fetch, process.exit, process.stderr.write) via helper functions like
interceptFatal; replace these with the standard mocks from
`@agentuity/test-utils`: import and use its fetch, processExit/processStderr
utilities (or the documented equivalents) instead of globalThis.fetch and
interceptFatal, update tests that call interceptFatal to use the test-utils'
mock APIs to capture stderr and exit codes, and ensure proper setup/teardown
(beforeEach/afterEach or returned restore functions) so mocks are restored after
each spec; update references to makeContext only if its opts/json shape needs
adapting to the test-utils mocks.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2ee59006-eac8-48ed-a3c9-d42f128f5109
📒 Files selected for processing (3)
packages/cli/src/cmd/coder/workspace/common.tspackages/cli/src/cmd/coder/workspace/create.tspackages/cli/test/cmd/coder/workspace.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/cli/src/cmd/coder/workspace/create.ts
📜 Review details
⏰ 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). (16)
- GitHub Check: Sandbox CLI Tests
- GitHub Check: Playwright E2E Smoke Test
- GitHub Check: Queue SDK Tests
- GitHub Check: Template Integration Tests
- GitHub Check: Storage CLI Tests
- GitHub Check: Queue CLI Tests
- GitHub Check: Framework Integration Tests (TanStack & Next.js)
- GitHub Check: Standalone Agent Test
- GitHub Check: Postgres SSL Integration Test
- GitHub Check: SDK Integration Test Suite
- GitHub Check: Package Installation & Usage Test
- GitHub Check: Cloud Deployment Tests
- GitHub Check: Pack & Upload
- GitHub Check: Windows WSL CLI Smoke Test
- GitHub Check: Build
- GitHub Check: Agentuity Deployment
🧰 Additional context used
📓 Path-based instructions (4)
packages/cli/**/*.ts
📄 CodeRabbit inference engine (packages/cli/AGENTS.md)
Use
Bun.file(f).exists()instead ofexistsSync(f)for file existence checks
Files:
packages/cli/src/cmd/coder/workspace/common.tspackages/cli/test/cmd/coder/workspace.test.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use Biome as code formatter with tabs (width 3), single quotes, semicolons, lineWidth 100, and trailingCommas es5
Files:
packages/cli/src/cmd/coder/workspace/common.tspackages/cli/test/cmd/coder/workspace.test.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx}: Use TypeScript Strict mode with ESNext target and bundler moduleResolution
UseStructuredErrorfrom@agentuity/corefor error handling
Files:
packages/cli/src/cmd/coder/workspace/common.tspackages/cli/test/cmd/coder/workspace.test.ts
**/test/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/test/**/*.{ts,tsx}: Place tests intest/folder, never insrc/or__tests__/directories
Import from../src/in test files
Use@agentuity/test-utilsfor mocks in tests
Files:
packages/cli/test/cmd/coder/workspace.test.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/cli/src/cmd/coder/workspace/common.tspackages/cli/test/cmd/coder/workspace.test.ts
📚 Learning: 2026-02-17T14:23:15.448Z
Learnt from: potofpie
Repo: agentuity/sdk PR: 974
File: packages/cli/src/cmd/git/account/list.ts:39-40
Timestamp: 2026-02-17T14:23:15.448Z
Learning: In the Agentuity CLI framework (packages/cli), when a subcommand declares requires: { auth: true }, the framework will automatically call requireAuth() before invoking the handler. Do not call requireAuth(ctx) manually inside command handlers. This applies to all TypeScript command files under packages/cli/src, including paths like packages/cli/src/cmd/git/account/list.ts.
Applied to files:
packages/cli/src/cmd/coder/workspace/common.ts
📚 Learning: 2026-02-21T02:05:57.982Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 1010
File: packages/drizzle/test/proxy.test.ts:594-603
Timestamp: 2026-02-21T02:05:57.982Z
Learning: Do not rely on StructuredError from agentuity/core in test files or simple error handling paths. In tests and straightforward error handling, use plain Error objects to represent failures, reserving StructuredError for more complex error scenarios in application logic.
Applied to files:
packages/cli/test/cmd/coder/workspace.test.ts
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/cli/src/cmd/coder/workspace/common.ts`:
- Around line 64-73: The fallback guidance in formatWorkspaceValidationMessage
currently omits the new --setup-script-file flag; update the
EMPTY_WORKSPACE_ERROR branch in function formatWorkspaceValidationMessage to
include --setup-script-file alongside --setup-script, i.e. change the guidance
string that currently reads "Use --repo, --dependency, --setup-script, or
--enabled-agents." to include the file-backed option so users are pointed to the
correct supported flags (reference EMPTY_WORKSPACE_ERROR and the
formatWorkspaceValidationMessage function to locate the change).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8d06d509-bb61-4da0-966c-5e52e20803cc
📒 Files selected for processing (2)
packages/cli/src/cmd/coder/workspace/common.tspackages/cli/test/cmd/coder/workspace.test.ts
📜 Review details
⏰ 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). (15)
- GitHub Check: Postgres SSL Integration Test
- GitHub Check: Playwright E2E Smoke Test
- GitHub Check: Template Integration Tests
- GitHub Check: Queue CLI Tests
- GitHub Check: Framework Integration Tests (TanStack & Next.js)
- GitHub Check: Queue SDK Tests
- GitHub Check: Cloud Deployment Tests
- GitHub Check: Storage CLI Tests
- GitHub Check: Standalone Agent Test
- GitHub Check: Sandbox CLI Tests
- GitHub Check: SDK Integration Test Suite
- GitHub Check: Package Installation & Usage Test
- GitHub Check: Pack & Upload
- GitHub Check: Windows WSL CLI Smoke Test
- GitHub Check: Agentuity Deployment
🧰 Additional context used
📓 Path-based instructions (4)
packages/cli/**/*.ts
📄 CodeRabbit inference engine (packages/cli/AGENTS.md)
Use
Bun.file(f).exists()instead ofexistsSync(f)for file existence checks
Files:
packages/cli/src/cmd/coder/workspace/common.tspackages/cli/test/cmd/coder/workspace.test.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use Biome as code formatter with tabs (width 3), single quotes, semicolons, lineWidth 100, and trailingCommas es5
Files:
packages/cli/src/cmd/coder/workspace/common.tspackages/cli/test/cmd/coder/workspace.test.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx}: Use TypeScript Strict mode with ESNext target and bundler moduleResolution
UseStructuredErrorfrom@agentuity/corefor error handling
Files:
packages/cli/src/cmd/coder/workspace/common.tspackages/cli/test/cmd/coder/workspace.test.ts
**/test/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/test/**/*.{ts,tsx}: Place tests intest/folder, never insrc/or__tests__/directories
Import from../src/in test files
Use@agentuity/test-utilsfor mocks in tests
Files:
packages/cli/test/cmd/coder/workspace.test.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/cli/src/cmd/coder/workspace/common.tspackages/cli/test/cmd/coder/workspace.test.ts
📚 Learning: 2026-02-17T14:23:15.448Z
Learnt from: potofpie
Repo: agentuity/sdk PR: 974
File: packages/cli/src/cmd/git/account/list.ts:39-40
Timestamp: 2026-02-17T14:23:15.448Z
Learning: In the Agentuity CLI framework (packages/cli), when a subcommand declares requires: { auth: true }, the framework will automatically call requireAuth() before invoking the handler. Do not call requireAuth(ctx) manually inside command handlers. This applies to all TypeScript command files under packages/cli/src, including paths like packages/cli/src/cmd/git/account/list.ts.
Applied to files:
packages/cli/src/cmd/coder/workspace/common.ts
📚 Learning: 2026-02-21T02:05:57.982Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 1010
File: packages/drizzle/test/proxy.test.ts:594-603
Timestamp: 2026-02-21T02:05:57.982Z
Learning: Do not rely on StructuredError from agentuity/core in test files or simple error handling paths. In tests and straightforward error handling, use plain Error objects to represent failures, reserving StructuredError for more complex error scenarios in application logic.
Applied to files:
packages/cli/test/cmd/coder/workspace.test.ts
🔇 Additional comments (5)
packages/cli/src/cmd/coder/workspace/common.ts (3)
1-58: Shared setup-script helpers look solid.The structured error wrapper, comma-list parser, and selection detection read cleanly and line up with the new CLI flows.
75-103: Workspace summary rendering looks good.The new summary keeps the non-JSON output compact while surfacing the key workspace fields added by this PR.
60-61: The caller properly prevents empty updates by using conditional spreads and assignments.The body object is constructed with
...(opts?.name && { name: opts.name })and similar patterns that only add keys for truthy values. Unset options are indeed stripped before callinghasWorkspaceUpdate. The validation is actually redundant—the Zod schema includes an identical.refine()check at the schema level that validatesObject.keys(input).length > 0, so the hasWorkspaceUpdate guard and schema validation both enforce the same constraint.packages/cli/test/cmd/coder/workspace.test.ts (2)
98-305: Create-command coverage looks aligned with the new behavior.These cases cover the updated examples, empty-selection failure, dependency parsing, inline/file setup scripts, and the setup-script conflict path without any obvious gaps.
307-426: Update, refresh, and dependency-validation coverage looks good.The tests exercise the new PATCH, snapshot refresh, and dependency-validation flows with the expected request and response shapes.
| export function formatWorkspaceValidationMessage(issues: Array<{ message: string }>): string { | ||
| const messages = [...new Set(issues.map((issue) => issue.message).filter(Boolean))]; | ||
| if (messages.length === 0) { | ||
| return 'Invalid workspace configuration'; | ||
| } | ||
| if (messages.includes(EMPTY_WORKSPACE_ERROR)) { | ||
| return `${EMPTY_WORKSPACE_ERROR}. Use --repo, --dependency, --setup-script, or --enabled-agents.`; | ||
| } | ||
| return messages.join('; '); | ||
| } |
There was a problem hiding this comment.
Keep the empty-workspace guidance in sync with the supported flags.
The fallback message still omits --setup-script-file, even though the create flow now supports file-backed setup scripts. If a file resolves to empty content, this guidance points users at an incomplete set of valid inputs.
✏️ Suggested tweak
- return `${EMPTY_WORKSPACE_ERROR}. Use --repo, --dependency, --setup-script, or --enabled-agents.`;
+ return `${EMPTY_WORKSPACE_ERROR}. Use --repo, --dependency, --setup-script, --setup-script-file, or --enabled-agents.`;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| export function formatWorkspaceValidationMessage(issues: Array<{ message: string }>): string { | |
| const messages = [...new Set(issues.map((issue) => issue.message).filter(Boolean))]; | |
| if (messages.length === 0) { | |
| return 'Invalid workspace configuration'; | |
| } | |
| if (messages.includes(EMPTY_WORKSPACE_ERROR)) { | |
| return `${EMPTY_WORKSPACE_ERROR}. Use --repo, --dependency, --setup-script, or --enabled-agents.`; | |
| } | |
| return messages.join('; '); | |
| } | |
| export function formatWorkspaceValidationMessage(issues: Array<{ message: string }>): string { | |
| const messages = [...new Set(issues.map((issue) => issue.message).filter(Boolean))]; | |
| if (messages.length === 0) { | |
| return 'Invalid workspace configuration'; | |
| } | |
| if (messages.includes(EMPTY_WORKSPACE_ERROR)) { | |
| return `${EMPTY_WORKSPACE_ERROR}. Use --repo, --dependency, --setup-script, --setup-script-file, or --enabled-agents.`; | |
| } | |
| return messages.join('; '); | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/cli/src/cmd/coder/workspace/common.ts` around lines 64 - 73, The
fallback guidance in formatWorkspaceValidationMessage currently omits the new
--setup-script-file flag; update the EMPTY_WORKSPACE_ERROR branch in function
formatWorkspaceValidationMessage to include --setup-script-file alongside
--setup-script, i.e. change the guidance string that currently reads "Use
--repo, --dependency, --setup-script, or --enabled-agents." to include the
file-backed option so users are pointed to the correct supported flags
(reference EMPTY_WORKSPACE_ERROR and the formatWorkspaceValidationMessage
function to locate the change).
Five test files were testing code that no longer exists in v3:
* test/cmd/dev/backend-proxy.test.ts \u2014 v2 dev-server / Vite proxy
behavior. The src/cmd/build/vite/vite-asset-server-config.ts module
they import was removed when v3 dropped the v2 build pipeline.
* test/cmd/build/vite/public-folder.test.ts \u2014 same root cause as
backend-proxy.test.ts.
* test/coder-config.test.ts \u2014 imports src/coder-config.ts (removed
in v3).
* test/hub-url.test.ts \u2014 imports src/cmd/coder/hub-url.ts (removed
in v3).
* test/cmd/coder/workspace.test.ts \u2014 main PR #1432 expanded this
file to cover refresh / update / validate-dependencies subcommands
+ setup-script / dependency options on create. None of those landed
in v3 (the subcommand source files were intentionally removed
during the merge because they reference @agentuity/core types that
don't exist in v3 yet). Reverted to the pre-merge version that
matches v3's create.ts.
After this change: 619 tests pass, 0 fail (was 617 pass, 13 fail). The
removed tests were filed by the test runner as failures every PR
build; this clears that noise so the remaining suite is meaningful.
Summary
Test
bun test packages/core/test/coder-client.test.tsbun run --filter='./packages/core' typecheckbun run --filter='./packages/cli' typecheckSummary by CodeRabbit
New Features
User Experience
Documentation
Tests