mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-13 15:55:46 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The chat-feature evals measure whether agents complete real chat requests through the product > - The chat catalog eval harness and its repairs live on the `chat-eval/master-candidate` branch, not on master > - Today's work made 139 of 242 chat evals pass in verified single-case live runs. Each product fix landed on master as its own pull request > - The eval-side changes (setups, graders, fault seams, evidence capture) still exist only on the candidate > - This pull request lands the harness on master. Master stays the source of truth for product behavior > - The benefit is one tree: evals run against master commits, and product fixes reach the evals as soon as they merge ## Linked Issues or Issue Description Refs #19441, Refs #19599, Refs #20270, Refs #20334, Refs #20342, Refs #20344, Refs #20354, Refs #20360, Refs #20373, Refs #20382, Refs #20409 **What existing behavior does this improve?** The chat catalog eval harness and the product it evaluates live on a long-running branch outside master. Eval fixes do not reach master, so master-based eval runs use old setups and graders. **Subsystem affected** `tests/runner-e2e` chat catalog harness, plus a small set of product changes that exist only on the candidate. **Proposed change** Land the harness on master. Every product fix from this eval work already merged to master as its own pull request. Conflicts keep master's product behavior. ## What Changed - Most of the diff (808 of 851 files) is under `tests/runner-e2e/`: chat-catalog domains, scenarios, descriptors, the TestOps manifest, private evidence tooling, and their tests. - Graders now check saved state, setup literals and rendered or clicked links. Many keyword and regex checks on free-form replies are removed. Each changed grader has a bumped `oracleVersion` and calibration tests (a valid reply, a reworded valid reply, and broken variants that must fail). - The shared link helper `hasLink` no longer treats a list link (for example `/COM/issues?view=mine`) as a link to every task without a URL key. - Setup fixes build real state through supported product routes: routine history, agent grants through the board grant route, budget holds with a real cap, and a storage-layer archive fault for `inbox-search.archive-partial-failure`. - Browser boundary journeys (sign-in, chat-disabled, onboarding) now write the standard pass evidence files. - Retargeted cases, approved by the maintainer: `agent-chat.chat-disabled` (Conference Room gate), `agents.restore-instructions` (no saved instruction history), `access.manage-membership` (member permission edits stay board-only). - The private evidence trusted files (`manual-private-handoff.ts`, `manual-private-retention.ts`, `manual-private-report-assets.ts`) are byte-identical to master. - Product files outside `tests/` (43 files, +1,328 −49) carry candidate-only changes that master does not yet have. Most are tests. The main code changes are in `request-human-input.ts`, `heartbeat-run-summary.ts`, `native-completion-feedback.ts`, `native-run-finalizer.ts`, `openapi.ts`, `secrets.ts` and `IssueChatLongThreadPerf.tsx`. ## Verification - `pnpm vitest run chat-catalog-domains chat-catalog-contract.test.ts chat-catalog-consistency.test.ts unit-launcher.test.mjs --testTimeout=180000` in `tests/runner-e2e`: 269 files pass, 3,550 tests pass. - `node --test chat-full-catalog-testops-manifest.test.mjs`: 10 pass. - `node tests/runner-e2e/source-sdk-public-inputs.mjs <HEAD> --check`: no change. - `tsc` for `server` and `tests/runner-e2e`: clean. - Live single-case verification: 139 of 242 cases passed on paid runs, and a person read the saved evidence for each. These are single-case runs, not one full-cohort run. ## Risks - Large diff. Most of it is test-only, but the 43 non-test files change product code paths. Review those files first. - Some graders are now less strict on reply wording. A person must read replies for meaning on those cases. - 42 cases need disposable outside accounts (Notion, Slack, GitHub, Daytona and others) and stay blocked. `access.invite-teammate` stays failing until local agent isolation lands, because the runner's durable state keeps a live invite token. - The paid workflow compares the trusted private-evidence files with master. They are unchanged, so this risk is low. ## Model Used Anthropic Claude Opus 5.5 (`claude-opus-5-5`), with tool use and code execution, in Claude Code. Subagents used the same model. ## 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 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Paperclip <noreply@paperclip.ing>
146 lines
13 KiB
TypeScript
146 lines
13 KiB
TypeScript
import { mkdtemp, mkdir, readFile, rm, symlink, writeFile } from "node:fs/promises";
|
|
import os from "node:os";
|
|
import path from "node:path";
|
|
import { expect, it } from "vitest";
|
|
import { appendPrivateAttemptDiagnostic, privateAttemptDiagnostic, readPrivateAttemptObservation } from "./private-attempt-diagnostic.js";
|
|
import { canonicalProviderEventsFromOpenCodePart } from "../../packages/paperclip-runner/src/provider-events.js";
|
|
it("projects only fixed outcomes from private result, run and carrier evidence", () => {
|
|
const diagnostic = privateAttemptDiagnostic({ stage: "seal-original", result: { status: "failed", error: "Actual new native task reads inherited project context: private-value", runIds: ["private-id"] },
|
|
error: new Error("Credential-contaminated original evidence cannot be retained"), evidence: { leaks: [{ file: "private-path", reason: "zip inspection exceeded its expanded-byte bound" }] },
|
|
observation: { observation: { leadId: "lead", state: { futureWorker: { id: "future" }, activeRunId: "held" }, runs: [{ agentId: "lead", status: "succeeded" }, { agentId: "future", status: "running" }, { id: "held", status: "timed_out" }], reply: "private-value" } } });
|
|
expect(diagnostic).toMatchObject({ finalization: "credential-contamination", phase: "future-work-timeout", runs: 3, source: "succeeded", future: "running", held: "timed_out", carrier: "zip-byte-bound", runStatusCounts: expect.objectContaining({ succeeded: 1, running: 1, timed_out: 1 }) });
|
|
expect(JSON.stringify(diagnostic)).not.toMatch(/private-value|private-id|private-path/);
|
|
});
|
|
it("never copies unknown error, stage, failure or status text", () => {
|
|
expect(JSON.stringify(privateAttemptDiagnostic({ stage: "private-value", result: { status: "private-value", failureClass: "private-value", error: "private-value" }, error: new Error("private-value") }))).not.toContain("private-value");
|
|
});
|
|
it("counts a finish from the actual OpenCode event producer and recovers the pre-scan phase", () => {
|
|
const sourceEvents = ["pending", "running"].flatMap(status => canonicalProviderEventsFromOpenCodePart({ id: "private-call", type: "tool", tool: "paperclip_paperclip_finish", state: { status, input: {} } }));
|
|
const diagnostic = privateAttemptDiagnostic({ stage: "package-original", result: { error: "Secret leak in persisted Paperclip home state at private-path" },
|
|
observation: { sourceEvents, persistedState: { scanError: "private-error", originalResult: { error: "Canonical project-defaults turn settles: private-value" } } } });
|
|
expect(diagnostic).toMatchObject({ phase: "canonical-turn-timeout", privacy: { persistedState: true }, sourceProgress: { tools: { paperclip_finish: { started: 1, progressed: 1, completed: 0 }, other: { started: 0, completed: 0 } } } });
|
|
expect(JSON.stringify(diagnostic)).not.toMatch(/private-(?:call|path|error|value)/);
|
|
});
|
|
it("distinguishes an unfinished source tool and preserves a timeout hidden by privacy finalization", async () => {
|
|
const root = await mkdtemp(path.join(os.tmpdir(), "closed-eval-progress-"));
|
|
try {
|
|
const snapshots = path.join(root, "snapshots"); await mkdir(snapshots);
|
|
await writeFile(path.join(snapshots, "chat-catalog-observation.json"), JSON.stringify({ observation: { leadId: "private-lead", runs: [{ id: "private-run", agentId: "private-lead", status: "running" }] } }));
|
|
await writeFile(path.join(snapshots, "chat-catalog-runs.json"), JSON.stringify([
|
|
{ runId: "private-other", events: [{ eventType: "run.result.proposed" }] },
|
|
{ runId: "private-run", events: [
|
|
{ payload: { prpEvent: { eventType: "turn.started" } } },
|
|
{ payload: { prpEvent: { eventType: "tool.execution.started", payload: { name: "paperclip_call_api", output: "private-value" } } } },
|
|
{ payload: { prpEvent: { eventType: "tool.execution.started", payload: { name: "private-tool" } } } },
|
|
{ payload: { prpEvent: { eventType: "tool.execution.completed", payload: { name: "private-tool" } } } },
|
|
] },
|
|
]));
|
|
await writeFile(path.join(snapshots, "diagnostic-privacy.json"), JSON.stringify({ originalResult: { error: "Canonical project-defaults turn settles: private-value" }, issues: [{ file: "private-path" }] }));
|
|
const diagnostic = privateAttemptDiagnostic({ stage: "package-original", result: { failureClass: "secret_leak" },
|
|
error: new Error("Secret leak in snapshots/private.json: exact secret value"), observation: await readPrivateAttemptObservation(root) });
|
|
expect(diagnostic).toMatchObject({ phase: "canonical-turn-timeout", finalization: "text-secret-finding", privacy: { reporter: 1, packaging: "snapshot" },
|
|
sourceProgress: { events: 4, turns: 1, finishProposals: 0, tools: { paperclip_call_api: { started: 1, completed: 0 }, other: { started: 1, completed: 1 } } } });
|
|
expect(JSON.stringify(diagnostic)).not.toMatch(/private-(?:lead|run|value|path|tool|other)/);
|
|
await rm(path.join(snapshots, "chat-catalog-runs.json"));
|
|
const external = path.join(root, "outside.json"); await writeFile(external, JSON.stringify([{ runId: "private-run", events: [{ eventType: "run.result.proposed" }] }]));
|
|
await symlink(external, path.join(snapshots, "chat-catalog-runs.json"));
|
|
expect(privateAttemptDiagnostic({ stage: "execution", observation: await readPrivateAttemptObservation(root) }).sourceProgress.events).toBe(0);
|
|
} finally { await rm(root, { recursive: true, force: true }); }
|
|
});
|
|
it("reports recognized tool and API outcomes without copying arbitrary operation names", () => {
|
|
const diagnostic = privateAttemptDiagnostic({ stage: "package-original", error: new Error("Private cell evidence exceeds byte allowance"),
|
|
observation: { privacy: { issues: [{ reason: "zip inspection exceeded its expanded-byte bound" }] }, sourceEvents: [
|
|
{ eventType: "tool.execution.completed", payload: { name: "paperclip_search_api", status: "completed" } },
|
|
{ eventType: "item.completed", payload: { kind: "dynamicToolCall", item: { result: { apiOperationId: "PATCH /api/projects/{id}", status: 403, ok: false, body: "private-value" } } } },
|
|
{ eventType: "item.completed", payload: { kind: "dynamicToolCall", item: { result: { apiOperationId: "private-operation", status: 200, ok: true } } } },
|
|
] } });
|
|
expect(diagnostic).toMatchObject({ finalization: "byte-bound", privacy: { reporterReasons: { "zip inspection exceeded its expanded-byte bound": 1 } },
|
|
sourceProgress: { tools: { paperclip_search_api: { completed: 1 } }, lastTools: [{ name: "paperclip_search_api", phase: "completed", status: "completed" }],
|
|
apiResults: [{ operation: "update-project", status: 403, ok: false }, { operation: "other", status: 200, ok: true }] } });
|
|
expect(JSON.stringify(diagnostic)).not.toMatch(/private-(?:value|operation)/);
|
|
});
|
|
it("writes one closed variable to the actual owned runner environment file and rejects symlinks", async () => {
|
|
const root = await mkdtemp(path.join(os.tmpdir(), "closed-eval-diagnostic-"));
|
|
try {
|
|
const commands = path.join(root, "_runner_file_commands"); await mkdir(commands); const file = path.join(commands, "set_env_test"); await writeFile(file, "");
|
|
const env = { GITHUB_ACTIONS: "true", RUNNER_TEMP: root, GITHUB_ENV: file };
|
|
await appendPrivateAttemptDiagnostic({ stage: "execution", error: new Error("private-value") }, env);
|
|
const text = await readFile(file, "utf8"); expect(text).toMatch(/^PAPERCLIP_E2E_CLOSED_DIAGNOSTIC_V1=\{/); expect(text).not.toContain("private-value"); expect(text.trim().split("\n")).toHaveLength(1);
|
|
await symlink(file, path.join(commands, "set_env_symlink"));
|
|
await expect(appendPrivateAttemptDiagnostic({ stage: "execution" }, { ...env, GITHUB_ENV: path.join(commands, "set_env_symlink") })).rejects.toThrow();
|
|
} finally { await rm(root, { recursive: true, force: true }); }
|
|
});
|
|
|
|
it("classifies existing reporter and packaging carriers without exposing private filenames", () => {
|
|
const reason = "zip inspection exceeded its expanded-byte bound";
|
|
const issues = [
|
|
{ file: "blob-report/report.zip", reason },
|
|
{ file: "playwright-output/private-test/trace.zip", reason },
|
|
{ file: "html-report/data/private-hash.zip", reason },
|
|
{ file: "html-report/index.html", reason: "zip inspection exceeded its time bound" },
|
|
{ file: "snapshots/private-path.json", reason: "exact secret value" },
|
|
{ file: "private-path", reason: "private-reason" },
|
|
];
|
|
const diagnostic = privateAttemptDiagnostic({ stage: "package-original", observation: { privacy: { issues } },
|
|
evidence: { leaks: [{ file: "playwright-output\\private-test\\trace.zip", reason }, { file: "private-path", reason }] } });
|
|
expect(diagnostic.carrierReasons).toEqual([
|
|
{ source: "reporter", carrier: "blob-zip", reason, count: 1 },
|
|
{ source: "reporter", carrier: "playwright-trace-zip", reason, count: 1 },
|
|
{ source: "reporter", carrier: "html-trace-zip", reason, count: 1 },
|
|
{ source: "reporter", carrier: "embedded-html", reason: "zip inspection exceeded its time bound", count: 1 },
|
|
{ source: "reporter", carrier: "other", reason: "exact secret value", count: 1 },
|
|
{ source: "packaging", carrier: "playwright-trace-zip", reason, count: 1 },
|
|
{ source: "packaging", carrier: "other", reason, count: 1 },
|
|
]);
|
|
expect(JSON.stringify(diagnostic)).not.toMatch(/private-(?:test|hash|path|reason)/);
|
|
});
|
|
|
|
|
|
it("reports fixed embedded HTML and reporter text bounds while excluding unknown reasons", () => {
|
|
const diagnostic = privateAttemptDiagnostic({ stage: "package-original", observation: { privacy: { issues: [
|
|
{ file: "html-report/index.html", reason: "embedded report exceeded its byte bound" },
|
|
{ file: "html-report/index.html", reason: "reporter text exceeds inspection bound" },
|
|
{ file: "html-report/index.html", reason: "zip could not be inspected: private-error" },
|
|
] } } });
|
|
expect(diagnostic.carrierReasons).toEqual([
|
|
{ source: "reporter", carrier: "embedded-html", reason: "embedded report exceeded its byte bound", count: 1 },
|
|
{ source: "reporter", carrier: "embedded-html", reason: "reporter text exceeds inspection bound", count: 1 },
|
|
]);
|
|
expect(JSON.stringify(diagnostic)).not.toMatch(/private-error|html-report/);
|
|
});
|
|
|
|
|
|
it("retains each remaining fixed scanner reason without dynamic text", () => {
|
|
const reasons = ["embedded report encoding could not be inspected", "reporter symlink cannot be inspected",
|
|
"credential in reporter filename", "reporter JSON could not be safely parsed"];
|
|
const diagnostic = privateAttemptDiagnostic({ stage: "package-original", observation: { privacy: { issues: [
|
|
...reasons.map(reason => ({ file: "html-report/index.html", reason })),
|
|
{ file: "private-filename", reason: "zip could not be inspected: private-error" },
|
|
] } } });
|
|
expect(diagnostic.carrierReasons).toEqual(reasons.map(reason => ({ source: "reporter", carrier: "embedded-html", reason, count: 1 })));
|
|
expect(JSON.stringify(diagnostic)).not.toMatch(/private-filename|private-error|html-report/);
|
|
});
|
|
|
|
import { readFileSync } from "node:fs";
|
|
it("gives every fixed packaging, sealing and report-asset refusal a closed finalization code", () => {
|
|
const messages = ["manual-private-handoff.ts", "evidence.ts", "manual-private-report-assets.ts", "private-framework-report.ts", "redaction.ts", "manual-private-retention.ts", "chat-readiness-detail.ts", "source-sdk-evidence.ts", "private-diagnostics.ts", "source-sdk-public-type.ts"].flatMap(file =>
|
|
[...readFileSync(new URL(`./${file}`, import.meta.url), "utf8").matchAll(/(?:new Error|budgetFailure)\("([^"$`]+)"/g)].map(match => match[1]!));
|
|
expect(messages.length).toBeGreaterThan(20);
|
|
for (const message of messages) {
|
|
const diagnostic = privateAttemptDiagnostic({ stage: "seal-original", error: new Error(message) });
|
|
expect(diagnostic.finalization, message).not.toBe("unclassified");
|
|
}
|
|
});
|
|
it("names other filesystem refusals by their closed error code", () => {
|
|
const error = Object.assign(new Error("EEXIST: file already exists, open '/private/path'"), { code: "EEXIST" });
|
|
expect(privateAttemptDiagnostic({ stage: "seal-original", error }).finalization).toBe("fs-EEXIST");
|
|
expect(JSON.stringify(privateAttemptDiagnostic({ stage: "seal-original", error }))).not.toContain("/private/path");
|
|
});
|
|
it("names Node error codes, error types and non-error throws without their messages", () => {
|
|
const node = Object.assign(new Error("File size (3) is greater than 2 GiB: /private/x"), { code: "ERR_FS_FILE_TOO_LARGE" });
|
|
expect(privateAttemptDiagnostic({ stage: "attach-original", error: node }).finalization).toBe("fs-ERR_FS_FILE_TOO_LARGE");
|
|
expect(privateAttemptDiagnostic({ stage: "attach-original", error: new TypeError("x of /private/y") }).finalization).toBe("error-type-TypeError");
|
|
expect(privateAttemptDiagnostic({ stage: "attach-original", error: "raw /private/z" }).finalization).toBe("non-error-thrown");
|
|
expect(JSON.stringify(privateAttemptDiagnostic({ stage: "attach-original", error: node }))).not.toContain("/private/");
|
|
});
|