|
|
@@ -34,7 +34,7 @@ import { resetDatabase } from "../fixture/db"
|
|
|
import { disposeAllInstances, provideInstanceEffect, TestInstance, tmpdirScoped } from "../fixture/fixture"
|
|
|
import { TestLLMServer } from "../lib/llm-server"
|
|
|
import { testProviderConfig } from "../lib/test-provider"
|
|
|
-import { testEffect } from "../lib/effect"
|
|
|
+import { pollWithTimeout, testEffect } from "../lib/effect"
|
|
|
|
|
|
const originalWorkspaces = Flag.OPENCODE_EXPERIMENTAL_WORKSPACES
|
|
|
const workspaceLayer = Workspace.defaultLayer.pipe(
|
|
|
@@ -581,7 +581,7 @@ describe("session HttpApi", () => {
|
|
|
request(`/api/session/${session.id}/prompt`, {
|
|
|
method: "POST",
|
|
|
headers: { ...headers, "content-type": "application/json" },
|
|
|
- body: JSON.stringify({ id: "msg_http_prompt", prompt: { text: "hello" } }),
|
|
|
+ body: JSON.stringify({ id: "msg_http_prompt", prompt: { text: "hello" }, resume: false }),
|
|
|
})
|
|
|
const first = yield* recordPrompt()
|
|
|
const retried = yield* recordPrompt()
|
|
|
@@ -624,6 +624,22 @@ describe("session HttpApi", () => {
|
|
|
message: "Prompt message ID conflicts with an existing durable record: msg_http_prompt",
|
|
|
resource: "msg_http_prompt",
|
|
|
})
|
|
|
+
|
|
|
+ const wakeID = SessionMessage.ID.make("msg_http_wake")
|
|
|
+ const wake = yield* request(`/api/session/${session.id}/prompt`, {
|
|
|
+ method: "POST",
|
|
|
+ headers: { ...headers, "content-type": "application/json" },
|
|
|
+ body: JSON.stringify({ id: wakeID, prompt: { text: "hello again" } }),
|
|
|
+ })
|
|
|
+ expect(wake.status).toBe(200)
|
|
|
+ const message = yield* pollWithTimeout(
|
|
|
+ requestJson<{ data: SessionMessage.Message[] }>(`/api/session/${session.id}/message`, { headers }).pipe(
|
|
|
+ Effect.map(({ data }) => data.find((message) => message.id === wakeID)),
|
|
|
+ ),
|
|
|
+ "V2 prompt was not promoted after wake",
|
|
|
+ "10 seconds",
|
|
|
+ )
|
|
|
+ expect(message).toMatchObject({ id: wakeID, type: "user" })
|
|
|
}),
|
|
|
{ git: true, config: { formatter: false, lsp: false } },
|
|
|
)
|