Files
PaperClipAI/scripts/screenshot-subissues.mjs
T
Harold KimandPaperclip 98df214917 fix: fail closed on unusable Codex auth during sandbox auth merge
When reusing a Codex sandbox, the workspace-restore step now performs
an auth-merge check before adopting the sandbox's auth.json. The merge
fails closed when:

- host or sandbox Codex auth is unusable (missing token or account)
- the subscription payload shapes differ between host and sandbox
- subscription account identities do not match

Additional hardening: node absence on PATH during the embedded decision
script now exits non-zero instead of silently falling through. Co-change
comments link parseAuth (the embedded script) to hasUsableAuthPayload
(codex-home.ts) so a future auth-format change cannot silently diverge
between the two implementations.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-07-09 10:08:57 +00:00

36 lines
1.3 KiB
JavaScript

import { chromium } from "@playwright/test";
import { mkdir } from "node:fs/promises";
import { argv } from "node:process";
const outDir = argv[2] ?? "/tmp/paperclip/pap-2189-subissues-screens";
const baseUrl = argv[3] ?? "http://localhost:6006";
await mkdir(outDir, { recursive: true });
const id = "ux-labs-sub-issues-workflow-checklist--default";
const runs = [
{ name: "desktop-1440x900-dark", w: 1440, h: 900, theme: "dark" },
{ name: "desktop-1440x900-light", w: 1440, h: 900, theme: "light" },
{ name: "mobile-390x844-dark", w: 390, h: 844, theme: "dark" },
{ name: "mobile-390x844-light", w: 390, h: 844, theme: "light" },
];
const browser = await chromium.launch();
try {
for (const run of runs) {
const url = `${baseUrl}/iframe.html?id=${id}&viewMode=story&globals=theme:${run.theme}`;
const context = await browser.newContext({
viewport: { width: run.w, height: run.h },
deviceScaleFactor: 2,
});
const page = await context.newPage();
await page.goto(url, { waitUntil: "networkidle", timeout: 30_000 });
await page.waitForTimeout(1200);
const file = `${outDir}/${run.name}.png`;
await page.screenshot({ path: file, fullPage: true });
console.log("wrote", file);
await context.close();
}
} finally {
await browser.close();
}