mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-01 09:39:53 +01:00
## Thinking Path > - Paperclip verifies an agent's execution setup before it becomes ready. > - Native hello probes return a structured environment-test check. > - A timeout uses the check suffix `_hello_probe_timeout`. > - The lifecycle mapper only recognized the older `_hello_probe_timed_out` spelling. > - It therefore reported a native timeout as a generic test failure. > - This change maps both spellings to the existing timeout category. > - Operators receive the existing fixed timeout guidance without provider output. ## Linked Issues or Issue Description **What happened?** On current main, `testNativeRunnerAuthentication` emits `codex_hello_probe_timeout`. `assertHarnessTestPassed` classified it as `harness_test_failed` instead of `harness_probe_timed_out`. The OpenCode spelling in the unit table checks the generic suffix contract. It does not add or qualify a native OpenCode producer on current main. **Expected behavior** Recognize the native producer's timeout code. Keep the existing timeout category, legacy spelling, and fixed error text. **Steps to reproduce** Pass a failed environment result with the source-defined Codex timeout code to `assertHarnessTestPassed`. The added owner controls fail before the mapping change and pass afterward. The related open #16652 changes a legacy Claude probe timeout and UI behavior. It does not change this mapper. ## What Changed - Accept `_hello_probe_timeout` beside the existing `_hello_probe_timed_out` suffix. - Cover the actual Codex producer spelling, the forward-compatible OpenCode spelling, and a lookalike suffix that must remain a generic failure. - Retain existing authentication, model, command, directory, unexpected-output and success handling. ## Verification - The real owner unit suite produced **2 failing timeout cases and 25 passing controls** before the fix. The same suite passes **all 27 controls** after the fix under a focused local source-alias configuration. - Standard owning command: `pnpm --filter @paperclipai/server exec vitest run src/__tests__/agent-harness-verification.test.ts`. - Local scoped noEmit did not pass. Reused local dependency links produced ambient Express declarations, missing `tar-stream`, and mixed-source type errors. The initial load and typecheck failures are preserved. Normal remote CI must supply the final typecheck and build evidence. - `git diff --check` passes. The diff contains only the mapper and its existing unit test. - Exact-head normal CI passed on `db56f63`: 55 successful checks, two skipped checks and one neutral review check. Required `ci / verify`, `ci / e2e` and `ci / Build` passed. Greptile and the Paperclip reviewer both report 5/5 with no findings or open threads. No CI rerun was needed. Local noEmit setup remains a recorded limitation. - Native probes, model calls, databases, application builds and end-to-end journeys were not run locally. This source regression does not establish the cause of any recorded evaluation failure. ## Risks Low scope. The existing closed failure category changes for the native timeout spelling. A string that only contains that suffix in the middle still maps to generic failure. Authentication keeps priority. Failure text stays fixed. This change preserves lifecycle ownership, deferral, retry limits and deadlines. ## Model Used OpenAI GPT-6 through Codex, with source analysis and pure unit tests. The exact serving model ID and context-window size are not exposed to this worker. ## 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>
92 lines
5.5 KiB
TypeScript
92 lines
5.5 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import type { AdapterEnvironmentTestResult } from "@paperclipai/adapter-utils";
|
|
import { ADAPTER_AUTH_MISSING_CHECK_CODE } from "@paperclipai/shared";
|
|
import { assertHarnessTestPassed } from "../services/agent-harness-verification.js";
|
|
|
|
describe("saved harness verification", () => {
|
|
const result = (status: AdapterEnvironmentTestResult["status"], codes: string[]): AdapterEnvironmentTestResult => ({
|
|
adapterType: "test", status, testedAt: new Date().toISOString(),
|
|
checks: codes.map(code => ({ code, level: "info", message: code })),
|
|
});
|
|
it.each([
|
|
["opencode_hello_probe_auth_required", "harness_auth_failed"],
|
|
["opencode_hello_probe_model_unavailable", "harness_model_unavailable"],
|
|
["opencode_command_unresolvable", "harness_command_unavailable"],
|
|
["opencode_cwd_invalid", "harness_cwd_invalid"],
|
|
["opencode_hello_probe_timed_out", "harness_probe_timed_out"],
|
|
["codex_hello_probe_timeout", "harness_probe_timed_out"],
|
|
["opencode_hello_probe_timeout", "harness_probe_timed_out"],
|
|
["opencode_hello_probe_timeout_extra", "harness_test_failed"],
|
|
["opencode_hello_probe_unexpected_output", "harness_probe_unexpected_output"],
|
|
["private provider error", "harness_test_failed"],
|
|
])("classifies %s without keeping provider output", (checkCode, code) => {
|
|
try {
|
|
assertHarnessTestPassed(result("fail", [checkCode]));
|
|
expect.fail("Expected verification to fail");
|
|
} catch (error) {
|
|
expect(error).toMatchObject({ code, message: "The harness test failed" });
|
|
}
|
|
});
|
|
it("classifies a plugin Runner-task target without a managed AI connection before retryable checks", () => {
|
|
const refused = result("fail", ["ai_connection_required", "opencode_cwd_invalid"]);
|
|
refused.checks[1] = { ...refused.checks[1], level: "error", retryable: true };
|
|
expect(() => assertHarnessTestPassed(refused)).toThrow(expect.objectContaining({ code: "ai_connection_required" }));
|
|
});
|
|
it("preserves a retryable failed check before classifying configuration failures", () => {
|
|
const temporary = result("fail", ["opencode_cwd_invalid", "opencode_command_unresolvable"]);
|
|
temporary.checks[0] = { ...temporary.checks[0], level: "error", retryable: true };
|
|
expect(() => assertHarnessTestPassed(temporary)).toThrow(expect.objectContaining({ code: "test_environment_unavailable" }));
|
|
temporary.checks[0].level = "info";
|
|
expect(() => assertHarnessTestPassed(temporary)).toThrow(expect.objectContaining({ code: "harness_command_unavailable" }));
|
|
});
|
|
it.each([
|
|
["fail", []], ["warn", ["claude_hello_probe_auth_required"]],
|
|
["warn", ["gemini_hello_probe_timed_out"]], ["pass", ["claude_hello_probe_skipped_custom_command"]],
|
|
["warn", ["claude_acp_anthropic_api_key_detected", "claude_acp_login_probe_unavailable"]],
|
|
["warn", ["cli_version_probe_mismatch"]], ["pass", [ADAPTER_AUTH_MISSING_CHECK_CODE]],
|
|
["warn", ["claude_hello_probe_passed", "claude_hello_probe_auth_required"]],
|
|
["pass", ["COPILOT_AUTH_REQUIRED"]], ["fail", ["COPILOT_MODEL_UNAVAILABLE"]],
|
|
] as const)("rejects %s with %j", (status, codes) => {
|
|
expect(() => assertHarnessTestPassed(result(status, [...codes]))).toThrow("The harness test failed");
|
|
});
|
|
it.each([
|
|
["pass", ["process_command_available"]], ["warn", ["claude_hello_probe_passed", "optional_environment_warning"]],
|
|
["warn", ["claude_acp_anthropic_api_key_detected", "claude_hello_probe_passed"]],
|
|
["pass", ["codex_hello_probe_succeeded"]], ["warn", ["ai_connection_api_key_reverified"]],
|
|
["pass", ["copilot_metadata_verified"]], ["warn", ["copilot_metadata_verified"]],
|
|
] as const)("accepts %s with %j", (status, codes) => {
|
|
expect(() => assertHarnessTestPassed(result(status, [...codes]))).not.toThrow();
|
|
});
|
|
|
|
const cloudAccountResult = (modelListed = true): AdapterEnvironmentTestResult => ({
|
|
adapterType: "paperclip_runner", status: "warn", testedAt: new Date().toISOString(),
|
|
checks: [
|
|
{ code: "cursor_cloud_account_ready", level: "info", message: "The bound key can read its catalog. No prompt was sent." },
|
|
{ code: modelListed ? "cursor_cloud_model_listed" : "cursor_cloud_model_unlisted", level: modelListed ? "info" : "warn", message: "Exact model availability is decided by Cursor." },
|
|
{ code: "cursor_cloud_model_identity_unverified", level: "warn", message: "Cursor does not acknowledge the effective model." },
|
|
],
|
|
});
|
|
|
|
it.each([true, false])("admits an authenticated experimental Cloud account with model listed=%s", modelListed => {
|
|
expect(() => assertHarnessTestPassed(cloudAccountResult(modelListed))).not.toThrow();
|
|
});
|
|
|
|
it("keeps an unverified Cloud warning blocked without an informational account receipt", () => {
|
|
const unverified = cloudAccountResult();
|
|
unverified.checks[0].level = "warn";
|
|
expect(() => assertHarnessTestPassed(unverified)).toThrow("The harness test failed");
|
|
});
|
|
|
|
it("does not accept the Cloud receipt from an unrelated adapter", () => {
|
|
const unrelated = { ...cloudAccountResult(), adapterType: "test" };
|
|
expect(() => assertHarnessTestPassed(unrelated)).toThrow("The harness test failed");
|
|
});
|
|
|
|
it.each(["fail", "warn"] as const)("keeps a %s authentication failure blocked despite a Cloud account receipt", status => {
|
|
const failed = cloudAccountResult();
|
|
failed.status = status;
|
|
failed.checks.push({ code: ADAPTER_AUTH_MISSING_CHECK_CODE, level: "error", message: "Authentication required" });
|
|
expect(() => assertHarnessTestPassed(failed)).toThrow("The harness test failed");
|
|
});
|
|
});
|