Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions .agents/skills/verify-t3code/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,19 @@ screenshots.

Stable handles (verified against this head):

| What | Handle |
| --- | --- |
| Thread row | `[data-testid="sidebar-row-card"]` (slim: `sidebar-row-slim`); right-click opens its menu |
| Row menu items | text: `Pin thread`, `Settle thread`, `Snooze` > `In 1 hour`…, `Rename thread`, `Regenerate title`, `Mark unread`, `Filter by <project>`, `Copy`, `Project settings`, `Archive thread`, `Delete` |
| Pinned / unpin | `button[aria-label="Unpin thread"]` (or `[aria-label="Pinned"]` while dragging) |
| Settled / snoozed shelves | `[data-testid="sidebar-settled-shelf-toggle"]`, `[data-testid="sidebar-snoozed-shelf-toggle"]` |
| Wake | `[aria-label="Wake thread now"]` |
| Thread title in header | `button[aria-label^="Thread actions for"]` |
| New thread / new project | `[data-testid="new-thread-button"]` / `button[aria-label="New project"]` |
| Command palette | `Control+K`; `[data-testid="command-palette"]`, results are `[role="option"]` |
| Composer | `[data-testid="composer-editor"]`, button `Send message` |
| Settings | footer gear, then a button per section: General, Appearance, Keybindings, SnapShots, Providers, Integrations, Source Control, Storage, Connections, Archive, and Back |
| Terminal | `button[aria-label="Toggle terminal drawer"]` |
| What | Handle |
| ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Thread row | `[data-testid="sidebar-row-card"]` (slim: `sidebar-row-slim`); right-click opens its menu |
| Row menu items | text: `Pin thread`, `Settle thread`, `Snooze` > `In 1 hour`…, `Rename thread`, `Regenerate title`, `Mark unread`, `Filter by <project>`, `Copy`, `Project settings`, `Archive thread`, `Delete` |
| Pinned / unpin | `button[aria-label="Unpin thread"]` (or `[aria-label="Pinned"]` while dragging) |
| Settled / snoozed shelves | `[data-testid="sidebar-settled-shelf-toggle"]`, `[data-testid="sidebar-snoozed-shelf-toggle"]` |
| Wake | `[aria-label="Wake thread now"]` |
| Thread title in header | `button[aria-label^="Thread actions for"]` |
| New thread / new project | `[data-testid="new-thread-button"]` / `button[aria-label="New project"]` |
| Command palette | `Control+K`; `[data-testid="command-palette"]`, results are `[role="option"]` |
| Composer | `[data-testid="composer-editor"]`, button `Send message` |
| Settings | footer gear, then a button per section: General, Appearance, Keybindings, SnapShots, Providers, Integrations, Source Control, Storage, Connections, Archive, and Back |
| Terminal | `button[aria-label="Toggle terminal drawer"]` |

`getByRole(..., { name })` with a regex can stall for a minute on a saturated host; prefer
the CSS handles above and give clicks 45 s.
Expand Down
28 changes: 14 additions & 14 deletions .agents/skills/verify-t3code/features/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ Each feature file lists sub-features by stable ID. The ID is also the step name
drive scripts write to `$RUN/evidence/observed.log`, so an evidence line maps straight
to a sub-feature.

| ID | Feature | Primary proof |
| --- | --- | --- |
| onboarding | First-run setup wizard | `scripts/seed.mjs` |
| projects | Add and filter projects | `scripts/seed.mjs`, `scripts/drive-surfaces.mjs` (`projects.filter`) |
| composer | Model picker, send, agent reply | `scripts/seed.mjs` |
| threads | New, rename, mark unread, list | `scripts/drive-threads.mjs`, `scripts/drive-surfaces.mjs` (`threads.new`) |
| sidebar-lifecycle | Pin, settle, snooze, wake | `scripts/drive-threads.mjs` |
| archive | Archive, Archive page, unarchive | `scripts/drive-threads.mjs` (`archive.thread`), `scripts/drive-surfaces.mjs` |
| search | Command palette thread search | `scripts/drive-threads.mjs` (`search.snoozed`), `scripts/drive-surfaces.mjs` (`search.palette`) |
| terminal | Terminal drawer | `scripts/drive-surfaces.mjs` (`terminal.drawer`) |
| settings | Settings sections | `scripts/drive-surfaces.mjs` (`settings.<section>`) |
| connections | Environments and network access | `scripts/drive-surfaces.mjs` (`connections.page`) |
| usage | Usage page | `scripts/drive-surfaces.mjs` (`usage.page`) |
| pull-requests | Pull Requests page | `scripts/drive-surfaces.mjs` (`pull-requests.page`) |
| ID | Feature | Primary proof |
| ----------------- | -------------------------------- | ----------------------------------------------------------------------------------------------- |
| onboarding | First-run setup wizard | `scripts/seed.mjs` |
| projects | Add and filter projects | `scripts/seed.mjs`, `scripts/drive-surfaces.mjs` (`projects.filter`) |
| composer | Model picker, send, agent reply | `scripts/seed.mjs` |
| threads | New, rename, mark unread, list | `scripts/drive-threads.mjs`, `scripts/drive-surfaces.mjs` (`threads.new`) |
| sidebar-lifecycle | Pin, settle, snooze, wake | `scripts/drive-threads.mjs` |
| archive | Archive, Archive page, unarchive | `scripts/drive-threads.mjs` (`archive.thread`), `scripts/drive-surfaces.mjs` |
| search | Command palette thread search | `scripts/drive-threads.mjs` (`search.snoozed`), `scripts/drive-surfaces.mjs` (`search.palette`) |
| terminal | Terminal drawer | `scripts/drive-surfaces.mjs` (`terminal.drawer`) |
| settings | Settings sections | `scripts/drive-surfaces.mjs` (`settings.<section>`) |
| connections | Environments and network access | `scripts/drive-surfaces.mjs` (`connections.page`) |
| usage | Usage page | `scripts/drive-surfaces.mjs` (`usage.page`) |
| pull-requests | Pull Requests page | `scripts/drive-surfaces.mjs` (`pull-requests.page`) |

## Baseline preconditions

Expand Down
2 changes: 1 addition & 1 deletion .agents/skills/verify-t3code/features/pull-requests.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Preconditions: baseline from [README.md](README.md); the host's `gh` is logged i
read the loading skeleton). When it fails the page shows "Could not load pull requests" with the internal text "All fibers
interrupted without error" and a Retry button. Retry lists the PRs, and later visits in
the same instance list them at once. `drive-surfaces.mjs` records this as `FAIL
pull-requests.page`. Do not click Retry to make the step pass or wait it out. The
pull-requests.page`. Do not click Retry to make the step pass or wait it out. The
nullStack65/t3code repo has issues disabled, so the report lives here and in the PR that
added this file.

Expand Down
76 changes: 46 additions & 30 deletions .agents/skills/verify-t3code/scripts/browser.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,45 +13,49 @@
// ~/.cache/ms-playwright, with a throwaway profile under RUN_DIR. It never touches a
// person's browser profile. cleanup.sh kills the browser by the PID recorded in
// RUN_DIR/browser.env.
import { createRequire } from "node:module";
import { spawn } from "node:child_process";
import { createServer } from "node:net";
import { appendFileSync, existsSync, mkdirSync, openSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
import { join } from "node:path";
import { homedir } from "node:os";
import { fileURLToPath } from "node:url";
import * as NodeModule from "node:module";
import * as NodeChildProcess from "node:child_process";
import * as NodeNet from "node:net";
import * as NodeFS from "node:fs";
import * as NodePath from "node:path";
import * as NodeOS from "node:os";
import * as NodeURL from "node:url";

function readEnvFile(path) {
return Object.fromEntries(
readFileSync(path, "utf8")
NodeFS.readFileSync(path, "utf8")
.split("\n")
.filter((l) => l.includes("="))
.map((l) => [l.slice(0, l.indexOf("=")), l.slice(l.indexOf("=") + 1)]),
);
}

export const readInstance = (runDir) => readEnvFile(join(runDir, "instance.env"));
export const readInstance = (runDir) => readEnvFile(NodePath.join(runDir, "instance.env"));

function loadPlaywright(repo) {
const store = join(repo, "node_modules/.pnpm");
const dir = readdirSync(store).find((d) => d.startsWith("playwright-core@"));
const store = NodePath.join(repo, "node_modules/.pnpm");
const dir = NodeFS.readdirSync(store).find((d) => d.startsWith("playwright-core@"));
if (!dir) throw new Error("playwright-core not found in " + store);
return createRequire(join(store, dir, "node_modules/playwright-core/"))("playwright-core");
return NodeModule.createRequire(NodePath.join(store, dir, "node_modules/playwright-core/"))(
"playwright-core",
);
}

function chromiumPath() {
const root = join(homedir(), ".cache/ms-playwright");
const root = NodePath.join(NodeOS.homedir(), ".cache/ms-playwright");
// chromium-<revision> only: chromium_headless_shell-* and chromium-headless-shell-* have no chrome-linux64/chrome.
const dirs = readdirSync(root).filter((d) => /^chromium-\d+$/.test(d)).sort((a, b) => Number(a.slice(9)) - Number(b.slice(9)));
const dirs = NodeFS.readdirSync(root)
.filter((d) => /^chromium-\d+$/.test(d))
.sort((a, b) => Number(a.slice(9)) - Number(b.slice(9)));
if (!dirs.length) throw new Error("no chromium-<revision> in " + root);
const p = join(root, dirs.at(-1), "chrome-linux64/chrome");
if (!existsSync(p)) throw new Error("no Chromium at " + p);
const p = NodePath.join(root, dirs.at(-1), "chrome-linux64/chrome");
if (!NodeFS.existsSync(p)) throw new Error("no Chromium at " + p);
return p;
}

const freePort = () =>
new Promise((resolve, reject) => {
const s = createServer();
const s = NodeNet.createServer();
s.listen(0, "127.0.0.1", () => {
const { port } = s.address();
s.close(() => resolve(port));
Expand All @@ -62,10 +66,10 @@ const freePort = () =>
export async function up(runDir, { width = 1440, height = 900 } = {}) {
const inst = readInstance(runDir);
const port = await freePort();
const profile = join(runDir, "profile");
mkdirSync(profile, { recursive: true });
const log = openSync(join(runDir, "browser.log"), "a");
const child = spawn(
const profile = NodePath.join(runDir, "profile");
NodeFS.mkdirSync(profile, { recursive: true });
const log = NodeFS.openSync(NodePath.join(runDir, "browser.log"), "a");
const child = NodeChildProcess.spawn(
chromiumPath(),
[
"--headless=new",
Expand All @@ -84,7 +88,13 @@ export async function up(runDir, { width = 1440, height = 900 } = {}) {
{ detached: true, stdio: ["ignore", log, log] },
);
child.unref();
writeFileSync(join(runDir, "browser.env"), `BROWSER_PID=${child.pid}\nCDP_PORT=${port}\n`, { mode: 0o600 });
NodeFS.writeFileSync(
NodePath.join(runDir, "browser.env"),
`BROWSER_PID=${child.pid}\nCDP_PORT=${port}\n`,
{
mode: 0o600,
},
);
const t = await connect(runDir, { retries: 40 });
// Dev mode serves hundreds of modules, so "domcontentloaded" can exceed 30 s on a busy
// host. Return at "commit" and let callers wait for real UI.
Expand All @@ -95,7 +105,7 @@ export async function up(runDir, { width = 1440, height = 900 } = {}) {

export async function connect(runDir, { retries = 1 } = {}) {
const inst = readInstance(runDir);
const { CDP_PORT } = readEnvFile(join(runDir, "browser.env"));
const { CDP_PORT } = readEnvFile(NodePath.join(runDir, "browser.env"));
const { chromium } = loadPlaywright(inst.REPO);
let browser;
for (let i = 0; ; i++) {
Expand All @@ -110,23 +120,29 @@ export async function connect(runDir, { retries = 1 } = {}) {
const context = browser.contexts()[0];
const page = context.pages()[0] ?? (await context.newPage());
page.setDefaultTimeout(60000);
const evidence = join(runDir, "evidence");
mkdirSync(evidence, { recursive: true });
const evidence = NodePath.join(runDir, "evidence");
NodeFS.mkdirSync(evidence, { recursive: true });
const consoleErrors = [];
page.on("pageerror", (e) => consoleErrors.push(String(e)));
page.on("console", (m) => {
if (m.type() === "error") consoleErrors.push(m.text());
});
return {
page, context, inst, consoleErrors,
page,
context,
inst,
consoleErrors,
base: `http://localhost:${inst.WEB_PORT}`,
async shot(name) {
const path = join(evidence, `${name}.png`);
const path = NodePath.join(evidence, `${name}.png`);
// A saturated host can stall a screenshot; a missing image is reported, never fatal.
return page.screenshot({ path, timeout: 90000 }).then(() => path, (e) => `SCREENSHOT-FAILED ${name}: ${String(e).split("\n")[0]}`);
return page.screenshot({ path, timeout: 90000 }).then(
() => path,
(e) => `SCREENSHOT-FAILED ${name}: ${String(e).split("\n")[0]}`,
);
},
note(line) {
appendFileSync(join(evidence, "observed.log"), line + "\n");
NodeFS.appendFileSync(NodePath.join(evidence, "observed.log"), line + "\n");
},
// Drop this script's connection; the browser keeps running for the next script.
async detach() {
Expand All @@ -135,7 +151,7 @@ export async function connect(runDir, { retries = 1 } = {}) {
};
}

if (process.argv[1] === fileURLToPath(import.meta.url) && process.argv[2] === "up") {
if (process.argv[1] === NodeURL.fileURLToPath(import.meta.url) && process.argv[2] === "up") {
const r = await up(process.argv[3]);
console.log(`browser pid=${r.pid} cdp=127.0.0.1:${r.port}`);
process.exit(0);
Expand Down
Loading
Loading