mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-03 01:27:09 +01:00
Failed lifecycle verification could allocate another test environment every minute indefinitely. Count failed host verification tests separately from claims, persist a repair wait for confirmed configuration failures or three generic failed tests, and clear it through authorized retry or execution configuration changes. Preserve typed temporary execution-target failures through adapter checks so timeouts, transport failures and interrupted probes keep automatic recovery. Retain existing readiness, authorization, termination and cleanup gates. Document the policy and add real PostgreSQL persistence and actual OpenCode adapter regressions. Verified 398 focused tests (one Windows-only test skipped on macOS), repository-wide typecheck and build, structural checks, fully green current-head CI and Greptile 5/5 with no unresolved comments. Co-Authored-By: Paperclip <noreply@paperclip.ing>
53 lines
3.2 KiB
TypeScript
53 lines
3.2 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"],
|
|
["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("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();
|
|
});
|
|
});
|