Skip to content

fix(sdk): don't fail seeding when a deployment has no workspace-create route - #430

Merged
khaliqgant merged 1 commit into
mainfrom
fix/seeder-implicit-workspaces-clean
Aug 17, 2026
Merged

fix(sdk): don't fail seeding when a deployment has no workspace-create route#430
khaliqgant merged 1 commit into
mainfrom
fix/seeder-implicit-workspaces-clean

Conversation

@khaliqgant

@khaliqgant khaliqgant commented Aug 17, 2026

Copy link
Copy Markdown
Member

Summary

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 — 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:

[workflow] FAILED: Failed to create workspace local:
  HTTP 404 {"code":"not_found","message":"Route not found",...}

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

  • A 404 on the collection route now means "implicit-workspace deployment, nothing to create" and seeding proceeds.
  • It breaks out immediately rather than 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.

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 --noEmit clean.

🤖 Generated with Claude Code

Review in cubic

…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>
@cursor

cursor Bot commented Aug 17, 2026

Copy link
Copy Markdown

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.

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cecde61b-1d7e-4cad-90b4-485c1e8d3ab2

📥 Commits

Reviewing files that changed from the base of the PR and between e583366 and a747865.

📒 Files selected for processing (2)
  • packages/sdk/typescript/src/workspace-seeder.test.ts
  • packages/sdk/typescript/src/workspace-seeder.ts

Included review availability: Your plan includes up to 1 review per rolling hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The 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.

Changes

Workspace seeding

Layer / File(s) Summary
Creation route handling
packages/sdk/typescript/src/workspace-seeder.ts
The seeder records unavailable creation routes, stops alternate payload retries after a 404, and returns successfully. Other failures include the endpoint URL in the error.
Creation route behavior tests
packages/sdk/typescript/src/workspace-seeder.test.ts
Tests verify single-request success for 404 responses, successful 409 handling, and endpoint-specific errors for 500 responses.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to a7478

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: willwashburn

Poem

A rabbit taps the workspace door,
“No route? Then seed no more.”
One 404, the path is clear,
While 500s still cause a leap of fear.
Tests hop on, precise and bright.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: seeding no longer fails when deployments lack a workspace-creation route.
Description check ✅ Passed The description directly explains the 404 handling change, its motivation, implementation, and verification results.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/seeder-implicit-workspaces-clean

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.

❤️ Share

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

@github-actions

Copy link
Copy Markdown

Relayfile Eval Review

Run: .relayfile/evals/runs/2026-08-17T13-01-39-888Z-HEAD-provider
Mode: provider
Git SHA: 68af34f

Passed: 4 | Needs human: 0 | Reviewable: 0 | Missing output: 0 | Failed: 0 | Skipped: 0

Human Review Cases

No reviewable human-review cases captured Relayfile output.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 2 files

Re-trigger cubic

@khaliqgant
khaliqgant merged commit 07397c3 into main Aug 17, 2026
10 checks passed
@khaliqgant
khaliqgant deleted the fix/seeder-implicit-workspaces-clean branch August 17, 2026 14:38
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