mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-25 09:41:04 +01:00
test: preserve interruption evidence and allow steered turns
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
d6329bc07b
commit
639cb48562
2 files changed
+16
-5
No files matched your search
@@ -307,6 +307,7 @@ export async function runChatFlow(input: ChatFlowInput) {
|
||||
const draftMarker = chatMarker("DRAFT", nonce);
|
||||
const caseId = execution.task.id;
|
||||
const stopCase = ["stop-new-resume", "stop-startup-new-resume"].includes(caseId);
|
||||
const interruptionCase = ["followup-while-running", "revise-while-running"].includes(caseId);
|
||||
let issue: ChatIssue;
|
||||
let runs: ChatRun[] = [];
|
||||
const settings = await api.get<Record<string, unknown>>(
|
||||
@@ -384,7 +385,7 @@ export async function runChatFlow(input: ChatFlowInput) {
|
||||
|
||||
if (caseId === "enable-disable-resume") {
|
||||
await runChatSettingsLifecycle({ input, marker, issue: () => issue!, idle, allRuns, comments });
|
||||
} else if (["followup-while-running", "revise-while-running"].includes(caseId)) {
|
||||
} else if (interruptionCase) {
|
||||
await runChatInterruption({ input, marker, issue: () => issue!, idle, allRuns, comments,
|
||||
refreshIssue: async () => { issue = await api.get<ChatIssue>(chatPath); input.observe(issue, await allRuns()); } });
|
||||
} else if (
|
||||
@@ -918,10 +919,12 @@ export async function runChatFlow(input: ChatFlowInput) {
|
||||
projects,
|
||||
});
|
||||
}
|
||||
await idle(execution.task.expectedRunCount);
|
||||
expect(runs.filter((run) => !isResetRun(run))).toHaveLength(
|
||||
execution.task.expectedRunCount,
|
||||
);
|
||||
await idle(interruptionCase ? 1 : execution.task.expectedRunCount);
|
||||
// The interruption oracle already proves delivery and bounds one steered
|
||||
// run or two sequential runs. Other stories keep their exact run counts.
|
||||
if (!interruptionCase) expect(runs.filter((run) => !isResetRun(run))).toHaveLength(
|
||||
execution.task.expectedRunCount,
|
||||
);
|
||||
for (const run of runs.filter((run) => !isResetRun(run))) {
|
||||
expect(run.runtimeMode).toBe(execution.profile.expectedRuntimeMode);
|
||||
expect(run.status).toBe(
|
||||
|
||||
@@ -95,6 +95,14 @@ export async function runChatInterruption(context: Context & { refreshIssue(): P
|
||||
} finally {
|
||||
// Always release a provider that is still waiting, including failed UI runs.
|
||||
await writeFile(gate, reference, "utf8");
|
||||
const chatPath = `/api/companies/${input.fixtures.company.id}/chats/${input.fixtures.agent.id}`;
|
||||
const current = await input.api.get<ChatIssue | null>(chatPath).catch(() => null);
|
||||
await input.evidence("chat-interruption-state.json", {
|
||||
issue: current,
|
||||
runs: await allRuns().catch(error => ({ readError: String(error) })),
|
||||
comments: current ? await input.api.get(`/api/issues/${current.id}/comments?order=asc`).catch(error => ({ readError: String(error) })) : [],
|
||||
plan: current && revise ? await input.api.get(`/api/issues/${current.id}/documents/plan`).catch(error => ({ readError: String(error) })) : null,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user