Skip to content

fix(claude): support penstock run-token auth - #450

Merged
kkroo merged 1 commit into
masterfrom
omar/claude-penstock-run-token-auth
Jun 18, 2026
Merged

fix(claude): support penstock run-token auth#450
kkroo merged 1 commit into
masterfrom
omar/claude-penstock-run-token-auth

Conversation

@kkroo

@kkroo kkroo commented Jun 18, 2026

Copy link
Copy Markdown

Thinking Path

  • Paperclip is the control plane that schedules and supervises AI-agent workers.
  • The Claude local/k8s adapter constructs the environment used when a Paperclip run launches Claude Code.
  • Blockcast currently routes Claude traffic through ccrotate, and the next provider route may move under penstock.
  • The previous fix only recognized ccrotate Anthropic base URLs before copying the short-lived Paperclip run JWT into Claude's Anthropic auth env.
  • A future penstock route would therefore risk inheriting stale process-level Anthropic credentials again, causing the same malformed bearer-token failure.
  • This pull request generalizes the detection to Paperclip run-auth Anthropic proxy routes and includes both ccrotate and penstock markers.
  • The benefit is that the penstock transition keeps the same safe run-token authentication behavior without requiring long-lived agent config secrets.

Linked Issues or Issue Description

What happened?

The Claude adapter run-token auth shim introduced for ccrotate only recognized Anthropic base URLs containing ccrotate. If the Anthropic proxy path transitions to https://paperclip.blockcast.net/penstock or a penstock.* hostname, the adapter would not mirror PAPERCLIP_API_KEY into ANTHROPIC_AUTH_TOKEN / ANTHROPIC_API_KEY unless the agent explicitly configured those env vars.

Expected behavior

Claude runs should use the short-lived Paperclip run JWT for Paperclip-hosted Anthropic proxy routes, including both the current ccrotate route and the planned penstock route, while still preserving explicit agent-configured Anthropic auth.

Steps to reproduce

  1. Configure a Claude agent with ANTHROPIC_BASE_URL=https://paperclip.blockcast.net/penstock and no explicit Anthropic auth env vars.
  2. Launch a Paperclip Claude run from an environment that has stale process-level ANTHROPIC_AUTH_TOKEN / ANTHROPIC_API_KEY values.
  3. Observe that the pre-fix helper does not classify the penstock URL, so Claude would keep inherited credentials instead of the run JWT.

Paperclip version or commit

Regression risk introduced by 50bde90d252fc678982f74f4e11a408c7fdf3d5b before any penstock route rollout.

Deployment mode

Self-hosted Kubernetes server using the Claude local/k8s adapter.

What Changed

  • Renamed the ccrotate-specific helper to a Paperclip run-auth Anthropic proxy helper.
  • Added an explicit marker list for supported proxy routes: ccrotate and penstock.
  • Added regression coverage for ccrotate path, penstock path, penstock hostname, and explicit-auth preservation across both proxy names.

Verification

  • pnpm exec vitest run packages/adapters/claude-local/src/server/execute.remote.test.ts
  • pnpm --filter @paperclipai/adapter-claude-local typecheck
  • git diff --check

Risks

Low risk. The behavior is still limited to Anthropic base URLs containing one of the explicit proxy markers and only when a Paperclip run JWT exists. Explicit agent-configured Anthropic auth remains preserved.

For core feature work, check ROADMAP.md first and discuss it in #dev before opening the PR. Feature PRs that overlap with planned core work may need to be redirected — check the roadmap first. See CONTRIBUTING.md.

Model Used

OpenAI GPT-5 via Codex coding agent, with shell, Kubernetes, and GitHub tool use.

Checklist

  • I have included a thinking path that traces from project context to this change
  • I have specified the model used (with version and capability details)
  • I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work
  • I have searched GitHub for duplicate or related PRs and linked them above
  • I have either (a) linked existing issues with Fixes: # / Closes # / Refs # OR (b) described the issue in-PR following the relevant issue template
  • I have run tests locally and they pass
  • I have added or updated tests where applicable
  • If this change affects the UI, I have included before/after screenshots
  • I have updated relevant documentation to reflect my changes
  • 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
  • I will address all Greptile and reviewer comments before requesting merge

Co-Authored-By: Paperclip <noreply@paperclip.ing>
@kkroo
kkroo merged commit 04564c4 into master Jun 18, 2026
14 checks passed
@kkroo
kkroo deleted the omar/claude-penstock-run-token-auth branch June 18, 2026 07:35
@kkroo kkroo mentioned this pull request Jun 28, 2026
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant