mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-01 18:07:00 +01:00
Merge origin/master and preserve task workspace preparation
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
commit
3cfe5d58df
9 files changed
+1472
-928
No files matched your search
@@ -205,6 +205,9 @@ for (const adapter of ["process", "paperclip_runner"] as const) {
|
||||
"-e",
|
||||
"console.log('stop fixture ready'); setInterval(() => console.log('working'), 200);",
|
||||
],
|
||||
// The child only runs this script; server-only fixture
|
||||
// loaders must not follow NODE_OPTIONS into the adapter.
|
||||
env: { NODE_OPTIONS: "" },
|
||||
graceSec: 1,
|
||||
}
|
||||
: { provider: "codex", model: "gpt-5.1-codex-mini" },
|
||||
|
||||
@@ -9,14 +9,13 @@ timeout only when the test explicitly arms a marker inside its repository.
|
||||
From a development worktree, start the foreground instance:
|
||||
|
||||
```sh
|
||||
BOOTSTRAP_FIXTURE_KEY=not-a-provider-key \
|
||||
PATH="$PWD/tests/e2e/workspace-bootstrap/bin:$PATH" \
|
||||
NODE_ENV=test \
|
||||
node cli/node_modules/tsx/dist/cli.mjs cli/src/index.ts test-drive \
|
||||
--harness codex --api-key-env BOOTSTRAP_FIXTURE_KEY \
|
||||
--company-name 'Workspace Recovery QA' --no-browser
|
||||
node cli/node_modules/tsx/dist/cli.mjs tests/e2e/workspace-bootstrap/launch.ts
|
||||
```
|
||||
|
||||
The launcher creates an isolated test-drive, installs the Git shim, and sets a
|
||||
10-second snapshot deadline after test-drive clears inherited configuration.
|
||||
Production's longer snapshot deadline would outlast the injected failure.
|
||||
|
||||
Set `BOOTSTRAP_REAL_GIT` to the absolute Git executable if it is not
|
||||
`/usr/bin/git`. Do not point this fixture at a normal development or production
|
||||
instance. The seeder checks the loopback host, trusted-local mode, and company
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import path from "node:path";
|
||||
import { prepareTestDriveEnvironment, testDriveCommand } from "../../../cli/src/commands/test-drive.js";
|
||||
|
||||
const options = {
|
||||
harness: "codex",
|
||||
apiKeyEnv: "BOOTSTRAP_FIXTURE_KEY",
|
||||
companyName: "Workspace Recovery QA",
|
||||
browser: false,
|
||||
} as const;
|
||||
|
||||
process.env.BOOTSTRAP_FIXTURE_KEY = "not-a-provider-key";
|
||||
await prepareTestDriveEnvironment(options);
|
||||
process.env.NODE_ENV = "test";
|
||||
// Test-drive clears PAPERCLIP_* settings. Apply the fixture's short deadline
|
||||
// after isolation; production snapshots may legitimately take much longer.
|
||||
process.env.PAPERCLIP_WORKSPACE_GIT_SNAPSHOT_TIMEOUT_MS = "10000";
|
||||
process.env.PATH = `${path.join(import.meta.dirname, "bin")}${path.delimiter}${process.env.PATH ?? ""}`;
|
||||
await testDriveCommand(options);
|
||||
@@ -22,11 +22,11 @@ for (const persistent of [false, true]) {
|
||||
if (await announcement.isVisible()) await announcement.click();
|
||||
await page.getByRole("link", { name: "Tasks", exact: true }).click();
|
||||
await page.getByRole("button", { name: "New Task", exact: true }).last().click();
|
||||
await page.getByPlaceholder("Task title (optional)", { exact: true }).fill(title);
|
||||
await page.getByRole("button", { name: "Assignee", exact: true }).click();
|
||||
await page.getByRole("button", { name: fixture.agentName, exact: true }).click();
|
||||
await page.getByRole("textbox", { name: "editable markdown" }).fill(title);
|
||||
await page.getByRole("button", { name: "Select assignee", exact: true }).click();
|
||||
await page.getByRole("option").filter({ hasText: fixture.agentName }).click();
|
||||
// Let the closing popover unmount before clicking another popover trigger.
|
||||
await expect(page.getByRole("textbox", { name: "Search assignees...", includeHidden: true })).toHaveCount(0);
|
||||
await expect(page.getByRole("searchbox", { name: "Search assignees", includeHidden: true })).toHaveCount(0);
|
||||
// The preceding popover's focus restoration can consume the first click.
|
||||
await expect(async () => {
|
||||
if (!await page.getByRole("textbox", { name: "Search projects..." }).isVisible()) {
|
||||
@@ -36,15 +36,21 @@ for (const persistent of [false, true]) {
|
||||
}).toPass({ timeout: 10_000, intervals: [1_000] });
|
||||
await page.getByRole("button", { name: fixture.projectName, exact: true }).click();
|
||||
await expect(page.getByRole("textbox", { name: "Search projects...", includeHidden: true })).toHaveCount(0);
|
||||
await page.getByRole("button", { name: "Create Task", exact: true }).click();
|
||||
const taskLink = page.getByRole("complementary").getByRole("link", { name: title, exact: true });
|
||||
const created = page.waitForResponse(response =>
|
||||
response.request().method() === "POST"
|
||||
&& new URL(response.url()).pathname === `/api/companies/${fixture.companyId}/issues`,
|
||||
);
|
||||
await page.getByRole("button", { name: "Create task", exact: true }).click();
|
||||
const response = await created;
|
||||
expect(response.ok(), await response.text()).toBeTruthy();
|
||||
const task = await response.json();
|
||||
expect(task.description).toBe(title);
|
||||
const taskLink = page.getByRole("complementary").getByRole("link", { name: task.title, exact: true });
|
||||
await expect(taskLink).toBeVisible();
|
||||
// Follow the UI's actual persisted link, including across task-tab state.
|
||||
const href = await taskLink.getAttribute("href");
|
||||
expect(href).toBeTruthy();
|
||||
await page.goto(new URL(href!, base).href);
|
||||
const tasks = await api(`/companies/${fixture.companyId}/issues`);
|
||||
const task = tasks.find((row: { title: string }) => row.title === title);
|
||||
const runs = async () => (await api(`/companies/${fixture.companyId}/heartbeat-runs`)).filter((row: { agentId: string }) => row.agentId === fixture.agentId);
|
||||
await expect.poll(async () => (await runs()).some((row: { errorCode: string }) => row.errorCode === "workspace_git_scan_timeout"), { timeout: 30_000 }).toBe(true);
|
||||
await expect(page.getByText(/Agent resumes in/)).toBeVisible();
|
||||
|
||||
Reference in new issue
Block a user