Skip to content

feat(sdk): Add Pi runtime#318

Merged
dcramer merged 11 commits into
mainfrom
codex/pi-runtime-migration
May 14, 2026
Merged

feat(sdk): Add Pi runtime#318
dcramer merged 11 commits into
mainfrom
codex/pi-runtime-migration

Conversation

@dcramer
Copy link
Copy Markdown
Member

@dcramer dcramer commented May 14, 2026

Move Warden model execution to Pi as the default runtime.

Anthropic is moving SDK usage away from simple Claude subscriptions, so this PR puts Warden behind a runtime boundary and routes skill runs, structured extraction and repair, synthesis, and fix evaluation through Pi by default. Claude remains available as an explicit runtime for existing configs, but generated configs and this repo config now use runtime = "pi" with Pi model selectors such as anthropic/claude-sonnet-4-6 or openai/gpt-5.5.

The branch also updates the Action and CLI auth path around WARDEN-prefixed provider keys. Warden keeps WARDEN_* as the public env var contract, bridges those keys to provider SDK env names only at runtime, and records usage and cost on the same OTel GenAI attributes for both agent and structured model calls.

The bundled GitHub Action needed one packaging fix: ncc rewrites Pi dynamic imports for Node built-ins into rejected async contexts. Instead of carrying a pnpm patch, the action preloads Pi before Sentry/action startup and suppresses only those known synthetic missing-builtin rejections. The release-tag workflow also stages ncc-emitted chunks and WASM assets so the generated bundle is complete.

Fixes #269

Migrate the default Warden runtime from Claude Code to Pi so skill analysis can
use provider/model selectors such as openai/gpt-5.5. Keep Claude available as an
opt-in runtime.

Add the Pi adapter, WARDEN-prefixed provider env bridging, OTel GenAI telemetry,
usage accounting, runtime-aware helper calls, and docs/tests for the new defaults.

Co-Authored-By: GPT-5 Codex <noreply@anthropic.com>
Patch Pi's environment helper so ncc preserves native dynamic imports for node builtins. Add the OpenAI provider key to Warden's own PR workflow so WARDEN_MODEL can select GPT models without changing action inputs.

Co-Authored-By: GPT-5 Codex <noreply@anthropic.com>
Use the Anthropic model ID exposed by the current Pi registry for this repository's Warden review workflow. The org WARDEN_MODEL secret can contain names Pi does not expose yet, which fails every chunk before any provider call.

Co-Authored-By: GPT-5 Codex <noreply@anthropic.com>
@dcramer dcramer marked this pull request as ready for review May 14, 2026 16:16
Make the repository Warden config explicit about using the Pi runtime. This matches the new default path and keeps local pnpm CLI runs on the same runtime as the action.

Co-Authored-By: GPT-5 Codex <noreply@anthropic.com>
Remove the pnpm patch for Pi and keep the ncc workaround at the action entry point. The action now preloads the Pi runtime before normal startup so ncc's synthetic dynamic-import failures for Node built-ins do not terminate the bundle.

Also stage ncc-emitted WASM assets in the release bundle workflow and pin this repo's local Warden config to the Pi Sonnet model.

Co-Authored-By: GPT-5 Codex <noreply@anthropic.com>
Reject bare Pi model names so runtime config always resolves through the explicit provider/model selector that Pi expects. Update Warden reference examples to use the same shape.

Keep eval and live judge tests gated on ANTHROPIC_API_KEY only, since those tests are internal callers rather than Warden product configuration.

Co-Authored-By: GPT-5 Codex <noreply@anthropic.com>
Comment thread src/cli/commands/build.ts
dcramer and others added 2 commits May 14, 2026 11:14
Use Sentry GenAI token attributes directly and remove derived Warden-owned span fields for total tokens, tool counts, and tool elapsed time. Represent SDK-reported Claude tool elapsed time as the execute_tool span duration instead of a custom attribute.

Co-Authored-By: GPT-5 Codex <noreply@anthropic.com>
Allow workflow-level fix evaluation to run when the configured auxiliary runtime can authenticate without a legacy Anthropic API key. This preserves Claude auth enforcement while keeping Pi-backed OpenAI models from silently skipping fix evaluation.

Co-Authored-By: GPT-5 Codex <noreply@anthropic.com>
Fail early when the Pi runtime is configured with a bare model ID for generated-skill authoring or normal skill execution. Keep Claude runtime behavior unchanged and require users to provide the Pi provider/model selector explicitly.

Co-Authored-By: GPT-5 Codex <noreply@anthropic.com>
Remove stale telemetry spec entries for Warden-owned GenAI span fields that the implementation no longer emits. Also drop unsupported colon provider parsing and a redundant Pi read-only tools helper so the code follows the provider/model contract directly.

Co-Authored-By: GPT-5 Codex <noreply@anthropic.com>
Comment thread src/cli/main.ts
Emit the standard empty run log when Pi model selector validation fails before task creation. This keeps --json and --output callers from losing the failure artifact.

Co-Authored-By: GPT-5 Codex <noreply@anthropic.com>
@dcramer dcramer merged commit 8e38633 into main May 14, 2026
14 checks passed
@dcramer dcramer deleted the codex/pi-runtime-migration branch May 14, 2026 21:31
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.

Support Pi provider and configurable runtime capabilities

1 participant