mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-23 13:13:46 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - In agent chat, a finished delegated task or a declined tool action wakes the chat agent so it tells the person > - #21401 stopped a second completion report when an earlier reply already gave it > - But the suppressed completion still created a zero-second heartbeat run, and declined tool actions still got a second report > - Run accounting must count only real turns, and the person must get each outcome once > - This pull request settles an already-reported outcome before it becomes a run, and applies the same rule to declined tool actions > - The benefit is one report per outcome, no phantom run, and no extra model call ## Linked Issues or Issue Description Refs #21401 **What happened?** Chat eval cohort 13 (OpenCode, `openrouter/deepseek/deepseek-v4.1-flash-1017`, master `df1b12ad8e`) showed three problems after #21401. 1. `questions-and-approvals.duplicate-answer`: the completion wake was suppressed, but it still created a 0-second run (`runtimeMode: legacy`, no usage). The bounded-native-runs check rejected that run. 2. `skills.studio-test`: the CEO's single reply reported the Studio result after it read the test task done (0 passed, 1 failed, links COM-2). The completion was then suppressed, but the eval waited for a separate completion run and timed out after 240 s. 3. `questions-and-approvals.decline-tool`: the person declined the tool review one second after the turn for their message started. That turn read the declined action and said so. The decline continuation, which waited behind that turn, then posted the same declined outcome again. **Expected behavior** Each finished task or declined tool action is reported once in the conversation. An outcome that an earlier reply already reported creates no heartbeat run. **Steps to reproduce** 1. In chat, delegate a short task, or start a governed tool read that needs approval. 2. While it waits, send a message that wakes the chat agent. 3. Let the task finish, or decline the tool review, while that turn runs. The turn reads the outcome and reports it. 4. See the completion wake become a 0-second run, or see a second decline report from the decline continuation. **Paperclip version or commit** master `df1b12ad8e` ## What Changed - `server/src/services/chat-completion-delivery.ts`: `settleReportedChatCompletions` marks each undispatched completion that an earlier reply reported as delivered, with that reply as its response. It returns true only when nothing else is owed. The outbox `deliver` also checks this before it requests a wake, so no wake and no run exist for an already-reported completion. - `server/src/modules/wake-queue`: a new transaction port, `skipAlreadyReportedChatWake`, runs in the release drain before a deferred wake is promoted. When the earlier reply already reported every outcome of the wake, the wake ends `skipped` ("Already reported by an earlier reply in this conversation") and no run is created. Wakes that carry queued comments or a failed-chat retry are never skipped. - `server/src/services/chat-interaction-outcome-report.ts` (new): the same structural rule for declined tool actions. A conversation agent run that lists its interactions records `chat_interaction.declined_read` for each declined tool action. The decline continuation is settled when the same agent replied in the conversation after the decline, from a run with that receipt, posted after the read. The rule covers only declined tool-action confirmations. Answers, plan reviews and accepted actions keep their own turn. - `server/src/routes/issues.ts`: `GET /issues/:id/interactions` calls the recorder for agent runs. - The run-start check from #21401 stays as a fallback for a completion turn that was admitted before the earlier reply landed. - `tests/runner-e2e/chat-catalog-domains/integrator-skill-studio.ts`: the Studio oracle (v5) accepts either the completion turn's reply or an earlier CEO reply as the delivery. The earlier reply counts only from saved state: no completion run exists, the replying run has a `chat_handoff.completed_read` receipt for the test task, the reply was posted after that read, it is the only such reply, and it links the saved result. No wording check is added. - `doc/run-log-events.md`: documents both read receipts and the skipped wake outcome. ## Verification - `cd server && npx vitest run src/__tests__/chat-completion-delivery.test.ts src/modules/wake-queue/adapters/chat-declined-outcome-reported.test.ts src/modules/wake-queue/application/use-cases.test.ts`: all pass. - Red: with the drain check and the outbox check disabled, 5 tests fail: "starts no completion wake or run ...", "settles a deferred completion wake without a run ... (true)", "settles the decline continuation with no run ...", and both "settles an already-reported chat wake without a run" cases. - Negative controls stay green: a linking reply without a done read, a decline the earlier turn never read, a non-tool-action card, and an accepted card all still run their continuation. - `npx vitest run --config tests/runner-e2e/vitest.config.ts tests/runner-e2e/chat-catalog-domains/integrator-skill-studio.test.ts`: 34 pass. Red on the old oracle: "accepts the earlier reply the server took as the completion report" fails. New negative cases reject no done read, a read of another task, a reply before the read, a reply from another run, two replies, an extra completion run, and a missing task link. - A narrow paid eval run of `duplicate-answer`, `studio-test` and `decline-tool` on this branch follows in a comment. ## Risks - A completion turn admitted before the earlier reply landed (a narrow race) still ends as a short succeeded run with no model call, as in #21401. - If an earlier reply read the outcome but did not mention it, the person does not get a second message. The read receipt, the reply-after-read order and, for completions, the task link make this unlikely. - The decline rule covers only declined tool-action confirmations. Other interaction outcomes are unchanged. ## Model Used - Claude, claude-opus-5-5, with tool use and code execution in Claude Code. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
189 lines
19 KiB
TypeScript
189 lines
19 KiB
TypeScript
import { readSkillVersionHistory } from "./integrator-skill-versions.js";
|
|
import { saveSkillConversationContext } from "./integrator-skill-context.js";
|
|
import { factualContextQueryAttachment } from "../chat-query-attachments.js";
|
|
import { expect } from "@playwright/test";
|
|
import type { CompanySkillDetail, CompanySkillTestInput, CompanySkillTestRun, CompanySkillTestRunDetail, CompanySkillVersion } from "../../../packages/shared/src/types/company-skill.js";
|
|
import type { ChatCatalogContext } from "../chat-catalog-contract.js";
|
|
import { pollUntil } from "../api.js";
|
|
import { collectRunEvents } from "../run-observations.js";
|
|
import { checks, observation, project, type Entity, type InternalObservation } from "./internal-support.js";
|
|
import { fixtureWorker } from "./internal-definition.js";
|
|
import { integratorDefinition, observeInternal } from "./integrator-support.js";
|
|
export const studioPageInput = '<!doctype html><html lang="en"><head><title>Synthetic landing page</title></head><body><main><h1>Launch trial</h1><form><input type="email" id="trial-email"><button type="submit">Join trial</button></form></main></body></html>';
|
|
const studioMarkdown = "---\nname: accessibility-review\ndescription: Review supplied synthetic HTML for accessibility.\n---\n\nInspect the provided input only. Check that every input has a visible associated label. Record the exact element and evidence for any failed check. Do not invent browser tests or claim production qualification. Save the requested test output and complete the test task; do not create other work. End the output with a fenced json block recording the result exactly as {\"passed\": <number of passed checks>, \"failed\": <number of failed checks>, \"failures\": [{\"check\": \"<check name>\", \"element\": \"<failing element markup copied exactly from the input>\"}]}.";
|
|
// The fixture skill asks for this literal record, so grading reads the record,
|
|
// not the wording of the review around it.
|
|
export interface StudioResultRecord { passed: number; failed: number; failures: Array<{ check: string; element: string }> }
|
|
export function studioResultRecord(output: string): StudioResultRecord | undefined {
|
|
const block = [...output.matchAll(/```json[^\n]*\n([\s\S]*?)```/gi)].at(-1)?.[1];
|
|
if (!block) return undefined;
|
|
try {
|
|
const value = JSON.parse(block) as StudioResultRecord;
|
|
const count = (n: unknown) => Number.isInteger(n) && (n as number) >= 0;
|
|
return count(value.passed) && count(value.failed) && Array.isArray(value.failures) && value.failures.length === value.failed
|
|
&& value.failures.every(row => typeof row?.check === "string" && !!row.check.trim() && typeof row.element === "string" && !!row.element.trim()) ? value : undefined;
|
|
} catch { return undefined; }
|
|
}
|
|
// The only form control in the synthetic input has no label; every reported
|
|
// failing element must be markup copied from the input.
|
|
export function recordFindsMissingLabel(record: StudioResultRecord | undefined) {
|
|
return !!record && record.failed >= 1 && record.failures.every(row => row.element.trim().startsWith("<") && studioPageInput.includes(row.element.trim()))
|
|
&& record.failures.some(row => /^<input\b[^>]*\bid="trial-email"/.test(row.element.trim()));
|
|
}
|
|
// The completion reply must link the saved result: the hidden harness task (or
|
|
// its output document) or the Studio run page.
|
|
export function completionReplyLinksResult(o: StudioObservation) {
|
|
const run = o.studioRuns[0]; if (!run) return false;
|
|
const body = studioCompletionReply(o)?.body ?? "";
|
|
const targets = [run.issueId, run.harnessIssue?.identifier].filter((id): id is string => !!id);
|
|
return [...body.matchAll(/\]\(([^)\s]+)\)/g)].map(match => match[1]!).some(href => {
|
|
// Resolve against the app's own origin, so an absolute app link equals its relative form.
|
|
let url: URL; try { url = new URL(href, o.origin); } catch { return false; }
|
|
return url.origin === new URL(o.origin).origin && (targets.some(id => new RegExp(`^/[^/]+/issues/${id.replace(/[-]/g, "\\-")}$`).test(url.pathname))
|
|
|| (url.pathname.endsWith(`/skills/studio/${run.skillId}`) && url.searchParams.get("run") === run.id));
|
|
});
|
|
}
|
|
/** Saved run-log receipt: the chat agent's run read its handed-off task in the done state. */
|
|
export const COMPLETED_HANDOFF_READ_EVENT = "chat_handoff.completed_read";
|
|
const timestamp = (v: unknown) => typeof v === "string" ? Date.parse(v) : NaN;
|
|
/** The reply that told the person the Studio test finished: either the server's completion
|
|
* turn, or an earlier CEO reply that the server accepted as that report (no completion turn
|
|
* ran). The second is recognized only by saved state: the server settled the completion
|
|
* delivery with this reply, the replying run read the test task done, and the reply was
|
|
* posted after that read. Reply wording is not graded here. */
|
|
function studioCompletionReply(o: StudioObservation) {
|
|
const test = o.studioRuns[0]; if (!test) return undefined;
|
|
const ceos = o.runs.filter(run => run.agentId === o.leadId && run.contextSnapshot?.issueId === o.sourceIssueId);
|
|
const completions = ceos.filter(run => (run.contextSnapshot?.chatCompletionUpdates as Array<{ id?: unknown }> | undefined)?.some(update => update?.id === test.issueId));
|
|
if (completions.length === 1) {
|
|
const completedAt = timestamp((completions[0]!.contextSnapshot!.chatCompletionUpdates as Array<{ completedAt?: unknown }>)[0]?.completedAt);
|
|
const replies = o.sourceComments.filter(row => row.authorAgentId === o.leadId && row.createdByRunId === completions[0]!.id
|
|
&& !!row.body?.trim() && timestamp(row.createdAt) >= completedAt);
|
|
return replies.length === 1 ? { ...replies[0]!, run: completions[0]!, earlier: false } : undefined;
|
|
}
|
|
if (completions.length !== 0) return undefined;
|
|
const reported = ceos.flatMap(run => (o.completedReads?.[run.id] ?? []).filter(read => read.taskId === test.issueId)
|
|
.flatMap(read => o.sourceComments.filter(row => row.authorAgentId === o.leadId && row.createdByRunId === run.id
|
|
&& !!row.body?.trim() && timestamp(row.createdAt) >= timestamp(read.createdAt)).map(row => ({ ...row, run, earlier: true }))));
|
|
const unique = [...new Map(reported.map(row => [row.id, row])).values()];
|
|
// The server must have settled the completion delivery with this exact reply; otherwise a
|
|
// completion turn is still owed and this reply is not the delivery.
|
|
return unique.length === 1 && o.completionReports?.[test.issueId] === unique[0]!.id ? unique[0] : undefined;
|
|
}
|
|
const root = (ctx: ChatCatalogContext, skillId: string) => `/api/companies/${ctx.input.fixtures.company.id}/skills/${skillId}`;
|
|
interface StudioObservation extends InternalObservation { skill: CompanySkillDetail; studioRuns: CompanySkillTestRunDetail[]; pinnedVersions: Record<string, CompanySkillVersion>; sourceIssueId: string; sourceComments: Entity[]; completedReads?: Record<string, Array<{ taskId: string; createdAt: string }>>; completionReports?: Record<string, string | null> }
|
|
async function observeStudio(ctx: ChatCatalogContext, state: Record<string, unknown>): Promise<StudioObservation> {
|
|
const base = await observeInternal(ctx, state); const path = root(ctx, (state.skill as CompanySkillDetail).id);
|
|
const runs = await ctx.input.api.get<CompanySkillTestRun[]>(`${path}/test-runs`);
|
|
const studioRuns = await Promise.all(runs.map(run => ctx.input.api.get<CompanySkillTestRunDetail>(`${path}/test-runs/${run.id}`)));
|
|
const pinnedVersions: Record<string, CompanySkillVersion> = {};
|
|
for (const run of studioRuns) {
|
|
if (run.companyId !== base.companyId || run.skillId !== (state.skill as CompanySkillDetail).id) throw new Error("Foreign Studio test version reference");
|
|
const versions = await readSkillVersionHistory(ctx.input.api, base.companyId, run.skillId, run.skillVersionId);
|
|
const version = versions.find(row => row.id === run.skillVersionId); if (!version) throw new Error("Pinned Studio version detail is missing");
|
|
pinnedVersions[run.id] = version;
|
|
}
|
|
const sourceIssueId = ctx.issue()?.id; if (!sourceIssueId) throw new Error("Studio source conversation is missing");
|
|
const completedReads: Record<string, Array<{ taskId: string; createdAt: string }>> = {};
|
|
for (const run of base.runs.filter(row => row.agentId === base.leadId && row.contextSnapshot?.issueId === sourceIssueId)) {
|
|
const events = await collectRunEvents<{ seq?: number; eventType?: string; createdAt?: string; payload?: { taskId?: unknown } }>((afterSeq, limit) => ctx.input.api.get(
|
|
`/api/heartbeat-runs/${run.id}/events?afterSeq=${afterSeq}&limit=${limit}`));
|
|
completedReads[run.id] = events.filter(event => event.eventType === COMPLETED_HANDOFF_READ_EVENT && typeof event.payload?.taskId === "string" && typeof event.createdAt === "string")
|
|
.map(event => ({ taskId: event.payload!.taskId as string, createdAt: event.createdAt! }));
|
|
}
|
|
// The server's saved completion delivery outcome: which reply, if any, it accepted as the report.
|
|
const handoffs = await ctx.input.api.get<{ items: Array<{ issueId: string; completionReportCommentId?: string | null }> }>(`/api/issues/${sourceIssueId}/chat-handoffs?limit=100`);
|
|
const completionReports = Object.fromEntries(handoffs.items.map(row => [row.issueId, row.completionReportCommentId ?? null]));
|
|
return { ...base, skill: await ctx.input.api.get<CompanySkillDetail>(path), studioRuns, pinnedVersions, sourceIssueId, completedReads, completionReports,
|
|
sourceComments: await ctx.input.api.get<Entity[]>(`/api/issues/${sourceIssueId}/comments?order=asc`) };
|
|
}
|
|
function studioObservation(value: unknown): StudioObservation | undefined {
|
|
const o = value as StudioObservation;
|
|
return observation(value) && !!o.skill && Array.isArray(o.studioRuns) && !!o.pinnedVersions && typeof o.sourceIssueId === "string" && Array.isArray(o.sourceComments) ? o : undefined;
|
|
}
|
|
export function studioNativeRunsComplete(value: unknown): boolean {
|
|
const o = studioObservation(value); if (!o || o.studioRuns.length !== 1 || ![2, 3].includes(o.runs.length)) return false;
|
|
const test = o.studioRuns[0]!, worker = o.state.worker as Entity;
|
|
if (test.companyId !== o.companyId || test.skillId !== (o.state.skill as CompanySkillDetail).id || test.agentId !== worker.id
|
|
|| test.status !== "succeeded" || test.harnessIssue?.id !== test.issueId || test.harnessIssue.status !== "done"
|
|
|| o.runs.some(run => run.companyId !== o.companyId || run.status !== "succeeded" || run.runtimeMode !== "native")) return false;
|
|
const humans = o.sourceComments.filter(row => !row.authorAgentId);
|
|
if (humans.length !== 1 || !humans[0]!.id || !humans[0]!.authorUserId) return false;
|
|
const workers = o.runs.filter(run => run.agentId === worker.id && run.contextSnapshot?.issueId === test.issueId);
|
|
const ceos = o.runs.filter(run => run.agentId === o.leadId && run.contextSnapshot?.issueId === o.sourceIssueId);
|
|
if (workers.length !== 1 || workers.length + ceos.length !== o.runs.length) return false;
|
|
const initial = ceos.filter(run => run.contextSnapshot?.commentId === humans[0]!.id);
|
|
if (initial.length !== 1) return false;
|
|
const completions = ceos.filter(run => {
|
|
const ids = run.contextSnapshot?.chatCompletionDeliveryIds, updates = run.contextSnapshot?.chatCompletionUpdates;
|
|
return Array.isArray(ids) && ids.length === 1 && typeof ids[0] === "string" && ids[0].length > 0 && ids[0].length <= 240
|
|
&& Array.isArray(updates) && updates.length === 1 && updates[0]?.id === test.issueId && updates[0]?.status === "done";
|
|
});
|
|
const initialAt = timestamp(initial[0]!.startedAt), workerAt = timestamp(workers[0]!.startedAt);
|
|
if (![initialAt, workerAt].every(Number.isFinite) || initialAt > workerAt) return false;
|
|
const reply = studioCompletionReply(o);
|
|
if (!reply) return false;
|
|
if (reply.earlier) {
|
|
// The server suppressed the completion turn because this reply already reported it.
|
|
// No completion run may exist, and the reply must come after the worker started.
|
|
return completions.length === 0 && ceos.length === 1 && reply.run.id === initial[0]!.id && timestamp(reply.createdAt) >= workerAt;
|
|
}
|
|
if (completions.length !== 1 || completions[0]!.id === initial[0]!.id) return false;
|
|
const completion = completions[0]!, update = (completion.contextSnapshot!.chatCompletionUpdates as Array<{ completedAt?: unknown }>)[0]!;
|
|
const completedAt = timestamp(update.completedAt), continuationAt = timestamp(completion.startedAt);
|
|
return [completedAt, continuationAt].every(Number.isFinite) && workerAt <= completedAt && continuationAt >= completedAt
|
|
&& completion.contextSnapshot?.wakeReason === "chat_task_completed" && completion.contextSnapshot?.wakeSource === "automation"
|
|
&& reply.run.id === completion.id;
|
|
}
|
|
export function gradeIntegratorSkillStudio(value: unknown) {
|
|
const c = checks(); const o = studioObservation(value);
|
|
c.add("saved-studio-input-execution-output", !!o, "Requires public Studio run detail and actual native harness evidence.");
|
|
if (!o) return c.result();
|
|
const before = o.state.skill as CompanySkillDetail; const input = o.state.input as CompanySkillTestInput; const worker = o.state.worker as Entity;
|
|
const run = o.studioRuns[0]; const version = run && o.pinnedVersions[run.id];
|
|
c.add("one-pinned-synthetic-test", o.studioRuns.length === 1 && !!run && run.companyId === o.companyId && run.skillId === before?.id && run.agentId === worker?.id
|
|
&& run.skillVersionId === before?.currentVersionId && run.skillVersion.id === before?.currentVersionId
|
|
&& run.skillVersion.companyId === o.companyId && run.skillVersion.companySkillId === before.id && run.inputId === input?.id && run.inputSnapshot === studioPageInput
|
|
&& !!version && version.id === run.skillVersionId && version.companyId === o.companyId && version.companySkillId === before.id
|
|
&& version.authorAgentId === run.skillVersion.authorAgentId && version.authorUserId === run.skillVersion.authorUserId
|
|
&& version.fileInventory.some(file => file.path === "SKILL.md" && file.content === before.markdown),
|
|
"Exactly one bounded test retains the actual selected writable revision and synthetic input bytes.");
|
|
c.add("source-bound-native-test-and-completion", studioNativeRunsComplete(o), "One initial CEO turn and one actual Morgan test may include only one proven server-bound completion notification; all retained native work must finish and its original source response must be saved.");
|
|
const native = run && o.runs.find(row => row.agentId === worker?.id && row.contextSnapshot?.issueId === run.issueId);
|
|
c.add("actual-native-harness-completion", !!run && run.status === "succeeded" && !!native && native.runtimeMode === "native" && native.status === "succeeded"
|
|
&& run.harnessIssue?.id === run.issueId && run.harnessIssue.status === "done" && run.harnessContent.available,
|
|
"Studio success is backed by a real completed native harness task; it is not a fabricated test row or another task's run.");
|
|
const output = run?.outputBody ?? "";
|
|
c.add("saved-concrete-sample-failure", !!run && output.length > 0 && output === run.outputSnapshot && recordFindsMissingLabel(studioResultRecord(output))
|
|
&& run.documents.some(doc => doc.key === run.outputDocumentKey && doc.body === output),
|
|
"The saved output's requested result record counts at least one failure and names the supplied unlabeled email input by its exact markup; a successful test execution cannot turn a failing sample into a clean page.");
|
|
c.add("no-unrelated-work-or-skill-mutation", o.skill.currentVersionId === before?.currentVersionId && o.skill.markdown === before.markdown
|
|
&& o.tasks.every(task => task.id === run?.issueId) && !o.activity.some(event => event.agentId === o.leadId && event.action === "company.skill_file_updated"),
|
|
"The test does not rewrite its tested revision or create unrelated production tasks.");
|
|
c.add("reply-links-saved-result", completionReplyLinksResult(o), "The completion reply links the saved Studio result (its test task, output document or Studio run) so the person can inspect it.");
|
|
return c.result();
|
|
}
|
|
export const integratorSkillStudioCases = [integratorDefinition("skills", "skills.studio-test", async ctx => {
|
|
const worker = await fixtureWorker(ctx);
|
|
const skill = await ctx.input.api.post<CompanySkillDetail>(`/api/companies/${ctx.input.fixtures.company.id}/skills`, { name: "Accessibility review", slug: "accessibility-review", markdown: studioMarkdown });
|
|
const input = await ctx.input.api.post<CompanySkillTestInput>(`${root(ctx, skill.id)}/test-inputs`, { name: "Sample landing page", content: studioPageInput });
|
|
const p = await project(ctx, "Launch", { description: `Our writable accessibility skill ${skill.id} has saved Studio input "Sample landing page" (${input.id}), containing synthetic HTML only. Morgan (${worker.id}) is the eligible test runner. Test the existing saved input without browsing unrelated pages.` });
|
|
const selected = await saveSkillConversationContext(ctx, { projectId: p.id, description: `Selected writable skill: ${skill.name} (${skill.id}). Selected saved Studio input: ${input.name} (${input.id}), containing the synthetic landing-page HTML. Morgan (${worker.id}) is the eligible test runner.` });
|
|
return { skill: await ctx.input.api.get<CompanySkillDetail>(root(ctx, skill.id)), input, worker: { id: worker.id }, project: p, factualContextAttachment: selected.factualContextAttachment };
|
|
}, observeStudio, gradeIntegratorSkillStudio, async (ctx, state, value) => {
|
|
const o = studioObservation(value); const run = o?.studioRuns[0]; if (!o || !run) throw new Error("No actual Studio test to inspect");
|
|
const source = ctx.input.page.url();
|
|
await ctx.input.page.goto(new URL(`/${ctx.input.fixtures.company.issuePrefix}/skills/studio/${(state.skill as CompanySkillDetail).id}?run=${run.id}`, ctx.input.api.baseURL).href);
|
|
await expect(ctx.input.page.getByText("Output snapshot", { exact: true })).toBeVisible();
|
|
await expect(ctx.input.page.getByText(/trial-email|email (?:input|field)/i).first()).toBeVisible();
|
|
await ctx.input.evidence("chat-skill-studio-visible-result.json", { skillId: o.skill.id, testRunId: run.id, status: run.status, issueId: run.issueId, interactions: run.interactions, url: ctx.input.page.url() });
|
|
await ctx.input.page.goto(source); await expect(ctx.input.page.getByTestId("task-chat-composer-input")).toBeVisible();
|
|
}, { authentication: "human-session", queryAttachments: factualContextQueryAttachment("skill-context.md"), sourceFiles: ["chat-catalog-domains/integrator-skill-versions.ts", "../../server/src/services/chat-completion-delivery.ts", "chat-catalog-domains/integrator-skill-studio.ts", "chat-catalog-domains/integrator-support.ts", "chat-catalog-domains/internal-support.ts", "chat-catalog-domains/internal-definition.ts", "chat-scenarios/skills.yaml"],
|
|
oracleVersion: "paperclip.chat-catalog.skill-studio.v5", expectedRunCount: 3, minimumRunCount: 2, attemptTimeoutMs: 540_000,
|
|
async act(ctx, state) {
|
|
await pollUntil({ label: "actual bounded skill Studio output", deadlineAt: Date.now() + 240_000, intervalMs: 1000,
|
|
load: () => observeStudio(ctx, state), accept: o => studioNativeRunsComplete(o),
|
|
reject: o => o.studioRuns.length > 1 || o.runs.length > 3 ? "Studio test exceeded its declared one-test execution bound" : (o.studioRuns.some(run => run.status === "failed" || run.status === "cancelled") || o.runs.some(run => ["failed", "cancelled", "timed_out"].includes(run.status))) ? "Studio genuinely failed or was cancelled; retain actual failure evidence rather than substitute a successful output" : undefined });
|
|
},
|
|
})];
|