mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-24 14:20:12 +01:00
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work
> - The server sends `agent.task_run` and `agent.task_completed`
telemetry. Each event has an `adapter_type` dimension with a fixed enum
in the generated telemetry contract.
> - #22324 made a Paperclip runner agent report its underlying harness
as `adapter_type`.
> - Seven harnesses that the runner can resolve to are not in the enum:
Copilot, Antigravity, AWS AgentCore, Claude Managed, Grok Bot, Muse and
OpenAI Dot. Delivery normalizes them to `other`, on open source and on
Cloud.
> - Thus, the adapter breakdown in analytics still has an `other` bucket
that no build can fix.
> - This pull request syncs the telemetry contract, which now lists the
seven harnesses, and sends Copilot as `copilot_runtime`.
> - The benefit is that every runner harness has its own `adapter_type`
value in analytics.
## Linked Issues or Issue Description
Refs #22324
**What happened?**
A Paperclip runner agent that uses Copilot, Antigravity, AWS AgentCore,
Claude Managed, Grok Bot, Muse or OpenAI Dot sends an `adapter_type`
value that is not in the generated contract enum. The value is
normalized to `other`. Copilot also sends `acpx:copilot`, which is not a
contract-style name.
**Expected behavior**
Each runner harness reports its own `adapter_type` value. Copilot
reports `copilot_runtime`, which is the name
`agentRuntimeSettingsHarness()` already uses.
**Steps to reproduce**
1. Create a Paperclip runner agent with `provider: "acpx"` and
`acpxAgent: "antigravity"` (or `"copilot"`).
2. Let the agent finish a run.
3. Look at the `agent.task_run` event. `adapter_type` is `other`.
**Paperclip version or commit**
`master` at 30881e6aa9.
## What Changed
- `packages/shared/src/telemetry/generated/paperclip-telemetry.ts`: sync
the generated contract. The `adapter_type` enum on `agent.task_run` and
`agent.task_completed` now lists `antigravity_runtime`,
`copilot_runtime`, `aws_agentcore`, `claude_managed`, `grok_bot`, `muse`
and `openai_dot`. The source schema changed in the telemetry backend
first, and the collector accepts these values once that change deploys.
- `server/src/services/agent-task-run-telemetry.ts`:
`telemetryAdapterType()` sends `copilot_runtime` for the `acpx:copilot`
harness. All other values are unchanged.
- `server/src/__tests__/agent-task-run-telemetry.test.ts`: the coverage
test now expects no runner harness to be missing from the contract.
Added Copilot and Antigravity cases to the runner `adapterType` table.
- `packages/shared/src/telemetry/README.md`: replace the list of known
gaps with the Copilot rename and the steps to add a new harness.
- `tests/runner-e2e/source-sdk-public-inputs.json`: refresh the pinned
inputs for the two changed shared files.
- Cloud direct delivery fixtures were regenerated with
`scripts/generate-posthog-direct-fixtures.mjs` from the updated backend.
No fixture changed.
## Verification
- Red/green: before the fix, 3 tests failed (`expected 'acpx:copilot' to
be 'copilot_runtime'`, and seven harnesses missing from both event
contracts). After the fix, `agent-task-run-telemetry.test.ts` passes
52/52.
- `npx vitest run server/src/__tests__/agent-task-run-telemetry.test.ts
server/src/__tests__/posthog-direct-telemetry.test.ts
packages/shared/src/telemetry`: 117 passed.
- `pnpm --filter @paperclipai/shared typecheck` and `pnpm --filter
@paperclipai/server typecheck`: pass.
- `pnpm verify` asked for broader coverage (exit 2) because the pinned
runner-e2e inputs changed. Required CI supplies that coverage.
## Risks
- Low risk. The change only adds enum values and renames one value that
delivery already dropped to `other`. Older collectors still accept the
events and normalize unknown values to `other`, so nothing is
quarantined while the backend deploys.
- Analytics: `copilot_runtime` replaces `other` for Copilot runner
agents. No dashboard filters on `acpx:copilot`, because that value never
reached analytics.
## Privacy Review
This is a Telemetry change under `rules/data-paths.mdc`. I request a
privacy review.
- Data added: seven new allowed values for the existing `adapter_type`
enum dimension on `agent.task_run` and `agent.task_completed`. They are
fixed harness names chosen by Paperclip code: `antigravity_runtime`,
`copilot_runtime`, `aws_agentcore`, `claude_managed`, `grok_bot`,
`muse`, `openai_dot`.
- No new field. No free text, user content, identifier, credential, URL
or host is added. The schema classification stays `non_personal`.
- These values were already sent from the app. Before this change the
receiving layer normalized them to `other`. After this change it keeps
the harness name.
- The generated contract and `packages/shared/src/telemetry/README.md`
are updated in this pull request.
## Model Used
Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, with tool use
(shell, file edits, PostHog HogQL queries).
## 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>
79 lines
4.3 KiB
TypeScript
79 lines
4.3 KiB
TypeScript
export type AgentRunnerChoice = "auto" | "paperclip" | "legacy";
|
|
export type AgentRunner = Exclude<AgentRunnerChoice, "auto">;
|
|
|
|
export interface AgentRunnerAvailability {
|
|
supportedRunners: AgentRunner[];
|
|
defaultRunner: AgentRunner;
|
|
}
|
|
|
|
export function paperclipRunnerProfileForHarness(harness: string): { provider: "codex" | "opencode" | "cursor_cloud" } | { provider: "acpx"; acpxAgent: "claude" | "pi" | "grok" } | undefined {
|
|
if (harness === "codex_local") return { provider: "codex" };
|
|
if (harness === "claude_local") return { provider: "acpx", acpxAgent: "claude" };
|
|
if (harness === "pi_local") return { provider: "acpx", acpxAgent: "pi" };
|
|
if (harness === "grok_local") return { provider: "acpx", acpxAgent: "grok" };
|
|
if (harness === "opencode_local") return { provider: "opencode" };
|
|
if (harness === "cursor_cloud") return { provider: "cursor_cloud" };
|
|
return undefined;
|
|
}
|
|
|
|
/**
|
|
* The lifecycle a new native agent stores. Codex, OpenCode and Claude store
|
|
* none, so the server applies the product default (warm on a local target for
|
|
* Codex and OpenCode). Other harnesses keep an explicit per_turn.
|
|
*/
|
|
export function paperclipRunnerCreationLifecycle(
|
|
profile: NonNullable<ReturnType<typeof paperclipRunnerProfileForHarness>>,
|
|
): { lifecycleMode?: "per_turn" } {
|
|
return profile.provider === "codex" || profile.provider === "opencode"
|
|
|| (profile.provider === "acpx" && profile.acpxAgent === "claude")
|
|
? {} : { lifecycleMode: "per_turn" };
|
|
}
|
|
|
|
export const PAPERCLIP_RUNNER_MINIMUM_GLIBC_VERSION = "2.39";
|
|
|
|
function supportsLinuxLibc(libc?: "glibc" | "musl" | "unknown", version?: string): boolean {
|
|
if (libc !== undefined && libc !== "glibc") return false;
|
|
if (version === undefined) return true;
|
|
const match = typeof version === "string" ? version.trim().match(/^(?:glibc\s+)?(\d+)\.(\d+)(?:\.\d+)?$/) : null;
|
|
if (!match) return false;
|
|
const major = Number(match[1]), minor = Number(match[2]);
|
|
if (!Number.isSafeInteger(major) || !Number.isSafeInteger(minor)) return false;
|
|
const [requiredMajor, requiredMinor] = PAPERCLIP_RUNNER_MINIMUM_GLIBC_VERSION.split(".").map(Number);
|
|
return major > requiredMajor! || (major === requiredMajor && minor >= requiredMinor!);
|
|
}
|
|
|
|
export function paperclipRunnerSupportsPlatform(harness: string, platform: string, architecture: string, libc?: "glibc" | "musl" | "unknown", glibcVersion?: string): boolean {
|
|
return !!paperclipRunnerProfileForHarness(harness)
|
|
&& (harness !== "grok_local" || (platform === "linux" && architecture === "x64") || (platform === "darwin" && architecture === "arm64"))
|
|
&& !(["opencode_local", "pi_local"].includes(harness) && platform === "linux" && architecture === "arm64")
|
|
&& ((platform === "linux" && supportsLinuxLibc(libc, glibcVersion) && (architecture === "x64" || architecture === "arm64"))
|
|
|| (platform === "darwin" && (architecture === "arm64" || architecture === "x64")));
|
|
}
|
|
|
|
export function agentHarnessType(adapterType: string, config: Record<string, unknown> = {}): string {
|
|
if (adapterType !== "paperclip_runner") return adapterType;
|
|
if (config.provider === undefined || config.provider === "codex") return "codex_local";
|
|
if (config.provider === "opencode") return "opencode_local";
|
|
if (config.provider === "acpx") {
|
|
const agent = config.acpxAgent ?? "claude";
|
|
return ({ codex: "codex_local", claude: "claude_local", grok: "grok_local", cursor: "cursor", pi: "pi_local", kimi: "kimi_local", antigravity: "antigravity_runtime" } as Record<string, string>)[String(agent)] ?? `acpx:${String(agent)}`;
|
|
}
|
|
return String(config.provider);
|
|
}
|
|
|
|
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, unknown> = {}): 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, unknown> = {}): string {
|
|
const harness = agentHarnessName(adapterType, config);
|
|
return harness === "cursor" ? "cursor_local" : harness;
|
|
}
|