fix(sdk): don't fail seeding when a deployment has no workspace-create route - #430
Conversation
…e route
`createWorkspaceIfNeeded` POSTs to `/v1/workspaces` and treated any non-2xx/409
as fatal. relayfile-cloud has no such route — it addresses each workspace as a
Durable Object by name (`WORKSPACE_DO.idFromName(workspaceId)`), so a workspace
comes into existence on the first request addressed to it and there is nothing to
pre-create. Every attempt therefore 404s:
POST https://file.agentrelay.com/v1/workspaces -> 404
POST https://file.agentrelay.com/api/v1/workspaces -> 404
POST https://file.agentrelay.com/workspaces -> 404
404 rather than 401/403, i.e. route absence, not an auth problem.
The blast radius is bigger than seeding: relayflows calls this from its per-agent
Relayfile provisioning path, which is gated on agents declaring `permissions`. So
scoping a workflow's agents — read-only reviewers, a writer confined to its
worktree — made the run die before a single agent spawned, while a workflow that
scoped nothing ran fine. Exactly backwards for a feature whose whole purpose is
least privilege.
A 404 on the collection route now means "implicit-workspace deployment, nothing
to create" and seeding proceeds. It also breaks out immediately instead of
retrying the other three request-body shapes, which cannot conjure an absent
route and only obscured the cause by reporting the last failure. Genuine failures
still throw, and now name the endpoint that was tried.
Verified: 242/242 in packages/sdk/typescript, including three new cases (404 ->
resolves after exactly one attempt, 500 -> throws naming the endpoint, 409 ->
resolves). `tsc --noEmit` clean.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan includes up to 1 review per rolling hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe workspace seeder now treats a missing workspace-creation endpoint as successful implicit provisioning. It stops retries after a 404, preserves failures for other responses, and adds tests for 404, 409, and 500 outcomes. ChangesWorkspace seeding
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This PR narrows workspace seeding behavior for deployments without a workspace-create route while preserving genuine failure handling. No actionable merge-blocking risk remains beyond normal checks and review. Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Relayfile Eval ReviewRun: Passed: 4 | Needs human: 0 | Reviewable: 0 | Missing output: 0 | Failed: 0 | Skipped: 0 Human Review CasesNo reviewable human-review cases captured Relayfile output. |
Summary
createWorkspaceIfNeededPOSTs to/v1/workspacesand treated any non-2xx/409 as fatal. relayfile-cloud has no such route — it addresses each workspace as a Durable Object by name (WORKSPACE_DO.idFromName(workspaceId)), so a workspace comes into existence on the first request addressed to it and there is nothing to pre-create.Every attempt therefore 404s:
404 rather than 401/403 — route absence, not an auth problem.
Why this matters beyond seeding
relayflows calls this from its per-agent Relayfile provisioning path, which is gated on agents declaring
permissions. So scoping a workflow's agents made the run die before a single agent spawned, while a workflow that scoped nothing ran fine:Exactly backwards for a feature whose whole purpose is least privilege. Found while certifying a customer-facing feature-lifecycle workflow whose reviewers are meant to be read-only.
Changes
Verification
packages/sdk/typescript: 242/242 pass, including three new cases — 404 resolves after exactly one attempt, 500 throws naming the endpoint, 409 resolves.tsc --noEmitclean.🤖 Generated with Claude Code