mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-06 07:38:47 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - The chat catalog eval `teams.configure-team` checks that chat gets an installed team ready member by member > - Its setup installs Product Engineering, removes the QA member's account, and requires a real probe split: QA missing an account, the senior coder ready > - The QA probe returned a generic `opencode_hello_probe_failed` error, so the setup stopped with "probes do not establish the required missing-versus-ready account split" > - The cause is a product classification gap: OpenRouter answers an empty key with HTTP 401 "Missing Authentication header", which the OpenCode probe did not treat as authentication (fixed in #20878, cherry-picked here) > - This pull request makes the setup blocker name each member's observed readiness, and replaces reply keyword checks with structural checks > - The benefit is that the eval can reach the chat journey and grades it without matching words ## Linked Issues or Issue Description Refs #20878 **What happened** `teams.configure-team` failed in setup. The QA member's probe was `fail` with `opencode_hello_probe_failed`. The senior coder passed. The setup error did not say which member was in which state. **Expected behavior** The QA member's probe reports the missing-authentication check, so the split forms and the chat journey runs. When the split does not form, the setup error names each member's observed status and checks. **Steps to reproduce** 1. Run `chat-features.runner-opencode.local.teams.configure-team` on master. 2. Read `snapshots/chat-catalog-team-initial-probes.json`. 3. QA shows `fail` with `opencode_hello_probe_failed:error`; the setup stops. ## What Changed - Cherry-pick of #20878: the OpenCode probe classifies a provider 401 as `opencode_hello_probe_auth_required`. - The setup blocker now lists each member as `name (expected missing account | expected ready | other member): status [non-info checks]`. - Grader: remove the member-name substring check and the "team is ready" regex. Identification is the rendered link to the missing member's own page, which the case already required. The followup is graded by a non-empty reply from its own succeeded run, not by the words "ready/configured/verified/account". Fresh per-member probes, preserved working configuration and revisions, and the attributed repair stay unchanged. - Calibration: reworded and non-English valid followups pass; missing handoff, empty followup, and failed followup run fail. A setup test with the recorded failure shape checks the new error text. - `oracleVersion` bumped to `paperclip.chat-catalog.team-configure.v3`; `parse.ts` added to `sourceFiles`. ## Verification - `pnpm exec vitest run --config tests/runner-e2e/vitest.config.ts tests/runner-e2e/chat-catalog-domains/external-team-configure.test.ts tests/runner-e2e/chat-catalog-domains/external-team-configure-prerequisite.test.ts tests/runner-e2e/chat-runtime-profile.test.ts tests/runner-e2e/chat-catalog-contract.test.ts tests/runner-e2e/chat-catalog-consistency.test.ts` passes. - `node tests/runner-e2e/source-sdk-public-inputs.mjs <HEAD> --check` reports no change. - `node --test tests/runner-e2e/chat-full-catalog-testops-manifest.test.mjs` passes. - The paid run `chat-features.runner-opencode.local.teams.configure-team` is still to run. ## Risks - The removed "team is ready" regex failed open. A false whole-team claim in the reply now needs human reading of the transcript. The structural checks still reject a missing handoff, a missing repair, and any member that fails its fresh probe. ## Model Used - Anthropic Claude Opus 5.5 (`claude-opus-5-5`), tool use and code execution in Claude Code. ## 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 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
77 lines
6.1 KiB
TypeScript
77 lines
6.1 KiB
TypeScript
import { expect, it, vi } from "vitest";
|
|
import type { ChatCatalogContext } from "../chat-catalog-contract.js";
|
|
import { teamConfigureExternalCases } from "./external-team-configure.js";
|
|
|
|
type Probe = { status: string; testedAt: string; checks: Array<{ code: string; level: string }> };
|
|
function setupFixture(missing: Probe, working: Probe = { status: "pass", testedAt: "2026-11-03T00:00:00Z", checks: [] }) {
|
|
const member = (id: string) => ({ id, companyId: "company", name: id, adapterType: "paperclip_runner", adapterConfig: {}, metadata: { paperclip: { catalogTeam: { catalogId: "team" } } } });
|
|
const members = [member("qa"), member("coder")];
|
|
const probes = vi.fn(async (_path: string, body: { agentId?: string }) => body.agentId === "qa" ? missing : working);
|
|
const evidence = vi.fn(async (_name: string, _value: unknown) => {});
|
|
const api = {
|
|
get: async (path: string) => {
|
|
if (path === "/api/teams/catalog") return [{ id: "team", slug: "product-engineering", compatibility: "compatible", agentSlugs: ["qa", "senior-coder"] }];
|
|
if (path.endsWith("/agents")) return members;
|
|
if (path.endsWith("/config-revisions")) return [{ id: "working-revision" }];
|
|
if (path === "/api/agents/coder") return members[1];
|
|
if (path === "/api/auth/get-session") return { user: { id: "person" } };
|
|
if (["/projects", "/routines", "/teams/catalog/installed"].some(suffix => path.endsWith(suffix))) return [];
|
|
throw new Error("Unexpected setup read");
|
|
},
|
|
postSensitive: async (path: string, body: { agentId?: string }) => path.endsWith("/install")
|
|
? { portabilityImport: { agents: [{ id: "qa", slug: "qa" }, { id: "coder", slug: "senior-coder" }] } }
|
|
: probes(path, body),
|
|
patchSensitive: vi.fn(async (_path: string, _body: unknown) => {}),
|
|
post: vi.fn(async (_path: string) => {}), patch: vi.fn(async (_path: string, _body: unknown) => {}),
|
|
};
|
|
const ctx = { input: { api, evidence, nonce: "synthetic-team-prerequisite", workspacePath: "/synthetic/workspace", fixtures: { company: { id: "company" }, agent: { id: "ceo" }, environment: { id: "environment" }, secretRefs: {} }, execution: { profile: { credential: "OPENROUTER_API_KEY", buildAgent: () => ({ adapterType: "paperclip_runner", adapterConfig: { provider: "opencode" } }) }, environment: { id: "local" } } }, refreshIssue: async () => {}, issue: () => ({ id: "source" }) } as unknown as ChatCatalogContext;
|
|
return { ctx, evidence, probes, api };
|
|
}
|
|
const authWarning: Probe = { status: "warn", testedAt: "2026-11-03T00:00:00Z", checks: [{ code: "opencode_hello_probe_auth_required", level: "warn" }] };
|
|
it("the actual setup admits the adapter's exact missing-auth warning and preserves the independently passing member", async () => {
|
|
const f = setupFixture(authWarning), definition = teamConfigureExternalCases[0]!;
|
|
let state: Record<string, unknown> | undefined;
|
|
try {
|
|
state = await definition.setup(f.ctx);
|
|
expect(state.initialProbes).toEqual([{ agentId: "qa", ...authWarning }, { agentId: "coder", status: "pass", testedAt: authWarning.testedAt, checks: [] }]);
|
|
expect((await definition.verifySetup!(f.ctx, state)).passed).toBe(true);
|
|
expect(state.currentUserId).toBe("person");
|
|
expect(f.probes).toHaveBeenCalledTimes(2);
|
|
expect(f.evidence).toHaveBeenCalledWith("chat-catalog-team-initial-probes.json", { initialProbes: state.initialProbes });
|
|
expect(f.api.patchSensitive).toHaveBeenCalledTimes(1);
|
|
expect(f.api.patch).toHaveBeenCalledTimes(1);
|
|
} finally { await definition.cleanup!(f.ctx, state ?? {}); }
|
|
});
|
|
it("retains no provider messages or session fields in the precondition witness", async () => {
|
|
const canary = "synthetic-private-probe-content";
|
|
const raw = { ...authWarning, providerSession: canary, checks: authWarning.checks.map(check => ({ ...check, message: canary, detail: canary })) };
|
|
const f = setupFixture(raw), definition = teamConfigureExternalCases[0]!;
|
|
let state: Record<string, unknown> | undefined;
|
|
try {
|
|
state = await definition.setup(f.ctx);
|
|
expect(JSON.stringify(f.evidence.mock.calls)).not.toContain(canary);
|
|
expect(Object.keys((f.evidence.mock.calls[0]![1] as { initialProbes: object[] }).initialProbes[0]!).sort()).toEqual(["agentId", "checks", "status", "testedAt"]);
|
|
} finally { await definition.cleanup!(f.ctx, state ?? {}); }
|
|
});
|
|
it("names each member's observed readiness when the split does not form", async () => {
|
|
const f = setupFixture({ status: "fail", testedAt: authWarning.testedAt, checks: [{ code: "opencode_cwd_valid", level: "info" }, { code: "opencode_hello_probe_failed", level: "error" }] });
|
|
await expect(teamConfigureExternalCases[0]!.setup(f.ctx)).rejects.toThrow(
|
|
"Observed: qa (expected missing account): fail [opencode_hello_probe_failed:error]; coder (expected ready): pass");
|
|
});
|
|
it.each(["generic warning", "timeout", "model", "wrong level", "other error", "working warning", "working error"])("actual setup rejects %s and retains only closed probe fields before refusing", async fault => {
|
|
const missing = structuredClone(authWarning), working: Probe = { status: "pass", testedAt: authWarning.testedAt, checks: [] };
|
|
if (fault === "generic warning") missing.checks[0]!.code = "opencode_hello_probe_unexpected_output";
|
|
if (fault === "timeout") missing.checks[0]!.code = "opencode_hello_probe_timed_out";
|
|
if (fault === "model") missing.checks[0]!.code = "opencode_hello_probe_model_unavailable";
|
|
if (fault === "wrong level") missing.checks[0]!.level = "info";
|
|
if (fault === "other error") missing.checks.push({ code: "opencode_hello_probe_failed", level: "error" });
|
|
if (fault === "working warning") working.status = "warn";
|
|
if (fault === "working error") working.checks.push({ code: "opencode_hello_probe_failed", level: "error" });
|
|
const f = setupFixture(missing, working);
|
|
await expect(teamConfigureExternalCases[0]!.setup(f.ctx)).rejects.toThrow("actual per-member runtime probes");
|
|
expect(f.probes).toHaveBeenCalledTimes(2);
|
|
expect(f.evidence).toHaveBeenCalledTimes(1);
|
|
expect(f.evidence.mock.calls[0]![1]).toEqual({ initialProbes: [{ agentId: "qa", ...missing }, { agentId: "coder", ...working }] });
|
|
expect(f.api.post).not.toHaveBeenCalled();
|
|
});
|