Type session not-found errors (#25818)

This commit is contained in:
Kit Langton
2026-05-05 21:33:47 -04:00
committed by GitHub
parent f5c3d352a1
commit 8555de8189
22 changed files with 623 additions and 132 deletions

View File

@@ -50,9 +50,9 @@ const effectIt = testEffect(
),
)
function app() {
Flag.OPENCODE_EXPERIMENTAL_HTTPAPI = true
return Server.Default().app
function app(experimental = true) {
Flag.OPENCODE_EXPERIMENTAL_HTTPAPI = experimental
return experimental ? Server.Default().app : Server.Legacy().app
}
function serverUrl() {
@@ -121,6 +121,18 @@ describe("pty HttpApi bridge", () => {
expect(missing.status).toBe(404)
})
test("matches Hono missing PTY error body", async () => {
await using tmp = await tmpdir({ git: true, config: { formatter: false, lsp: false } })
const headers = { "x-opencode-directory": tmp.path }
const path = PtyPaths.get.replace(":ptyID", PtyID.ascending())
const hono = await app(false).request(path, { headers })
const httpapi = await app().request(path, { headers })
expect(httpapi.status).toBe(hono.status)
expect(await httpapi.json()).toEqual(await hono.json())
})
test("returns 404 for missing PTY websocket before upgrade", async () => {
await using tmp = await tmpdir({ git: true, config: { formatter: false, lsp: false } })
const response = await app().request(PtyPaths.connect.replace(":ptyID", PtyID.ascending()), {