runs: reconcile uncertain browser launches with a persistent intent key

This commit is contained in:
2026-10-20 15:40:43 +01:00
parent f06281db08
commit 44834e91f0
8 changed files with 146 additions and 9 deletions
+14
View File
@@ -332,6 +332,20 @@ test("a run action throws when the reply has no run detail", async () => {
// ---- The composer's own commands (C8/C9) ----------------------------------
test("run retries preserve one admission key and can reconcile without execution", async () => {
const { repo, ws } = connected();
ws.reply = (frame) => ({ id: frame.id, type: "run", run_detail: { id: 42 } });
const intent = { pipelineId: 7, version: 1, prompt: "task", workspace: "/work", requestKey: "same-intent" };
await repo.runPipeline(intent);
await repo.runPipeline(intent);
assert.deepEqual(ws.sent.map((frame) => frame.request_key), ["same-intent", "same-intent"]);
assert.equal((await repo.runByRequestKey("same-intent")).id, 42);
assert.equal(lastFrame(ws).type, "get_run");
assert.equal(lastFrame(ws).request_key, "same-intent");
ws.reply = (frame) => ({ id: frame.id, type: "run" });
assert.equal(await repo.runByRequestKey("not-admitted"), null);
});
test("chatPrompt trims the text, sends the operation and native message ids, and omits files when empty", async () => {
const { repo, ws } = connected();
ws.reply = (frame) => ({ id: frame.id, type: "chat_prompt" });