mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-25 16:14:26 +01:00
fix(evals): keep raw diagnostics out of public history (#13850)
## Thinking Path > - Paperclip manages AI agents and their work. > - Product E2E campaigns retain evidence from live provider runs. > - The public publisher copied per-attempt files based on their extension. > - Credential redaction does not remove hidden reasoning or provider session IDs. > - This pull request keeps those raw diagnostics out of public evidence bundles. > - Public reports retain normalized grades and declared fixture screenshots. ## Linked Issues or Issue Description **What happened?** The Product history publisher accepted all JSON, log, Markdown, and text files under an attempt directory. API snapshots and process logs can contain provider reasoning even after credential redaction. **Expected behavior** Keep raw attempt diagnostics in retained Actions artifacts. Publish normalized results and declared fixture screenshots. Preserve the original grades and attempt evidence. **Steps to reproduce** Place a credential-redacted API snapshot with a reasoning event under an attempt's snapshots directory. The previous public path check admitted it because it ended in .json. ## What Changed - Remove extension-based admission for per-attempt text files in both S3 and Pages staging. - Require PNG paths to appear in the existing screenshot declaration allowlist. - Preserve root normalized results, grading, billing, provenance, and reviewed screenshot behavior. - Add seven denial cases for raw diagnostics, renamed files, malformed JSON, and false screenshot declarations. - Update report copy and the publication security contract. ## Verification - Focused history and report tests: 47 passed. - Replayed the filter against a copy of retained Grok evidence: six diagnostic files removed, one declared screenshot retained, zero provider calls. Original artifacts remain unchanged. - git diff --check passed. - Product typecheck in the reused local dependency tree reports an unrelated plugin type mismatch for organizationSwitcher in server/src/services/plugin-capability-validator.ts. CI will verify a fresh install. - No local browser or Docker execution. ## Risks Public reports no longer link raw per-attempt logs or API snapshots. Those files remain in the original Actions artifact. This change affects future publication only; it does not withdraw or rewrite existing immutable public campaigns. Normalized result content and marked screenshot review retain their existing boundaries. No workflow authorization, provider credentials, application behavior, or database changes. ## Model Used OpenAI Codex, GPT-6 family, with reasoning, code editing, and tool execution. The exact deployment model ID and context-window size are not exposed in this session. ## 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:
1 parent
ac854a9b59
commit
106d89314f
6 files changed
+58
-27
No files matched your search
@@ -197,8 +197,8 @@ latest pointers are mutable, and S3 versioning makes those updates recoverable.
|
||||
## Public evidence boundary
|
||||
|
||||
CloudFront and GitHub Pages are public. Fixture identifiers, timing, token
|
||||
usage, costs, normalized results, allowlisted inert structured per-attempt
|
||||
evidence, and trusted runner PNG screenshots are expected public data. Each
|
||||
usage, costs, normalized results, and trusted runner PNG screenshots are
|
||||
expected public data. Each
|
||||
public screenshot must carry the explicit `public-runner-fixture` marker in
|
||||
the normalized result. This includes a `failure.png` capture. Screenshot paths
|
||||
must be safe PNG basenames and must be tied to the exact normalized execution
|
||||
@@ -211,8 +211,10 @@ fixed catalog labels and sanitized numeric/status fields. Video, archives,
|
||||
generated Playwright/blob/HTML report trees, SVG or other active content,
|
||||
credentials, Paperclip homes, databases, workspaces, master keys,
|
||||
raw/unredacted logs, unmarked images, and unallowlisted files are not public.
|
||||
Allowlisted `.log` copies must pass the existing exact-value/key-shape scan and
|
||||
redaction boundary.
|
||||
Per-attempt JSON snapshots, result copies, logs, Markdown, and text files stay
|
||||
in the retained Actions artifact. Credential redaction does not remove hidden
|
||||
reasoning or provider session identities, so a text extension never admits a
|
||||
file to the public bundle. Graded results remain in `normalized-results.json`.
|
||||
|
||||
The packaged evidence uploaded as a 30-day GitHub Actions artifact has a
|
||||
different, broader boundary. Text is exact-value and key-shape scanned and
|
||||
@@ -225,8 +227,9 @@ capture requires review of the visible page state. Videos remain
|
||||
access-controlled.
|
||||
|
||||
Before permanent publication, the campaign publisher creates a separate S3
|
||||
stage and retains only allowlisted `.json`, `.log`, `.md`, and `.txt` evidence,
|
||||
result PNGs with the explicit `public-runner-fixture` marker.
|
||||
stage and retains only result PNGs with the explicit `public-runner-fixture`
|
||||
marker under `evidence/`. This applies even to malformed JSON and renamed
|
||||
process logs. Original packaged evidence and grades remain unchanged.
|
||||
It then launches publisher-only Chromium with networking blocked to render one
|
||||
`public-images/campaign-summary.png`. That fixed-path PNG is capped at 12 MiB
|
||||
and its signature is validated. Per-attempt XML is excluded because browsers
|
||||
|
||||
@@ -1104,7 +1104,7 @@ export function renderRunnerE2EDashboard(input: RunnerDashboardInput) {
|
||||
<div>
|
||||
<p class="eyebrow">Full-stack acceptance campaign</p>
|
||||
<h1>${html(input.title)}</h1>
|
||||
<p class="lede">A browser-verified matrix of runner profiles, execution environments, and deterministic task contracts. Declared PNG screenshots and sanitized structured evidence are retained with every published campaign; additional diagnostic evidence remains in the access-controlled workflow artifact.</p>
|
||||
<p class="lede">A browser-verified matrix of runner profiles, execution environments, and deterministic task contracts. Declared PNG screenshots and normalized results are retained with every published campaign; additional diagnostic evidence remains in the access-controlled workflow artifact.</p>
|
||||
</div>
|
||||
<div class="report-actions">
|
||||
<div class="summary" aria-label="Campaign summary">
|
||||
@@ -1145,7 +1145,7 @@ export function renderRunnerE2EDashboard(input: RunnerDashboardInput) {
|
||||
</section>
|
||||
${suiteSections}
|
||||
${historySection}
|
||||
<footer><span>Generated ${html(input.generatedAt)}</span><span>${catalog.length} catalog executions · Declared screenshots and sanitized structured evidence published</span></footer>
|
||||
<footer><span>Generated ${html(input.generatedAt)}</span><span>${catalog.length} catalog executions · Declared screenshots and normalized results published</span></footer>
|
||||
</main>
|
||||
<dialog class="gallery-dialog" data-gallery-dialog aria-labelledby="gallery-title">
|
||||
<div class="gallery-shell">
|
||||
|
||||
@@ -218,7 +218,7 @@ export function renderRunnerHistoryIndex(
|
||||
<div>
|
||||
<p class="eyebrow">Historical test reporting</p>
|
||||
<h1>Runner E2E campaigns</h1>
|
||||
<p class="lede">Each row is one workflow campaign against a Paperclip revision. Open a report for its configuration matrices, matchers, per-test billing, declared screenshots, and sanitized structured evidence. Additional diagnostic evidence remains in access-controlled workflow artifacts.</p>
|
||||
<p class="lede">Each row is one workflow campaign against a Paperclip revision. Open a report for its configuration matrices, matchers, per-test billing, declared screenshots, and normalized results. Additional diagnostic evidence remains in access-controlled workflow artifacts.</p>
|
||||
</div>
|
||||
<div class="summary" aria-label="History summary">
|
||||
<div class="metric"><strong>${campaigns.length}</strong><span>Campaigns</span></div>
|
||||
@@ -237,7 +237,7 @@ export function renderRunnerHistoryIndex(
|
||||
<tbody>${rows}</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<footer><span>Updated ${html(date(history.updatedAt))} UTC</span><span>Immutable campaign reports · Declared screenshots and inert structured evidence</span></footer>
|
||||
<footer><span>Updated ${html(date(history.updatedAt))} UTC</span><span>Immutable campaign reports · Declared screenshots and normalized results</span></footer>
|
||||
</main>
|
||||
</body>
|
||||
</html>`;
|
||||
|
||||
@@ -43,7 +43,6 @@ const PUBLISH_ROOT_FILES = new Set([
|
||||
"normalized-results.json",
|
||||
"summary.md",
|
||||
]);
|
||||
const PUBLIC_EVIDENCE_EXTENSIONS = new Set([".json", ".log", ".md", ".txt"]);
|
||||
const MAX_PUBLIC_RASTER_BYTES = 12 * 1024 * 1024;
|
||||
const EMPTY_PUBLIC_SCREENSHOTS: ReadonlySet<string> = new Set();
|
||||
const PRIVATE_EVIDENCE_DIRECTORIES = new Set([
|
||||
@@ -73,10 +72,13 @@ function publicEvidencePath(
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
// A text extension and credential scan do not establish a public projection.
|
||||
// API snapshots and process logs can still hold hidden reasoning and provider
|
||||
// session identities. Keep those diagnostics in the retained Actions artifact;
|
||||
// normalized-results.json already carries the graded result contract.
|
||||
return (
|
||||
PUBLIC_EVIDENCE_EXTENSIONS.has(
|
||||
path.posix.extname(evidencePath).toLowerCase(),
|
||||
) || publicScreenshots.has(relative)
|
||||
path.posix.extname(evidencePath).toLowerCase() === ".png" &&
|
||||
publicScreenshots.has(relative)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -546,8 +548,8 @@ async function main() {
|
||||
// file left in a reused local directory. The root landing page below is the
|
||||
// only dashboard that embeds navigation across campaigns. S3 gets its own
|
||||
// staged copy. Only screenshots declared by normalized results (plus the
|
||||
// fixed failure screenshot for failed executions) cross the public boundary;
|
||||
// all other target-produced files remain subject to the structured allowlist.
|
||||
// fixed failure screenshot for failed executions) cross the public evidence
|
||||
// boundary. Raw per-attempt text stays in the retained Actions artifact.
|
||||
const s3ReportRoot = path.join(temporary, "s3-campaign");
|
||||
await cp(reportRoot, s3ReportRoot, { recursive: true, errorOnExist: true });
|
||||
await prunePrivateHistoryEvidence(s3ReportRoot, publicScreenshots);
|
||||
|
||||
@@ -249,10 +249,10 @@ describe("runner E2E campaign history", () => {
|
||||
"campaigns/complete-red/public-images/campaign-summary.png",
|
||||
);
|
||||
expect(index).toContain(
|
||||
"declared screenshots, and sanitized structured evidence",
|
||||
"declared screenshots, and normalized results",
|
||||
);
|
||||
expect(index).toContain(
|
||||
"Declared screenshots and inert structured evidence",
|
||||
"Declared screenshots and normalized results",
|
||||
);
|
||||
expect(index).not.toContain("data-gallery-dialog");
|
||||
expect(index).not.toContain("Configuration matrix");
|
||||
@@ -260,6 +260,32 @@ describe("runner E2E campaign history", () => {
|
||||
});
|
||||
|
||||
describe("historical publication security", () => {
|
||||
it.each([
|
||||
"snapshots/api-state.json", "server.log", "playwright.log", "result.json",
|
||||
"renamed-diagnostic.md", "nested/provider.txt", "malformed.json",
|
||||
])("withholds raw diagnostic %s even after credential redaction", async (file) => {
|
||||
const root = await mkdtemp(path.join(os.tmpdir(), "runner-private-evidence-"));
|
||||
temporaryDirectories.push(root);
|
||||
const relative = `evidence/fixture.local.case/attempt-1/${file}`;
|
||||
const absolute = path.join(root, relative);
|
||||
const text = file === "malformed.json" ? "{malformed PRIVATE_REASONING" : JSON.stringify({
|
||||
apiKey: "[REDACTED]",
|
||||
runEvents: [{ payload: { prpEvent: { payload: {
|
||||
kind: "reasoning", text: "PRIVATE_REASONING", sessionId: "PRIVATE_SESSION",
|
||||
} } } }],
|
||||
runLogs: [{ log: { content: JSON.stringify({ reasoning: "PRIVATE_REASONING" }) } }],
|
||||
});
|
||||
await mkdir(path.dirname(absolute), { recursive: true });
|
||||
await writeFile(absolute, text);
|
||||
expect(isHistoricalBundlePathAllowed(relative)).toBe(false);
|
||||
// A text file cannot be admitted by pretending it is a declared screenshot.
|
||||
expect(isHistoricalBundlePathAllowed(relative, false, new Set([relative]))).toBe(false);
|
||||
await expect(createBundleManifest(root, "private-diagnostics")).rejects.toThrow("non-allowlisted");
|
||||
await prunePrivateHistoryEvidence(root);
|
||||
await expect(readFile(absolute)).rejects.toThrow();
|
||||
expect((await createBundleManifest(root, "private-diagnostics")).files).toEqual([]);
|
||||
});
|
||||
|
||||
it("allows public capture only on an issue task route", () => {
|
||||
const target = {
|
||||
issuePrefix: "PAP",
|
||||
@@ -379,10 +405,10 @@ describe("historical publication security", () => {
|
||||
);
|
||||
expect(dashboard).toContain("View gallery · 1");
|
||||
expect(dashboard).toContain(
|
||||
"Declared PNG screenshots and sanitized structured evidence are retained with every published campaign",
|
||||
"Declared PNG screenshots and normalized results are retained with every published campaign",
|
||||
);
|
||||
expect(dashboard).toContain(
|
||||
"Declared screenshots and sanitized structured evidence published",
|
||||
"Declared screenshots and normalized results published",
|
||||
);
|
||||
await expect(
|
||||
readFile(path.join(evidenceDirectory, "final-state.png")),
|
||||
@@ -404,13 +430,13 @@ describe("historical publication security", () => {
|
||||
).rejects.toThrow();
|
||||
await expect(
|
||||
readFile(path.join(evidenceDirectory, "result.json"), "utf8"),
|
||||
).resolves.toBe("{}\n");
|
||||
).rejects.toThrow();
|
||||
await expect(
|
||||
readFile(
|
||||
path.join(evidenceDirectory, "snapshots", "api-state.json"),
|
||||
"utf8",
|
||||
),
|
||||
).resolves.toBe("{}\n");
|
||||
).rejects.toThrow();
|
||||
expect(
|
||||
JSON.parse(
|
||||
await readFile(path.join(output, "normalized-results.json"), "utf8"),
|
||||
@@ -484,7 +510,7 @@ describe("historical publication security", () => {
|
||||
}
|
||||
await expect(
|
||||
readFile(path.join(evidenceDirectory, "server.log"), "utf8"),
|
||||
).resolves.toBe("sanitized\n");
|
||||
).rejects.toThrow();
|
||||
const summaryHtml = renderPublicCampaignSummary(campaign);
|
||||
expect(summaryHtml).toContain(execution.suite.label);
|
||||
expect(summaryHtml).not.toContain("PROVIDER_TEXT_MUST_NOT_RENDER");
|
||||
@@ -747,12 +773,12 @@ describe("historical publication security", () => {
|
||||
isHistoricalBundlePathAllowed(
|
||||
"evidence/core-compatibility.profile.local.case/attempt-1/result.json",
|
||||
),
|
||||
).toBe(true);
|
||||
).toBe(false);
|
||||
expect(
|
||||
isHistoricalBundlePathAllowed(
|
||||
"evidence/core-compatibility.profile.local.case/attempt-1/snapshots/api-state.json",
|
||||
),
|
||||
).toBe(true);
|
||||
).toBe(false);
|
||||
expect(isHistoricalBundlePathAllowed("paperclip-home/database")).toBe(
|
||||
false,
|
||||
);
|
||||
|
||||
@@ -245,10 +245,10 @@ describe("runner E2E report aggregation", () => {
|
||||
expect(dashboard).toContain("data-gallery-next");
|
||||
expect(dashboard).toContain("View gallery · 1");
|
||||
expect(dashboard).toContain(
|
||||
"Declared PNG screenshots and sanitized structured evidence are retained with every published campaign",
|
||||
"Declared PNG screenshots and normalized results are retained with every published campaign",
|
||||
);
|
||||
expect(dashboard).toContain(
|
||||
"Declared screenshots and sanitized structured evidence published",
|
||||
"Declared screenshots and normalized results published",
|
||||
);
|
||||
expect(dashboard).toContain("message_contains");
|
||||
expect(dashboard).toContain("Matchers and test context");
|
||||
|
||||
Reference in new issue
Block a user