test(e2e): retain safe Skill Studio failure steps (#23108)

## Thinking Path

> - Paperclip lets people manage agents and their saved work.
> - Product E2E tests check a skill from creation through a saved Studio
edit.
> - A browser failure can happen after the agent completes its work.
> - The report replaces each raw browser error with one general failure
code.
> - That code does not show which Studio step failed.
> - This change keeps a fixed step code and excludes raw browser data.

## Linked Issues or Issue Description

**What happened?**

A skill edit journey can fail after skill creation passes. Its saved
result has only `journey_operation_failed`. It cannot distinguish a
missing task card from an unloaded file or a failed save. Raw browser
errors can contain private content, so copying those errors into reports
is unsafe.

**Expected behavior**

Keep a fixed code for the failed step. Keep the failed grade. Exclude
browser messages, URLs, skill contents and nested error causes.

**Steps to reproduce**

Run the shared browser helper with a missing skill card or an editor
whose saved file never loads. Before this change, both errors lose their
step when the Product E2E report grades them.

Refs #18305, which fixed delayed file loading and is already present.
#19095 changes a separate frozen catalog observer. Neither supplies
these shared journey failure codes. This patch does not establish the
cause of an earlier hosted failure.

## What Changed

- Give the shared Studio helper a closed set of step codes.
- Keep the original browser actions, assertions and save/readback
checks.
- Test a missing card and an unloaded file with real Chromium.
- Check that the normal journey failure formatter keeps the code and
drops private error text.
- Document the report codes. Classic and Cloud callers share the helper.

## Verification

- On the old code, the browser suite had 2 failures and 2 passes. The
failures exposed the missing step codes.
- With the repair, all 4 browser checks pass. Immediate and delayed file
loading still preserve the original content, save the edit, reload and
read it from the task card. An unloaded file still receives no input or
save.
- All 5 `journey-failure.test.ts` checks pass. The new case runs the
helper and the real failure formatter together.
- Commands: `pnpm exec playwright test --config
tests/runner-e2e/playwright-support.config.ts
skill-studio-flow.spec.ts`; `pnpm exec vitest run --config
tests/runner-e2e/vitest.config.ts journey-failure.test.ts`.
- `pnpm test:e2e:runner:typecheck` passes. Current-head CI and reviews
remain required.
- `pnpm verify` could not select tests: the managed Git storage guard
rejects `git ls-files`. This is not a pass. Focused commands ran
directly.
- These are controlled browser checks on Linux with synthetic data. No
hosted provider run, staging recovery or full-plan pass is claimed.

## Risks

The code names identify a failed step. They do not establish its root
cause. The helper drops raw errors and their causes to protect private
data. The change affects both callers of this shared helper. It adds no
retries and changes no selectors, deadlines, grades, selected cases or
protected pins.

## Model Used

OpenAI Codex, GPT-6 family, with reasoning and code execution. The host
does not expose the exact runtime model ID or context-window size.

## 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
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge

---------

Co-authored-by: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip authored and GitHub committed 2026-12-01 16:26:11 +00:00
1 parent f14929d21b
commit 176cb8eee2
4 files changed
+87 -31

No files matched your search

+9
View File
@@ -592,3 +592,12 @@ or a 408, 429, 502, 503 or 504 response, inside the caller's original timeout. I
honors a `Retry-After` of up to five seconds. It never repeats a write or a binary
download (`bytes`). The observed reader opts out, so its own retry loop records
every transient failure in `observation-read-failures.json`.
The shared Skill Studio edit story reports a closed `skill_studio_<step>_failed`
code when a browser or saved-file read step fails. The code identifies opening
the card, reading its preview, opening Studio, loading or editing the file,
saving, saved-content verification, reload, returning to the task, or reopening
the card. Raw browser errors, URLs and skill contents are excluded. Both classic
and Cloud callers use this helper. These codes locate a failed step; they do
not establish a product cause or change the failed grade.
@@ -1,5 +1,6 @@
import { describe, expect, it } from "vitest";
import { ConnectionFailure } from "../connection-config.js";
import { editCreatedSkillThroughStudio } from "../skill-studio-flow.js";
import { journeyFailure } from "./launch.js";
describe("journeyFailure", () => {
@@ -19,6 +20,15 @@ describe("journeyFailure", () => {
expect(journeyFailure(new ConnectionFailure("api_status_502"))).toEqual({ outcome: "failed", code: "api_status_502" });
});
it("keeps the Studio step through final journey grading without browser details", async () => {
const page = { getByRole() { throw new Error("https://private.example/?token=secret skill-body"); } };
const error = await editCreatedSkillThroughStudio({ page: page as never, skillId: "owned", skillName: "owned",
marker: "marker", deadlineAt: Date.now() + 1000, read: async () => ({}) }).catch(error => error);
expect(journeyFailure(error)).toEqual({ outcome: "failed", code: "skill_studio_open_card_failed" });
expect(JSON.stringify(error)).not.toMatch(/private|token|secret|skill-body/);
expect(error.cause).toBeUndefined();
});
it("never retains free-form messages", () => {
expect(journeyFailure(new ConnectionFailure("api_status_500 https://example.test/?token=secret"))).toEqual({ outcome: "failed", code: "journey_operation_failed" });
expect(journeyFailure(new Error("api_status_500"))).toEqual({ outcome: "failed", code: "journey_operation_failed" });
+11 -1
View File
@@ -39,7 +39,17 @@ test("Studio never edits or saves an unhydrated file", async ({ page }) => {
<button onclick="window.savedUnloadedFile()">Save</button>` }));
await page.goto("https://fixture.test/QA/issues/QA-1");
await expect(editCreatedSkillThroughStudio({ page, skillId: "id", skillName: "owned", marker: "New content", deadlineAt: Date.now() + 7000,
read: async () => ({}) })).rejects.toThrow();
read: async () => ({}) })).rejects.toMatchObject({ outcome: "failed", code: "skill_studio_load_file_failed", message: "skill_studio_load_file_failed" });
expect(inputs).toBe(0);
expect(saves).toBe(0);
});
test("Studio identifies a missing task card without retaining browser text", async ({ page }) => {
await page.route("https://fixture.test/**", route => route.fulfill({ contentType: "text/html", body: "<p>No skill card</p>" }));
await page.goto("https://fixture.test/QA/issues/QA-1?token=private-fixture-value");
const failure = await editCreatedSkillThroughStudio({ page, skillId: "owned", skillName: "private-skill-name",
marker: "private-marker", deadlineAt: Date.now() + 7000, read: async () => ({}) }).catch(error => error);
expect(failure).toMatchObject({ outcome: "failed", code: "skill_studio_open_card_failed", message: "skill_studio_open_card_failed" });
expect(JSON.stringify(failure)).not.toMatch(/private|fixture.test|token=/);
});
+57 -30
View File
@@ -1,38 +1,65 @@
import { expect, type Page } from "@playwright/test";
type StudioStep = "open_card" | "read_preview" | "open_studio" | "load_file" | "edit_file"
| "save_file" | "verify_saved" | "reload_file" | "return_task" | "reopen_card";
class SkillStudioFlowError extends Error {
readonly outcome = "failed";
readonly code: string;
constructor(step: StudioStep) {
const code = `skill_studio_${step}_failed`;
super(code);
this.code = code;
}
}
/** Shared browser story for classic and Cloud: activity card -> Studio -> saved task readback. */
export async function editCreatedSkillThroughStudio(input: {
page: Page; skillId: string; skillName: string; marker: string; deadlineAt: number;
read(): Promise<unknown>;
}) {
const { page, skillName } = input;
const card = page.getByRole("article", { name: `Skill created: ${skillName}`, exact: true });
await expect(card).toHaveCount(1);
await expect(card).toBeVisible();
await card.getByRole("button").click();
await expect(page.getByRole("heading", { name: skillName, exact: true })).toBeVisible();
await expect(page.getByText("Verify checks.", { exact: true })).toBeVisible();
await page.getByRole("button", { name: "Open in Skill Studio", exact: true }).click();
await expect(page).toHaveURL(new RegExp(`/skills/studio/${input.skillId}$`));
await expect(page.getByRole("combobox").filter({ hasText: skillName })).toBeVisible();
const editor = page.getByRole("textbox", { name: "editable markdown", exact: true });
// Studio mounts the editor before its file query completes. Wait for the
// saved body, otherwise hydration can replace edits made to the empty draft.
await expect(editor).toContainText("Verify checks.");
await editor.click();
await editor.press("ControlOrMeta+End");
await editor.press("Enter");
await editor.press("Enter");
await editor.pressSequentially(input.marker);
await page.getByRole("button", { name: /^Save$/ }).click();
await expect.poll(async () => JSON.stringify(await input.read()).includes(input.marker),
{ timeout: Math.max(1, Math.min(30_000, input.deadlineAt - Date.now())) }).toBe(true);
await page.reload();
await expect(editor).toContainText(input.marker);
await page.goBack();
await expect(page).toHaveURL(/\/issues\//);
await expect(card).toBeVisible();
await card.getByRole("button").click();
await expect(page.getByRole("heading", { name: skillName, exact: true })).toBeVisible();
await expect(page.getByText(input.marker, { exact: true })).toBeVisible();
let step: StudioStep = "open_card";
try {
const { page, skillName } = input;
const card = page.getByRole("article", { name: `Skill created: ${skillName}`, exact: true });
await expect(card).toHaveCount(1);
await expect(card).toBeVisible();
await card.getByRole("button").click();
step = "read_preview";
await expect(page.getByRole("heading", { name: skillName, exact: true })).toBeVisible();
await expect(page.getByText("Verify checks.", { exact: true })).toBeVisible();
step = "open_studio";
await page.getByRole("button", { name: "Open in Skill Studio", exact: true }).click();
await expect(page).toHaveURL(new RegExp(`/skills/studio/${input.skillId}$`));
await expect(page.getByRole("combobox").filter({ hasText: skillName })).toBeVisible();
const editor = page.getByRole("textbox", { name: "editable markdown", exact: true });
// Studio mounts the editor before its file query completes. Wait for the
// saved body, otherwise hydration can replace edits made to the empty draft.
step = "load_file";
await expect(editor).toContainText("Verify checks.");
step = "edit_file";
await editor.click();
await editor.press("ControlOrMeta+End");
await editor.press("Enter");
await editor.press("Enter");
await editor.pressSequentially(input.marker);
step = "save_file";
await page.getByRole("button", { name: /^Save$/ }).click();
step = "verify_saved";
await expect.poll(async () => JSON.stringify(await input.read()).includes(input.marker),
{ timeout: Math.max(1, Math.min(30_000, input.deadlineAt - Date.now())) }).toBe(true);
step = "reload_file";
await page.reload();
await expect(editor).toContainText(input.marker);
step = "return_task";
await page.goBack();
await expect(page).toHaveURL(/\/issues\//);
step = "reopen_card";
await expect(card).toBeVisible();
await card.getByRole("button").click();
await expect(page.getByRole("heading", { name: skillName, exact: true })).toBeVisible();
await expect(page.getByText(input.marker, { exact: true })).toBeVisible();
} catch {
throw new SkillStudioFlowError(step);
}
}