fix: persist workbench turn admission before preflight

This commit is contained in:
lyon
2026-06-19 21:53:53 +08:00
parent 3d7264113a
commit 5f1763aeac
8 changed files with 420 additions and 68 deletions
@@ -35,3 +35,21 @@ test.describe("submit session authority", () => {
expect(legacyGets).toEqual([]);
});
});
test.describe("submit admission failure", () => {
test.use({ scenarioId: "admission-unavailable" });
test("not-admitted chat failure restores draft and does not add preflight routes", async ({ page }) => {
await gotoWorkbench(page, "/workbench/sessions/ses_completed");
const draft = "admission unavailable draft must survive";
await page.locator(selectors.commandInput).fill(draft);
await page.locator(selectors.commandSend).click();
await expect(page.locator(selectors.commandInput)).toHaveValue(draft);
await expect(page.locator(`${selectors.messageCard}[data-role="agent"][data-status="failed"]`).last()).toContainText("admission_unavailable");
const state = await fakeServerState(page);
expect(state.chatRequests).toHaveLength(1);
const forbiddenPreflights = (state.requestLedger as Array<{ method?: string; path?: string }>).filter((item) => /billing|readiness|preflight|agentrun/iu.test(item.path ?? ""));
expect(forbiddenPreflights).toEqual([]);
});
});