diff --git a/packages/shared/src/agent-runner.ts b/packages/shared/src/agent-runner.ts index c4e9a7206d8..db11502d8a4 100644 --- a/packages/shared/src/agent-runner.ts +++ b/packages/shared/src/agent-runner.ts @@ -65,10 +65,14 @@ export function agentRunner(adapterType: string): AgentRunner { return adapterType === "paperclip_runner" ? "paperclip" : "legacy"; } +/** Product name of the harness an agent runs; reported as telemetry `adapter_type`. */ +export function agentHarnessName(adapterType: string, config: Record = {}): string { + const harness = agentHarnessType(adapterType, config); + return harness === "acpx:copilot" ? "copilot_runtime" : harness; +} + /** Stable configuration group across native and legacy execution backends. */ export function agentRuntimeSettingsHarness(adapterType: string, config: Record = {}): string { - const harness = agentHarnessType(adapterType, config); - if (harness === "acpx:copilot") return "copilot_runtime"; - if (harness === "cursor") return "cursor_local"; - return harness; + const harness = agentHarnessName(adapterType, config); + return harness === "cursor" ? "cursor_local" : harness; } diff --git a/packages/shared/src/index.ts b/packages/shared/src/index.ts index 92261d37eff..76a0b1a876d 100644 --- a/packages/shared/src/index.ts +++ b/packages/shared/src/index.ts @@ -3095,7 +3095,7 @@ export { type AntigravityThinkingLevel, } from "./antigravity-models.js"; export { ANTIGRAVITY_GENERATED_MODEL_CATALOG } from "./antigravity-models.generated.js"; -export { agentHarnessType, agentRuntimeSettingsHarness, agentRunner, paperclipRunnerCreationLifecycle, paperclipRunnerProfileForHarness, paperclipRunnerSupportsPlatform, PAPERCLIP_RUNNER_MINIMUM_GLIBC_VERSION, type AgentRunnerChoice, type AgentRunner, type AgentRunnerAvailability } from "./agent-runner.js"; +export { agentHarnessName, agentHarnessType, agentRuntimeSettingsHarness, agentRunner, paperclipRunnerCreationLifecycle, paperclipRunnerProfileForHarness, paperclipRunnerSupportsPlatform, PAPERCLIP_RUNNER_MINIMUM_GLIBC_VERSION, type AgentRunnerChoice, type AgentRunner, type AgentRunnerAvailability } from "./agent-runner.js"; export { normalizeClaudeRunnerOptions, type AgentConfigurationWarning } from "./runner-configuration-warnings.js"; export { EXTERNAL_AGENT_TOOL_GUIDANCE, DOT_AGENT_TOOL_GUIDANCE, GROK_BOT_AGENT_TOOL_GUIDANCE } from "./external-agent-guidance.js"; diff --git a/packages/shared/src/telemetry/README.md b/packages/shared/src/telemetry/README.md index 41b9c614005..04a42702f05 100644 --- a/packages/shared/src/telemetry/README.md +++ b/packages/shared/src/telemetry/README.md @@ -140,13 +140,13 @@ test fails when a code in those sets has no telemetry code. The `adapter_type` dimension on `agent.task_run` and `agent.task_completed` reports the harness the agent runs, as `agentHarnessType()` resolves it. A Paperclip runner agent therefore reports its underlying harness (for example -`claude_local` or `codex_local`), not `paperclip_runner`. Some runner harnesses -are not in the generated `adapter_type` enum yet: `acpx:copilot`, -`antigravity_runtime`, `aws_agentcore`, `claude_managed`, `grok_bot`, `muse`, -and `openai_dot`. The receiving layer reports them as `other` until the -contract lists them. A test in +`claude_local` or `codex_local`), not `paperclip_runner`. The one rename is the +Copilot harness: `agentHarnessType()` returns `acpx:copilot`, and telemetry +sends `copilot_runtime`, the name `agentRuntimeSettingsHarness()` also uses. +Every runner harness is in the generated `adapter_type` enum. A test in `server/src/__tests__/agent-task-run-telemetry.test.ts` fails when a runner -harness that is not in this list is missing from the contract. +harness is missing from the contract. Add it to the telemetry-backend schema +first, then copy the regenerated contract here. ## Product Lifecycle Events diff --git a/packages/shared/src/telemetry/generated/paperclip-telemetry.ts b/packages/shared/src/telemetry/generated/paperclip-telemetry.ts index 3d0f4e7c22a..033fd3d295e 100644 --- a/packages/shared/src/telemetry/generated/paperclip-telemetry.ts +++ b/packages/shared/src/telemetry/generated/paperclip-telemetry.ts @@ -11,7 +11,7 @@ agent_role: ("ceo" | "cto" | "cmo" | "cfo" | "security" | "engineer" | "designer } export interface PaperclipAgentTaskCompletedDimensions { -adapter_type: ("process" | "http" | "acpx_local" | "claude_local" | "codex_local" | "cursor_cloud" | "gemini_local" | "hermes_gateway" | "hermes_local" | "opencode_local" | "pi_local" | "cursor" | "openclaw_gateway" | "grok_local" | "kimi_local" | "other") +adapter_type: ("process" | "http" | "acpx_local" | "claude_local" | "codex_local" | "cursor_cloud" | "gemini_local" | "hermes_gateway" | "hermes_local" | "opencode_local" | "pi_local" | "cursor" | "openclaw_gateway" | "grok_local" | "kimi_local" | "antigravity_runtime" | "copilot_runtime" | "aws_agentcore" | "claude_managed" | "grok_bot" | "muse" | "openai_dot" | "other") agent_id: string agent_role: ("ceo" | "cto" | "cmo" | "cfo" | "security" | "engineer" | "designer" | "pm" | "qa" | "devops" | "researcher" | "general" | "other") model?: string @@ -19,7 +19,7 @@ task_id?: string } export interface PaperclipAgentTaskRunDimensions { -adapter_type?: ("process" | "http" | "acpx_local" | "claude_local" | "codex_local" | "cursor_cloud" | "gemini_local" | "hermes_gateway" | "hermes_local" | "opencode_local" | "pi_local" | "cursor" | "openclaw_gateway" | "grok_local" | "kimi_local" | "other") +adapter_type?: ("process" | "http" | "acpx_local" | "claude_local" | "codex_local" | "cursor_cloud" | "gemini_local" | "hermes_gateway" | "hermes_local" | "opencode_local" | "pi_local" | "cursor" | "openclaw_gateway" | "grok_local" | "kimi_local" | "antigravity_runtime" | "copilot_runtime" | "aws_agentcore" | "claude_managed" | "grok_bot" | "muse" | "openai_dot" | "other") agent_id: string agent_role?: ("ceo" | "cto" | "cmo" | "cfo" | "security" | "engineer" | "designer" | "pm" | "qa" | "devops" | "researcher" | "general" | "other") model?: string @@ -309,6 +309,13 @@ export const PAPERCLIP_ENUM_DESCRIPTIONS = { "openclaw_gateway": "Agent runtime uses the OpenClaw gateway adapter.", "grok_local": "Agent runtime uses the local Grok adapter.", "kimi_local": "Agent runtime uses the local Kimi adapter.", + "antigravity_runtime": "Agent runs Google Antigravity through the Paperclip runner.", + "copilot_runtime": "Agent runs GitHub Copilot through the Paperclip runner.", + "aws_agentcore": "Agent runs on AWS Bedrock AgentCore through the Paperclip runner.", + "claude_managed": "Agent runs on Claude Managed Agents through the Paperclip runner.", + "grok_bot": "Agent runs as Grok Bot through the Paperclip runner.", + "muse": "Agent runs Muse through the Paperclip runner.", + "openai_dot": "Agent runs OpenAI Dot through the Paperclip runner.", "other": "Fallback when the adapter type is unknown or not represented by the tracked enum." }, "agent_role": { @@ -344,6 +351,13 @@ export const PAPERCLIP_ENUM_DESCRIPTIONS = { "openclaw_gateway": "Agent runtime uses the OpenClaw gateway adapter.", "grok_local": "Agent runtime uses the local Grok adapter.", "kimi_local": "Agent runtime uses the local Kimi adapter.", + "antigravity_runtime": "Agent runs Google Antigravity through the Paperclip runner.", + "copilot_runtime": "Agent runs GitHub Copilot through the Paperclip runner.", + "aws_agentcore": "Agent runs on AWS Bedrock AgentCore through the Paperclip runner.", + "claude_managed": "Agent runs on Claude Managed Agents through the Paperclip runner.", + "grok_bot": "Agent runs as Grok Bot through the Paperclip runner.", + "muse": "Agent runs Muse through the Paperclip runner.", + "openai_dot": "Agent runs OpenAI Dot through the Paperclip runner.", "other": "Fallback when the adapter type is unknown or not represented by the tracked enum." }, "agent_role": { diff --git a/server/src/__tests__/agent-task-run-telemetry.test.ts b/server/src/__tests__/agent-task-run-telemetry.test.ts index fa762527e9e..dcc8dfaed38 100644 --- a/server/src/__tests__/agent-task-run-telemetry.test.ts +++ b/server/src/__tests__/agent-task-run-telemetry.test.ts @@ -382,6 +382,8 @@ describeEmbeddedPostgres("emitAgentTaskRun", () => { { adapterConfig: {}, adapterType: "codex_local" }, { adapterConfig: { provider: "acpx", acpxAgent: "claude" }, adapterType: "claude_local" }, { adapterConfig: { provider: "opencode" }, adapterType: "opencode_local" }, + { adapterConfig: { provider: "acpx", acpxAgent: "copilot" }, adapterType: "copilot_runtime" }, + { adapterConfig: { provider: "acpx", acpxAgent: "antigravity" }, adapterType: "antigravity_runtime" }, ])("reports a Paperclip runner agent's underlying harness $adapterType as adapterType", async ({ adapterConfig, adapterType }) => { await seedCompanyAndAgent({ adapterType: "paperclip_runner", adapterConfig }); const [run] = await db.insert(heartbeatRuns).values({ companyId, agentId, status: "succeeded" }).returning(); @@ -471,7 +473,7 @@ describe("agentRunFailureCause", () => { }); describe("Paperclip runner adapter_type coverage", () => { - it.each(["agent.task_run", "agent.task_completed"] as const)("lists every runner harness in the %s adapter_type contract except the known gaps", (event) => { + it.each(["agent.task_run", "agent.task_completed"] as const)("lists every runner harness in the %s adapter_type contract", (event) => { const contract = Object.keys(PAPERCLIP_ENUM_DESCRIPTIONS[event].adapter_type); const harnesses = [ ...Object.keys(PAPERCLIP_RUNNER_PERMISSION_CAPABILITIES) @@ -480,14 +482,33 @@ describe("Paperclip runner adapter_type coverage", () => { ...PAPERCLIP_RUNNER_ACPX_PROFILES.map(({ value }) => telemetryAdapterType({ adapterType: "paperclip_runner", adapterConfig: { provider: "acpx", acpxAgent: value } })), ]; - expect(harnesses.filter((harness) => !contract.includes(harness)).sort()).toEqual([ - "acpx:copilot", - "antigravity_runtime", - "aws_agentcore", - "claude_managed", - "grok_bot", - "muse", - "openai_dot", + expect(harnesses.filter((harness) => !contract.includes(harness)).sort()).toEqual([]); + }); + + it("reports each runner harness as its expected adapter_type", () => { + const reported = Object.fromEntries([ + ...Object.keys(PAPERCLIP_RUNNER_PERMISSION_CAPABILITIES) + .filter((provider) => provider !== "acpx") + .map((provider) => [provider, telemetryAdapterType({ adapterType: "paperclip_runner", adapterConfig: { provider } })]), + ...PAPERCLIP_RUNNER_ACPX_PROFILES.map(({ value }) => [`acpx:${value}`, telemetryAdapterType({ adapterType: "paperclip_runner", adapterConfig: { provider: "acpx", acpxAgent: value } })]), ]); + + expect(reported).toEqual({ + codex: "codex_local", + opencode: "opencode_local", + claude_managed: "claude_managed", + aws_agentcore: "aws_agentcore", + grok_bot: "grok_bot", + muse: "muse", + openai_dot: "openai_dot", + cursor_cloud: "cursor_cloud", + "acpx:grok": "grok_local", + "acpx:claude": "claude_local", + "acpx:cursor": "cursor", + "acpx:copilot": "copilot_runtime", + "acpx:pi": "pi_local", + "acpx:kimi": "kimi_local", + "acpx:antigravity": "antigravity_runtime", + }); }); }); diff --git a/server/src/services/agent-task-run-telemetry.ts b/server/src/services/agent-task-run-telemetry.ts index ceab7157111..eb75de4fec0 100644 --- a/server/src/services/agent-task-run-telemetry.ts +++ b/server/src/services/agent-task-run-telemetry.ts @@ -1,6 +1,6 @@ import { and, eq, sql } from "drizzle-orm"; import { agents, heartbeatRuns, issues, type Db } from "@paperclipai/db"; -import { agentHarnessType, requiresExecutionReconciliation } from "@paperclipai/shared"; +import { agentHarnessName, requiresExecutionReconciliation } from "@paperclipai/shared"; import { PERMANENT_FAILURE_CODES, RESTART_CLASS_FAILURE_CODES, SETUP_FAILURE_CODES } from "./continuation-cause.js"; import { trackAgentTaskRun } from "@paperclipai/shared/telemetry"; import { parseObject } from "../adapters/utils.js"; @@ -144,7 +144,7 @@ export function agentRunFailureCause(input: { } export function telemetryAdapterType(agent: { adapterType: string; adapterConfig: unknown }): string { - return agentHarnessType(agent.adapterType, parseObject(agent.adapterConfig)); + return agentHarnessName(agent.adapterType, parseObject(agent.adapterConfig)); } function providerFailureCategory(resultJson: unknown): string | null { diff --git a/tests/runner-e2e/source-sdk-public-inputs.json b/tests/runner-e2e/source-sdk-public-inputs.json index 958e426e798..7d6211cc0c3 100644 --- a/tests/runner-e2e/source-sdk-public-inputs.json +++ b/tests/runner-e2e/source-sdk-public-inputs.json @@ -56,7 +56,7 @@ "packages/shared/src/agent-observability.test.ts": "36cd74a8a8d1947364ec96fa30deabff14658df2", "packages/shared/src/agent-observability.ts": "52dc94e13624adeaf1aafa8996099a5dc158ef4b", "packages/shared/src/agent-runner.test.ts": "d02d0bba0cf57838011d4ec5f1304b65c15cff56", - "packages/shared/src/agent-runner.ts": "c4e9a7206d8c5cba7d9d95e7b02389cc351f3ecb", + "packages/shared/src/agent-runner.ts": "db11502d8a42961170badd4264aa3fe45a95049c", "packages/shared/src/agent-url-key.ts": "d0ec20b3ea1636a960bc5372a2c1e5a124bc5511", "packages/shared/src/aggregator-app-catalog.test.ts": "39ee377e55cc9565fce004b928bbe0998268e004", "packages/shared/src/aggregator-app-catalog.ts": "d6778b07a41356878c549d039ae316553ca9a22b", @@ -275,7 +275,7 @@ "packages/shared/src/home-paths.ts": "fa4f1c440653b76b3dbb7a51026d557287deb45d", "packages/shared/src/humanize-connection.test.ts": "ba9e90a44c63452b0bf9f733adb90241921e8eca", "packages/shared/src/humanize-connection.ts": "fbd414476a0ef7106a7c80d8572208781b091699", - "packages/shared/src/index.ts": "92261d37eff283b4eaac2566bab089d426e9f987", + "packages/shared/src/index.ts": "76a0b1a876d4ab010fdec130c267ddf5af5ba465", "packages/shared/src/issue-activity-identity.test.ts": "3dc294640f54c2be67943e3e0149cf4eff2c95ca", "packages/shared/src/issue-activity-identity.ts": "1b0f07ec3fe0506aaaf80a4fa9893f3baf8f0075", "packages/shared/src/issue-attribution.test.ts": "84563685e7f3c48029243cf1cc24a3a09ee3cde9", @@ -374,14 +374,14 @@ "packages/shared/src/standing-checks.ts": "7ab71e4b6984e41e1c1dfd1bddf0116041d5abf1", "packages/shared/src/subscriptions.ts": "ef70e63395ca967bbc30776b71560e96eb354a75", "packages/shared/src/summary-slot.test.ts": "5f8e222dea425f0d5bff0adb5c683087bd7cf7fb", - "packages/shared/src/telemetry/README.md": "41b9c614005d53b74b6a4c9c9a55c715e9144653", + "packages/shared/src/telemetry/README.md": "04a42702f053688a41bcea09a93f8f33d2c9aa5d", "packages/shared/src/telemetry/client-types.test.ts": "3b630edda4972b929ba4decd7457f226eb9cfc5b", "packages/shared/src/telemetry/client.test.ts": "5a95f2305a393c5b2e7750b10e0ed65da0f30cf8", "packages/shared/src/telemetry/client.ts": "d6534ce8aaa6f69fb2dd03e12487db024e250a96", "packages/shared/src/telemetry/config.ts": "dfcd4d692cc06e71cb77f70b44fc05721eb330d1", "packages/shared/src/telemetry/connector-events.test.ts": "c060017c7a6a26e67aea56e5c9e36059be527070", "packages/shared/src/telemetry/events.ts": "b7c7fa27da4bec5e207785bfa6793d9ceffaf4db", - "packages/shared/src/telemetry/generated/paperclip-telemetry.ts": "3d0f4e7c22a12937a07ca617e4e9093de6fb90e9", + "packages/shared/src/telemetry/generated/paperclip-telemetry.ts": "033fd3d295ebf5fbed2938f58b4e04e7f4a110fb", "packages/shared/src/telemetry/index.ts": "69e507a3d178c2daaa609f75b79f4cadfdc720af", "packages/shared/src/telemetry/product-events.test.ts": "d3182c7e18fbe9c2915497fc1e2048fb2a250a04", "packages/shared/src/telemetry/readme-contract.test.ts": "eec9d4511ddc3085a9af1a2dab6bf8487e49dfd7",