fix(sync): map workspace warp not found (#28882)

This commit is contained in:
Shoubhit Dash
2026-05-22 23:15:53 +05:30
committed by GitHub
parent 05f51bfe45
commit 0e14404e5f
4 changed files with 29 additions and 1 deletions
@@ -5,6 +5,7 @@ import path from "node:path"
import { Effect, Layer } from "effect"
import { Flag } from "@opencode-ai/core/flag/flag"
import { registerAdapter } from "../../src/control-plane/adapters"
import { WorkspaceID } from "../../src/control-plane/schema"
import type { WorkspaceAdapter } from "../../src/control-plane/types"
import { Workspace } from "../../src/control-plane/workspace"
import { WorkspacePaths } from "../../src/server/routes/instance/httpapi/groups/workspace"
@@ -250,6 +251,26 @@ describe("workspace HttpApi", () => {
}),
)
it.live("returns a declared not found error when warping into a missing workspace", () =>
Effect.gen(function* () {
const dir = yield* tmpdirScoped({ git: true })
const session = yield* Session.use.create({}).pipe(provideInstance(dir))
const workspaceID = WorkspaceID.ascending("wrk_missing_warp")
const response = yield* request(WorkspacePaths.warp, dir, {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ id: workspaceID, sessionID: session.id }),
})
expect(response.status).toBe(404)
expect(yield* Effect.promise(() => response.json())).toEqual({
name: "NotFoundError",
data: { message: `Workspace not found: ${workspaceID}` },
})
}),
)
it.live("creates workspace with the TUI payload shape", () =>
Effect.gen(function* () {
Flag.OPENCODE_EXPERIMENTAL_WORKSPACES = true