Guard release onboarding with scoped source E2E (#23432)

## Thinking Path

> - Paperclip helps people manage work with AI agents.
> - A release must pass onboarding before it reaches nightly.
> - Onboarding changes already run source browser tests on PRs.
> - The published release smoke used a separate scenario, which could
drift from those tests.
> - That drift blocked the December 1 nightly after onboarding
succeeded.
> - This PR fixes the stale welcome assertion and shares the scenario
between release smoke and relevant PR E2E runs.

## Linked Issues or Issue Description

Refs #23334 and #22259.

**What happened?**

[The December 1 nightly
release](https://github.com/paperclipai/paperclip/actions/runs/46614290688)
failed twice at `The onboarding chat must queue the lead's live
welcome`. PR #23334 changed the welcome to a saved message and a
question card. The greeting endpoint succeeded with `started: true` and
`runId: null`, but the release test still required a model run. PR
browser tests did not run those release expectations against the changed
source.

**Expected behavior**

Onboarding PRs and changes to their shared dependencies must run the
release scenario before merge. Known unrelated leaf-page changes and
source-unit-test-only changes can omit the extra case. Shared and
unfamiliar source paths must keep coverage. The scenario must check the
lead's welcome and all three first-chat choices, with no model run
before the user sends a choice or message. A mismatch must fail the
required `ci / e2e` check.

**Steps to reproduce**

1. Start the Docker onboarding harness with
`PAPERCLIPAI_VERSION=2026.1130.0-canary.873300` and its provider
verification mock.
2. Run the original release smoke test.
3. Observe successful login, setup, hire, and chat entry, followed by a
timeout because the run list stays empty.

**Paperclip version or commit**

Failed release source: `7ce7d99f8af81ae90f97650ef7a8692a86c63a35`.
Published package: `2026.1130.0-canary.873300`.

**Deployment mode**

The release test uses authenticated private Docker mode. The new PR test
uses the existing disposable source E2E instance and provider
verification fixture.

## What Changed

- Check the saved welcome and the three visible choices, then require an
empty agent run list.
- Move the complete wizard, hire, and chat assertions into one shared
onboarding scenario. Keep sign-in in the authenticated release wrapper.
- Add the shared scenario to the normal PR E2E suite. Omit only this
extra case when eligible source changes are confined to the Costs or
Approvals UI page, source unit tests, and audited prose. Shared
components, hooks, libraries, server code, mixed changes, and unfamiliar
source paths keep it. The repository rules require `ci / e2e` before
merge.
- Pass the trusted CI change plan to shard selection and bind it to the
checked-out commit. Reuse the existing lightweight source-diff
eligibility gate for both Vitest and E2E, with the old Vitest export
preserved. Full and shadow CI, broad or deleted inputs, invalid plans,
and stale plans keep the case. No extra browser job or matrix is added.
- Add release smoke files to the E2E and typecheck task inputs. Test
that onboarding changes select E2E and that smoke-only changes select
their two owners without forcing unrelated lanes.
- Document the shared test command and the source and installation
coverage.

## Verification

The shared browser scenario is unchanged from
`2044ada98e953504af68febe4c196f414d0bb1ae`. The selector review fix is
based on master’s hosted-shard speed improvement. Selector and
eligibility verification covers
`236640e419d1177aafb64f3f7dd1ee49848ee707`.

- Reproduced the original nightly timeout locally against the exact
published canary.
- The extracted release scenario passed against that canary in 22.1
seconds.
- The new source E2E passed against PR source and the built UI in 32.3
seconds.
- Restored the obsolete model-run assertion temporarily. The new source
E2E failed with the same `Expected: > 0 / Received: 0` timeout. Restored
the correct assertion. The final source confirmation passed in 31.7
seconds.
- `node --test scripts/__tests__/e2e-shard.test.mjs
.github/scripts/tests/ci-plan.test.mjs
scripts/ci/test-selection-workflow.test.mjs`: all 52 tests passed after
rebase. Coverage includes unrelated changes, relevant dependencies,
rename paths, full/invalid/stale plans, exact CLI shard partitions, and
both hosted shard policies. The unrelated-change and wiring tests failed
before the filter was implemented.
- Regression selection tests failed on `TaskChatComposer.tsx` and shadow
mode before this review fix. They now keep the composer, new-agent
runtime configuration, AI connection components, hooks, libraries, and
mixed source changes.
- The 3 existing source-diff eligibility contract tests passed after
extraction into the shared module.
- `actionlint .github/workflows/pr-trusted.yml` passed.
- `node --test scripts/ci/test-selection-inputs.test.mjs`: 4 tests
passed.
- The Playwright program and focused source scenario typechecks passed.
The test-budget check and `git diff --check` passed.
- The default local source bootstrap could not load the macOS embedded
PostgreSQL binary because its distribution lacked `libzstd.1.dylib`.
Source browser verification used a separate disposable Docker PostgreSQL
16 instance. Linux CI will cover the normal embedded database path.
- Earlier [hosted release
smoke](https://github.com/paperclipai/paperclip/actions/runs/46776940022)
passed both Docker onboarding and Linux background-service onboarding at
the first fix commit. The service job first hit npm package propagation
and passed on retry after publication completed.
- `pnpm verify --explain` requested broader CI coverage because the CI
task inputs changed. The focused checks above passed; the required CI
jobs will provide broad coverage.
- [Final-revision
CI](https://github.com/paperclipai/paperclip/actions/runs/46782167000)
passed on `236640e419d1177aafb64f3f7dd1ee49848ee707`. Both required
aggregates, all 16 browser shards, and all selected typecheck, build,
server, Runner, and canary dry-run jobs passed. [Incremental CI
qualification](https://github.com/paperclipai/paperclip/actions/runs/46782166749)
also passed.
- [The new source onboarding
case](https://github.com/paperclipai/paperclip/actions/runs/46782167000/job/143123174120)
ran on the hosted Linux runner and passed in 20.8 seconds.
- [Greptile
review](https://github.com/paperclipai/paperclip/pull/23432#issuecomment-7330325410)
scored `236640e419d1177aafb64f3f7dd1ee49848ee707` 5/5 and confirmed the
shared-dependency finding is fixed. There are no unresolved review
threads.

## Risks

- This changes test coverage and CI selection. It does not change
application behavior, release permissions, or publication rules.
- The source case stays on for shared and unfamiliar source changes. It
skips only the documented leaf pages and source-unit-test-only edits in
eligible plans. Local full E2E still includes it. Extend exclusions only
after checking that a path cannot affect onboarding.
- The trusted PR workflow is loaded from master. Before merge, the
current workflow keeps the full fallback because it does not yet pass
the change plan to the shard command. The unit and CLI tests qualify the
filtered path; after merge, the new workflow environment activates it.
- The source test uses local trusted authentication. The authenticated
published-package test remains responsible for login and installation
checks. Neither run needs paid model completions.
- GitHub master rules require code-owner approval for the protected CI
changes. Those review requests are already open. There are no conflicts
or unresolved review threads.
- A replacement nightly still needs a successful release run after this
reaches master. This PR does not bypass qualification or promote beta or
stable.

## Model Used

OpenAI Codex, `gpt-6.1-sol`, with xhigh reasoning effort, terminal
tools, GitHub CLI, and Playwright. The harness does not report the
context window size.

## 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
- [x] All Paperclip CI gates are green
- [x] 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:
Devin FoleyandPaperclip authored and GitHub committed 2026-12-01 17:23:13 -08:00
1 parent 54b86a6af2
commit 90bf446ad5
11 files changed
+378 -276

No files matched your search

+17
View File
@@ -190,6 +190,23 @@ test("canary dry run, runner support, chat, docker and test-only edits select th
assert.equal(selected(plan([file]), "docker_context_integrity"), true, `docker: ${file}`);
}
assert.deepEqual([...selectedTasks(plan(["tests/e2e/smoke.spec.ts"]))].sort(), ["ci:e2e", "ci:typecheck"]);
for (const file of [
"tests/release-smoke/docker-auth-onboarding.spec.ts",
"tests/release-smoke/onboarding-scenario.ts",
"tests/release-smoke/playwright.config.ts",
]) {
const result = plan([file]);
assert.equal(result.forceReason, null, file);
assert.deepEqual([...selectedTasks(result)].sort(), ["ci:e2e", "ci:typecheck"], file);
}
for (const file of [
"ui/src/components/OnboardingWizard.tsx",
"ui/src/pages/AgentChat.tsx",
"server/src/services/onboarding-chat.ts",
"packages/shared/src/question-set.ts",
]) {
assert.equal(selected(plan([file]), "e2e_shards"), true, file);
}
assert.deepEqual([...selectedTasks(plan(["tests/runner-e2e/catalog.test.ts"]))].sort(), ["ci:runner-e2e-support", "ci:runner-package", "ci:runner-static", "ci:typecheck"]);
assert.equal(selectedTasks(plan(["packages/paperclip-runner/src/index.ts"])).has("ci:runner-package"), true);
assert.equal(selectedTasks(plan(["packages/adapter-utils/src/github-launcher.ts"])).has("ci:runner-package"), true);
+1
View File
@@ -1944,6 +1944,7 @@ jobs:
- name: Run e2e tests
env:
CI_PLAN: ${{ needs.gate.outputs.plan }}
PAPERCLIP_E2E_SKIP_LLM: "true"
PAPERCLIP_PLAYWRIGHT_CHANNEL: "chrome"
PAPERCLIP_E2E_SKIP_UI_BUILD: ${{ steps.e2e_ui_dist.outputs.cache-hit == 'true' && '1' || '' }}
@@ -31,3 +31,34 @@ PAPERCLIP_TELEMETRY_DISABLED=1 PAPERCLIP_FIRST_CHAT_MANUAL=1 pnpm exec playwri
The script starts a separate loopback app and opens a headed browser with scripted model sign-in and scripted replies after submission. It uses the actual wizard, built-in personalized greeting, saved thread, and question response handler. When Playwright pauses, use the browser to follow the steps above. All three choices have scripted replies. After choosing one, type a follow-up such as “build a website” to receive the scripted acknowledgment. Reload and check that the messages keep their order. The fixture stops when Playwright exits.
To run the automated fast-arrival and delayed/reduced-motion checks without the inspector, omit `PAPERCLIP_FIRST_CHAT_MANUAL` and `--debug`, and select both tests with `-g 'warms the welcome|welcome request is pending'`.
## PR and release smoke coverage
The required `ci / e2e` check runs `tests/e2e/release-onboarding.spec.ts` against
the PR's source and built UI. It uses the same `completeOnboarding` scenario as
the authenticated Docker release smoke. Keep wizard, hire, welcome, and choice
assertions in `tests/release-smoke/onboarding-scenario.ts` so both gates change
together. Changes to the release smoke files also select the source E2E lane.
The shard planner omits this extra case only for changes confined to the Costs
or Approvals UI pages, source unit tests, and audited prose. Shared components,
hooks, libraries, server code, and new source paths keep the case by default.
Mixed changes keep it when any source file falls outside the known unrelated
set. The skip set lives in `scripts/e2e-shard.mjs`; extend it only after checking
that the new path cannot affect onboarding.
The browser and Vitest selectors share the source-diff eligibility check. Full
or shadow CI, missing or malformed change plans, deleted or non-source inputs,
and plans for a different checkout keep the case. Local unfiltered E2E runs also
keep it. No separate browser job is added.
Run the shared scenario before submitting onboarding changes:
```sh
pnpm exec playwright test --config tests/e2e/playwright.config.ts release-onboarding.spec.ts
```
The source run uses a disposable local instance and simulates only the upstream
API key check with the existing provider fixture. It does not need model
credentials. The release run also checks authentication and the published npm
installation. A source E2E pass does not replace that installation check.
+83 -2
View File
@@ -20,6 +20,7 @@ import {
resolveEffectiveParallelSpeedup,
resolveSerialSlowdown,
selectE2eShard,
selectE2eSpecsForPlan,
} from "../e2e-shard.mjs";
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..");
@@ -36,8 +37,10 @@ const SHARD_COUNT = JSON.parse(readFileSync(ciTaskMatrixPath, "utf8")).e2e_shard
const TARGET_AWS_SHARD_COUNT = 16;
const TARGET_HOSTED_SHARD_COUNT = 4;
function runShard(args) {
const result = spawnSync(process.execPath, [script, ...args], { cwd: repoRoot, encoding: "utf8" });
function runShard(args, ciPlan = "") {
const result = spawnSync(process.execPath, [script, ...args], {
cwd: repoRoot, encoding: "utf8", env: { ...process.env, CI_PLAN: ciPlan },
});
assert.equal(result.status, 0, `expected success for ${args.join(" ")}: ${result.stderr}`);
return result.stdout.trim().split(/\s+/).filter(Boolean);
}
@@ -132,6 +135,84 @@ test("the e2e shards form a complete, non-overlapping partition", () => {
}
});
const planHead = "a".repeat(40);
const scopedPlan = (changed, overrides = {}) => JSON.stringify({
version: 1, mode: "enabled", forceReason: null, changed,
diff: { head: planHead }, ...overrides,
});
test("release onboarding is omitted for unrelated changes without removing other browser specs", () => {
const files = listE2eSpecs();
const ordinary = files.filter(file => file !== "tests/e2e/release-onboarding.spec.ts");
for (const changed of [
["ui/src/pages/Costs.tsx"],
["ui/src/lib/onboarding-route.test.ts", "server/src/__tests__/onboarding-chat-route.test.ts"],
["ui/src/pages/Approvals.tsx", "doc/testing/onboarding-first-chat-test-drive.md"],
]) {
assert.deepEqual(selectE2eSpecsForPlan(files, scopedPlan(changed), planHead), ordinary);
}
});
test("release onboarding is retained for its flow, shared dependencies, and smoke fixtures", () => {
const files = listE2eSpecs();
for (const file of [
"ui/src/components/OnboardingWizard.tsx", "ui/src/components/onboarding/FooterNav.tsx",
"ui/src/lib/onboarding-route.ts", "ui/src/pages/AgentChat.tsx", "ui/src/pages/IssueDetail.tsx",
"ui/src/components/ui/button.tsx", "ui/src/api/agents.ts", "ui/src/context/CompanyContext.tsx",
"ui/src/index.css", "ui/src/pages/IssueDetail/history.ts",
"ui/src/components/task-chat/TaskChatComposer.tsx",
"ui/src/lib/new-agent-runtime-config.ts", "ui/src/components/ai-connections/AiConnectionField.tsx",
"ui/src/hooks/useAgentChatEnabled.ts", "ui/src/lib/recent-agent-chats.ts",
"server/src/routes/agents.ts", "server/src/services/onboarding-chat.ts",
"server/src/services/costs.ts",
"server/src/services/ai-api-key-test.ts", "server/src/services/agent-conversations.ts",
"packages/shared/src/question-set.ts", "packages/db/src/schema/agents.ts",
"tests/release-smoke/onboarding-scenario.ts", "tests/e2e/release-onboarding.spec.ts",
"tests/e2e/start-e2e-server.ts", "tests/e2e/fixtures/ai-connection-provider.mjs",
]) {
assert.deepEqual(selectE2eSpecsForPlan(files, scopedPlan([file]), planHead), files, file);
}
for (const changed of [
["ui/src/components/OnboardingWizard.tsx", "ui/src/components/SetupWizard.tsx"],
["ui/src/pages/Costs.tsx", "ui/src/lib/new-agent-runtime-config.ts"],
["ui/src/pages/Approvals.tsx", "ui/src/components/task-chat/TaskChatComposer.tsx"],
]) assert.deepEqual(selectE2eSpecsForPlan(files, scopedPlan(changed), planHead), files);
});
test("release onboarding remains in full, unavailable, malformed, or stale plans", () => {
const files = listE2eSpecs();
for (const serialized of [
undefined, "", "{", "null", "[]", "{}",
scopedPlan([]), scopedPlan([null]), scopedPlan(["../outside.ts"]),
scopedPlan(["ui/src/pages/Costs.tsx"], { mode: "invalid" }),
scopedPlan(["ui/src/pages/Costs.tsx"], { mode: "shadow" }),
scopedPlan(["ui/src/pages/Costs.tsx"], { diff: null }),
scopedPlan(["ui/src/pages/Costs.tsx"], { version: 2 }),
scopedPlan(["ui/src/pages/Costs.tsx"], { mode: "full" }),
scopedPlan(["ui/src/pages/Costs.tsx"], { forceReason: "Diff unavailable" }),
scopedPlan(["ui/src/pages/Costs.tsx"], { diff: { head: "b".repeat(40) } }),
]) {
assert.deepEqual(selectE2eSpecsForPlan(files, serialized, planHead), files);
}
});
test("conditional onboarding selection keeps an exact CLI shard partition", () => {
const result = spawnSync("git", ["rev-parse", "HEAD"], { cwd: repoRoot, encoding: "utf8" });
assert.equal(result.status, 0);
const serialized = scopedPlan(["ui/src/pages/Costs.tsx"], { diff: { head: result.stdout.trim() } });
const expected = listE2eSpecs().filter(file => file !== "tests/e2e/release-onboarding.spec.ts");
const shards = Array.from({ length: TARGET_HOSTED_SHARD_COUNT }, (_, index) =>
runShard(["--shard-index", String(index), "--shard-count", String(TARGET_HOSTED_SHARD_COUNT)], serialized));
assert.deepEqual(shards.flat().sort(), expected);
assert.ok(shards.every(shard => shard.length > 0));
});
test("the PR browser step passes the trusted change plan to shard selection", () => {
const block = readWorkflowJobs(readTrustedPrWorkflow()).get("e2e_shards");
const step = block.split(" - name: Run e2e tests\n")[1].split(" - name:")[0];
assert.match(step, /CI_PLAN: \$\{\{ needs\.gate\.outputs\.plan \}\}/);
});
test("the ignored spec list matches playwright.config.ts testIgnore", () => {
const config = readFileSync(playwrightConfig, "utf8");
const match = config.match(/testIgnore:\s*\[([^\]]*)\]/);
+3 -18
View File
@@ -1,5 +1,5 @@
import { execFileSync } from "node:child_process";
import { appendFileSync, lstatSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
import { appendFileSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
import { fileURLToPath } from "node:url";
import path from "node:path";
import assert from "node:assert/strict";
@@ -8,24 +8,9 @@ import { activeNightlySuitesForEnv } from "./nightly-only-suites.mjs";
import { productInputs } from "../../.github/scripts/ci-inputs.mjs";
import { mergeDiff } from "../../.github/scripts/ci-diff.mjs";
import { selectProjects } from "./select-projects.mjs";
import { selectionEligibility } from "./selection-eligibility.mjs";
export function selectionEligibility(plan, root = process.cwd()) {
if (plan?.version !== 1 || plan.mode !== "enabled" || plan.forceReason) return "Full/shadow/forced task plan";
if (!Array.isArray(plan.changed) || !plan.changed.length) return "Incomplete comparison";
const changed = productInputs(plan.changed);
if (!changed.length) return "Documentation-only diff";
for (const file of changed) {
// Business modules can contain "config"/"setup" in their names. The graph
// separately tracks actual setup and configuration dependencies.
if (!/^(?:ui\/src|server\/src|cli\/src|packages\/.+\/src)\/.+\.[cm]?[jt]sx?$/.test(file)
|| /(?:^|\/)(?:vite|vitest)\.(?:config|setup)\.[cm]?[jt]sx?$|\.d\.[cm]?ts$/i.test(file)
|| file.split("/").includes("..")) return `Broad input: ${file}`;
try {
if (!lstatSync(path.join(root, file)).isFile()) return `Non-regular source: ${file}`;
} catch { return `Deleted or missing source: ${file}`; }
}
return null;
}
export { selectionEligibility };
function runnerInventory(group) {
const args = group === "serialized" ? ["--mode", "serialized", "--shard-index", "0", "--shard-count", "1"]
+19
View File
@@ -0,0 +1,19 @@
import { lstatSync } from "node:fs";
import path from "node:path";
import { productInputs } from "../../.github/scripts/ci-inputs.mjs";
export function selectionEligibility(plan, root = process.cwd()) {
if (plan?.version !== 1 || plan.mode !== "enabled" || plan.forceReason) return "Full/shadow/forced task plan";
if (!Array.isArray(plan.changed) || !plan.changed.length) return "Incomplete comparison";
const changed = productInputs(plan.changed);
if (!changed.length) return "Documentation-only diff";
for (const file of changed) {
if (!/^(?:ui\/src|server\/src|cli\/src|packages\/.+\/src)\/.+\.[cm]?[jt]sx?$/.test(file)
|| /(?:^|\/)(?:vite|vitest)\.(?:config|setup)\.[cm]?[jt]sx?$|\.d\.[cm]?ts$/i.test(file)
|| file.split("/").includes("..")) return `Broad input: ${file}`;
try {
if (!lstatSync(path.join(root, file)).isFile()) return `Non-regular source: ${file}`;
} catch { return `Deleted or missing source: ${file}`; }
}
return null;
}
+26 -1
View File
@@ -1,9 +1,12 @@
import { execFileSync } from "node:child_process";
import { readdirSync } from "node:fs";
import os from "node:os";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { loadShardDurations, partitionGeneralServerSuites } from "./general-server-shard.mjs";
import { selectionEligibility } from "./ci/selection-eligibility.mjs";
import { productInputs } from "../.github/scripts/ci-inputs.mjs";
const HERE = path.dirname(fileURLToPath(import.meta.url));
const REPO_ROOT = path.resolve(HERE, "..");
@@ -130,6 +133,22 @@ export function selectE2eShard(files, shardIndex, shardCount, durations = {}, op
return partitionE2eShards(files, shardCount, durations, options)[shardIndex].files;
}
const unrelatedOnboardingInputs = new Set([
"ui/src/pages/Costs.tsx",
"ui/src/pages/Approvals.tsx",
]);
export function selectE2eSpecsForPlan(files, serializedPlan, head) {
try {
const plan = JSON.parse(serializedPlan);
if (!/^[a-f0-9]{40}$/.test(head ?? "") || plan?.diff?.head !== head
|| selectionEligibility(plan, REPO_ROOT)) return files;
const unrelated = productInputs(plan.changed).every(file =>
unrelatedOnboardingInputs.has(file) || /\.test\.[cm]?[jt]sx?$/.test(file));
return unrelated ? files.filter(file => file !== "tests/e2e/release-onboarding.spec.ts") : files;
} catch { return files; }
}
function parseArgs(argv) {
const args = { shardIndex: 0, shardCount: 1, parallelSpeedup: null, serialSlowdown: null };
for (let index = 0; index < argv.length; index += 1) {
@@ -164,7 +183,13 @@ function main(argv) {
? envSlowdown
: resolveSerialSlowdown();
const specs = listE2eSpecs();
let head;
try {
if (process.env.CI_PLAN) head = execFileSync("git", ["rev-parse", "HEAD"], {
cwd: REPO_ROOT, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"],
}).trim();
} catch {}
const specs = selectE2eSpecsForPlan(listE2eSpecs(), process.env.CI_PLAN, head);
const durations = loadShardDurations(DURATIONS_MANIFEST);
process.stdout.write(
`${selectE2eShard(specs, shardIndex, shardCount, durations, {
+12
View File
@@ -0,0 +1,12 @@
import { test } from "@playwright/test";
import { completeOnboarding } from "../release-smoke/onboarding-scenario";
test("the release onboarding scenario passes against PR source", async ({ page }) => {
test.setTimeout(90_000);
await page.goto("/");
await completeOnboarding(page, {
companyName: `Source-Release-Smoke-${Date.now()}`,
agentName: "Release Smoke Lead",
anthropicApiKey: "paperclip-e2e-personal-claude-key",
});
});
@@ -1,4 +1,5 @@
import { expect, test, type Page } from "@playwright/test";
import { completeOnboarding } from "./onboarding-scenario";
const ADMIN_EMAIL =
process.env.PAPERCLIP_RELEASE_SMOKE_EMAIL ??
@@ -32,14 +33,6 @@ const ANTHROPIC_API_KEY =
process.env.PAPERCLIP_RELEASE_SMOKE_ANTHROPIC_API_KEY ??
(TARGET_IS_LOOPBACK ? "sk-ant-release-smoke-placeholder" : "");
const COMPANY_NAME = `Release-Smoke-${Date.now()}`;
const AGENT_NAME = "Release Smoke Lead";
// The arc asks for a name, not a role, so every onboarding hire is filed under
// the neutral role (DEFAULT_AGENT_ROLE in ui/src/lib/onboarding-agent-role.ts).
const AGENT_ROLE = "general";
// ONBOARDING_CHAT_ORIGIN_KIND in packages/shared/src/constants.ts.
const ONBOARDING_CHAT_ORIGIN_KIND = "onboarding_chat";
async function signIn(page: Page) {
await page.goto("/");
await expect(page).toHaveURL(/\/auth/);
@@ -51,257 +44,17 @@ async function signIn(page: Page) {
await expect(page).not.toHaveURL(/\/auth/, { timeout: 20_000 });
}
async function getJson<T>(page: Page, url: string): Promise<T> {
const response = await page.request.get(url);
expect(response.ok()).toBe(true);
return (await response.json()) as T;
}
// ONBOARDING_STORAGE_KEY in ui/src/components/OnboardingWizard.tsx.
const ONBOARDING_DRAFT_STORAGE_KEY = "paperclip-onboarding-state";
/**
* Open the wizard on its first step and hand back the organization-name field.
*
* `/onboarding` resolves to `{ initialStep: 1 }` on a self-hosted instance
* (`resolveRouteOnboardingOptions`) and the route keeps the wizard open, so
* this lands on "name your organization" whether or not the instance already
* holds a company. Navigating explicitly is what keeps the spec re-runnable:
* the release-smoke config retries once in CI, and by the second attempt the
* instance is no longer company-less, so sign-in lands on a dashboard instead.
*
* The saved draft is dropped first. Sign-in on an instance that already holds
* an agentless company redirects into *that* company's onboarding, which
* persists its id into the draft; the restored draft then makes step 1 skip
* creating a company and hire into the old one instead. That is an artifact of
* re-running against a re-used instance, not behaviour this spec is asserting,
* and a fresh release-smoke container never has it.
*
* The field is located by role. Step 1 has no id and its `<label>` is not
* associated with the input, so the alternative is its placeholder copy — the
* exact coupling that let this spec drift. The wizard's first screen has
* exactly one text box, and a second one appearing there would fail Playwright's
* strict mode loudly rather than silently matching the wrong control.
*/
async function openOnboarding(page: Page) {
await page.evaluate((key) => {
window.localStorage.removeItem(key);
}, ONBOARDING_DRAFT_STORAGE_KEY);
await page.goto("/onboarding");
const orgNameField = page.getByRole("textbox");
await expect(orgNameField).toBeVisible({ timeout: 20_000 });
return orgNameField;
}
test.describe("Docker authenticated onboarding smoke", () => {
test("logs in, completes onboarding, and hires the lead agent", async ({
page,
}) => {
// Only bites off-loopback: fail on arrival rather than submitting the
// placeholder to the real provider and timing out deep in the wizard.
test("logs in, completes onboarding, and hires the lead agent", async ({ page }) => {
expect(
ANTHROPIC_API_KEY,
"This target reaches the real provider — set PAPERCLIP_RELEASE_SMOKE_ANTHROPIC_API_KEY to a key it accepts"
"This target reaches the real provider — set PAPERCLIP_RELEASE_SMOKE_ANTHROPIC_API_KEY to a key it accepts",
).toBeTruthy();
await signIn(page);
const baseUrl = new URL(page.url()).origin;
// A board with no company routes sign-in straight into onboarding rather
// than a dashboard — the first-run experience this suite exists to guard.
// Asserted only when the instance really is company-less, because a retry
// (or a re-used smoke container) runs against one that is not.
const companiesBeforeOnboarding = await getJson<Array<{ id: string }>>(
page,
`${baseUrl}/api/companies`
);
if (companiesBeforeOnboarding.length === 0) {
await expect(page).toHaveURL(/\/onboarding$/, { timeout: 20_000 });
}
// Step 1: name the organization. "Continue" creates the company itself and
// routes straight to the agent step — onboarding no longer asks for the
// mission (it is collected later, in the app), so step 2 is skipped.
const orgNameField = await openOnboarding(page);
await orgNameField.fill(COMPANY_NAME);
await page.getByRole("button", { name: "Continue", exact: true }).click();
// Step 3: name the team lead. The name is the step's only question and it
// gates the CTA; the role picker is gone, so the hire is filed as `general`.
const agentNameField = page.locator("#onboarding-agent-name");
await expect(agentNameField).toBeVisible({ timeout: 20_000 });
await agentNameField.fill(AGENT_NAME);
const nextButton = page.getByRole("button", { name: "Next", exact: true });
await expect(nextButton).toBeEnabled({ timeout: 10_000 });
await nextButton.click();
// Step 4: answer the model-source question, then connect (hire) the lead.
// The step now opens as a row of source tiles and the footer button has
// nothing to do until one is picked (#12796/#12801 rebuilt the step around
// that question); picking Claude collapses the row.
//
// Since #13344, a hire requires a verified credential: the subscription
// path opens an isolated `claude auth login` attempt that only a human at
// a terminal on the server can finish, and Connect refuses to proceed
// until it has. The clean-machine path this suite guards is therefore the
// API key: switch modes, pick Claude, paste a key, Connect — the server
// verifies it against the provider endpoint (the harness's mock, here)
// and then hires. A genuine failure here means the published artifact
// cannot hire on a clean machine even when the provider accepts the
// credential. Allow generous time for the validation + hire +
// auto-approval.
//
// The mode switch comes before the tile: picking a tile starts the step's
// collapse sequence and the "Use API key instead" link only offers itself
// while the row is still a question (`connectLinkVisible` in
// OnboardingWizard.tsx).
await expect(
page.getByRole("heading", { name: "Connect a model" })
).toBeVisible({ timeout: 20_000 });
const companies = await getJson<Array<{ id: string; name: string }>>(
page,
`${baseUrl}/api/companies`
);
const company = companies.find((entry) => entry.name === COMPANY_NAME);
expect(company).toBeTruthy();
const agentsUrl = `${baseUrl}/api/companies/${company!.id}/agents`;
await expect.poll(
() => getJson<Array<{ id: string }>>(page, agentsUrl),
{ message: "Connect a model must retain one paused setup record" },
).toEqual([
expect.objectContaining({
name: AGENT_NAME,
status: "paused",
pauseReason: "setup",
metadata: expect.objectContaining({ setupAdapterPending: true }),
runtimeConfig: expect.objectContaining({
heartbeat: expect.objectContaining({ enabled: false }),
}),
}),
]);
const [setupAgent] = await getJson<Array<{ id: string }>>(page, agentsUrl);
for (const resource of ["issues", "heartbeat-runs"]) {
expect(
await getJson<Array<{ id: string }>>(
page,
`${baseUrl}/api/companies/${company!.id}/${resource}`,
),
).toEqual([]);
}
await page
.getByRole("button", { name: "Use API key instead", exact: true })
.click();
// "Claude API" once the mode has swapped the tile's tag — matched on the
// stable half.
const claudeSourceTile = page
.getByRole("radiogroup", { name: "Model source" })
.getByRole("radio", { name: /Claude/ });
await expect(claudeSourceTile).toBeVisible({ timeout: 10_000 });
await claudeSourceTile.click();
// OnboardingCardField carries the accessible name via aria-label.
const apiKeyField = page.getByLabel("API key");
await expect(apiKeyField).toBeVisible({ timeout: 10_000 });
await apiKeyField.fill(ANTHROPIC_API_KEY);
const connectButton = page.getByRole("button", {
name: "Connect",
exact: true,
await completeOnboarding(page, {
companyName: `Release-Smoke-${Date.now()}`,
agentName: "Release Smoke Lead",
anthropicApiKey: ANTHROPIC_API_KEY,
});
await expect(connectButton).toBeVisible({ timeout: 10_000 });
await expect(connectButton).toBeEnabled({ timeout: 30_000 });
await connectButton.click();
// Step 5: review, then launch. Since #22077, "Get started" opens the lead's
// standing chat and, only on success, drops the user into it (not the
// dashboard). It creates no execution task or project.
const getStartedButton = page.getByRole("button", {
name: "Get started",
exact: true,
});
await expect(getStartedButton).toBeVisible({ timeout: 60_000 });
await expect(getStartedButton).toBeEnabled({ timeout: 10_000 });
await getStartedButton.click();
await expect(page).toHaveURL(/\/chats\/[^/]+$/, { timeout: 30_000 });
const agents = await getJson<
Array<{ id: string; name: string; role: string; adapterType: string; pauseReason: string | null }>
>(page, `${baseUrl}/api/companies/${company!.id}/agents`);
expect(agents).toHaveLength(1);
const leadAgent = agents.find((entry) => entry.name === AGENT_NAME);
expect(leadAgent).toBeTruthy();
expect(leadAgent!.id).toBe(setupAgent!.id);
expect(leadAgent!.pauseReason).not.toBe("setup");
expect(leadAgent!.role).toBe(AGENT_ROLE);
expect(leadAgent!.adapterType).not.toBe("process");
// Onboarding deliberately writes no goal: the mission is collected later in
// the app, so a fresh company must come out of the wizard with an empty
// goal list rather than an unchosen one.
const goals = await getJson<Array<{ id: string }>>(
page,
`${baseUrl}/api/companies/${company!.id}/goals`
);
expect(goals).toEqual([]);
// The launch must have landed on the lead's chat itself, not merely on
// some chat route.
expect(new URL(page.url()).pathname.endsWith(`/chats/${leadAgent!.id}`)).toBe(
true
);
// Execution work waits until the user accepts a proposal, so the wizard
// leaves the task and project lists empty. The chat record is excluded
// from task collections and is listed only under chats.
for (const resource of ["issues", "projects"]) {
expect(
await getJson<Array<{ id: string }>>(
page,
`${baseUrl}/api/companies/${company!.id}/${resource}`,
),
).toEqual([]);
}
const chats = await getJson<
Array<{
originKind: string;
projectId: string | null;
conversationAgentId: string | null;
}>
>(page, `${baseUrl}/api/companies/${company!.id}/chats`);
expect(chats).toEqual([
expect.objectContaining({
originKind: ONBOARDING_CHAT_ORIGIN_KIND,
projectId: null,
conversationAgentId: leadAgent!.id,
}),
]);
// Assert the chat actually opened: its composer renders only once the
// conversation loaded.
await expect(page.getByTestId("task-chat-composer-add")).toBeVisible({
timeout: 20_000,
});
// Once the chat paints in a visible tab, the UI requests a live welcome
// through the normal agent queue. The provider mock serves no completions,
// so assert only that the published artifact queued the welcome run, not
// what it says.
const runsUrl = `${baseUrl}/api/companies/${company!.id}/heartbeat-runs?agentId=${leadAgent!.id}`;
await expect
.poll(
async () =>
(await getJson<Array<{ id: string }>>(page, runsUrl)).length,
{
message: "The onboarding chat must queue the lead's live welcome",
timeout: 30_000,
},
)
.toBeGreaterThan(0);
});
});
+176
View File
@@ -0,0 +1,176 @@
import { expect, type Page } from "@playwright/test";
const AGENT_ROLE = "general";
const ONBOARDING_CHAT_ORIGIN_KIND = "onboarding_chat";
async function getJson<T>(page: Page, url: string): Promise<T> {
const response = await page.request.get(url);
expect(response.ok()).toBe(true);
return (await response.json()) as T;
}
const ONBOARDING_DRAFT_STORAGE_KEY = "paperclip-onboarding-state";
async function openOnboarding(page: Page) {
await page.evaluate((key) => {
window.localStorage.removeItem(key);
}, ONBOARDING_DRAFT_STORAGE_KEY);
await page.goto("/onboarding");
const orgNameField = page.getByRole("textbox");
await expect(orgNameField).toBeVisible({ timeout: 20_000 });
return orgNameField;
}
export async function completeOnboarding(page: Page, {
companyName,
agentName,
anthropicApiKey,
}: {
companyName: string;
agentName: string;
anthropicApiKey: string;
}) {
const baseUrl = new URL(page.url()).origin;
const companiesBeforeOnboarding = await getJson<Array<{ id: string }>>(
page,
`${baseUrl}/api/companies`
);
if (companiesBeforeOnboarding.length === 0) {
await expect(page).toHaveURL(/\/onboarding$/, { timeout: 20_000 });
}
const orgNameField = await openOnboarding(page);
await orgNameField.fill(companyName);
await page.getByRole("button", { name: "Continue", exact: true }).click();
const agentNameField = page.locator("#onboarding-agent-name");
await expect(agentNameField).toBeVisible({ timeout: 20_000 });
await agentNameField.fill(agentName);
const nextButton = page.getByRole("button", { name: "Next", exact: true });
await expect(nextButton).toBeEnabled({ timeout: 10_000 });
await nextButton.click();
await expect(
page.getByRole("heading", { name: "Connect a model" })
).toBeVisible({ timeout: 20_000 });
const companies = await getJson<Array<{ id: string; name: string }>>(
page,
`${baseUrl}/api/companies`
);
const company = companies.find((entry) => entry.name === companyName);
expect(company).toBeTruthy();
const agentsUrl = `${baseUrl}/api/companies/${company!.id}/agents`;
await expect.poll(
() => getJson<Array<{ id: string }>>(page, agentsUrl),
{ message: "Connect a model must retain one paused setup record" },
).toEqual([
expect.objectContaining({
name: agentName,
status: "paused",
pauseReason: "setup",
metadata: expect.objectContaining({ setupAdapterPending: true }),
runtimeConfig: expect.objectContaining({
heartbeat: expect.objectContaining({ enabled: false }),
}),
}),
]);
const [setupAgent] = await getJson<Array<{ id: string }>>(page, agentsUrl);
for (const resource of ["issues", "heartbeat-runs"]) {
expect(
await getJson<Array<{ id: string }>>(
page,
`${baseUrl}/api/companies/${company!.id}/${resource}`,
),
).toEqual([]);
}
await page
.getByRole("button", { name: "Use API key instead", exact: true })
.click();
const claudeSourceTile = page
.getByRole("radiogroup", { name: "Model source" })
.getByRole("radio", { name: /Claude/ });
await expect(claudeSourceTile).toBeVisible({ timeout: 10_000 });
await claudeSourceTile.click();
const apiKeyField = page.getByLabel("API key");
await expect(apiKeyField).toBeVisible({ timeout: 10_000 });
await apiKeyField.fill(anthropicApiKey);
const connectButton = page.getByRole("button", {
name: "Connect",
exact: true,
});
await expect(connectButton).toBeVisible({ timeout: 10_000 });
await expect(connectButton).toBeEnabled({ timeout: 30_000 });
await connectButton.click();
const getStartedButton = page.getByRole("button", {
name: "Get started",
exact: true,
});
await expect(getStartedButton).toBeVisible({ timeout: 60_000 });
await expect(getStartedButton).toBeEnabled({ timeout: 10_000 });
await getStartedButton.click();
await expect(page).toHaveURL(/\/chats\/[^/]+$/, { timeout: 30_000 });
const agents = await getJson<
Array<{ id: string; name: string; role: string; adapterType: string; pauseReason: string | null }>
>(page, `${baseUrl}/api/companies/${company!.id}/agents`);
expect(agents).toHaveLength(1);
const leadAgent = agents.find((entry) => entry.name === agentName);
expect(leadAgent).toBeTruthy();
expect(leadAgent!.id).toBe(setupAgent!.id);
expect(leadAgent!.pauseReason).not.toBe("setup");
expect(leadAgent!.role).toBe(AGENT_ROLE);
expect(leadAgent!.adapterType).not.toBe("process");
const goals = await getJson<Array<{ id: string }>>(
page,
`${baseUrl}/api/companies/${company!.id}/goals`
);
expect(goals).toEqual([]);
expect(new URL(page.url()).pathname.endsWith(`/chats/${leadAgent!.id}`)).toBe(
true
);
for (const resource of ["issues", "projects"]) {
expect(
await getJson<Array<{ id: string }>>(
page,
`${baseUrl}/api/companies/${company!.id}/${resource}`,
),
).toEqual([]);
}
const chats = await getJson<
Array<{
originKind: string;
projectId: string | null;
conversationAgentId: string | null;
}>
>(page, `${baseUrl}/api/companies/${company!.id}/chats`);
expect(chats).toEqual([
expect.objectContaining({
originKind: ONBOARDING_CHAT_ORIGIN_KIND,
projectId: null,
conversationAgentId: leadAgent!.id,
}),
]);
await expect(page.getByTestId("task-chat-composer-add")).toBeVisible({
timeout: 20_000,
});
await expect(
page.getByText(
`Welcome to Paperclip! I’m ${agentName}, your first agent teammate.`,
{ exact: true },
),
).toBeVisible({ timeout: 20_000 });
const choices = page.getByTestId("task-chat-composer-takeover");
await expect(choices).toBeVisible({ timeout: 20_000 });
await expect(choices.getByRole("radio")).toHaveCount(3);
for (const label of [
"Interview me about my goals",
"Tell me what Paperclip can do",
"Help me accomplish a task",
]) {
await expect(choices.getByRole("radio", { name: label, exact: true })).toBeVisible();
}
const runsUrl = `${baseUrl}/api/companies/${company!.id}/heartbeat-runs?agentId=${leadAgent!.id}`;
expect(await getJson<Array<{ id: string }>>(page, runsUrl)).toEqual([]);
}
+3 -1
View File
@@ -204,6 +204,7 @@
"packages/**",
"ui/**",
"tests/e2e/**",
"tests/release-smoke/**",
"tests/runner-e2e/**"
],
"outputs": [],
@@ -262,7 +263,8 @@
"cli/**",
"packages/**",
"ui/**",
"tests/e2e/**"
"tests/e2e/**",
"tests/release-smoke/**"
],
"outputs": [],
"cache": false