refactor(runtime): register pi as a stub runtime - #6466
Conversation
Register PiRuntime (earendil-works/pi, CLI `pi`) in runtime.Resolve() following the OpenCode stub precedent (#6035): resolvable internally for dev/testing, deliberately NOT added to config.ValidRuntimes() — a selectable stub would burn pre-script side effects and a sandbox before failing — so it is not user-selectable via `fullsend admin install --runtime` until the runtime is functional. - internal/runtime/pi.go: Name "pi", System "pi" (multi-provider, OpenCode precedent), ConfigDir /sandbox/pi-config (new sandbox.SandboxPiConfig, outside the agent-writable workspace), EnvExports pinning PI_CODING_AGENT_DIR / PI_CODING_AGENT_SESSION_DIR to runner-owned paths plus PI_OFFLINE=1 and PI_SKIP_VERSION_CHECK=1; Bootstrap/Run and transcript extraction return explicit not-implemented errors (#6464). - images/sandbox/Containerfile: ARG PI_VERSION=0.84.2, npm install --ignore-scripts, with a renovate customManagers regex tracking the pin; the install comment records that pin bumps must re-verify the upcoming stream-parser fixtures (pi changed its --mode json shape within 0.84). - docs/runtimes.md: registered-runtimes row, pi (stub) column in the security feature matrix and the config-key support matrix. - Tests: pi_test.go (metadata, env exports, not-implemented, no-ops, capability defaults — no CLAUDE.md bridge, default debug-log name); registry and config tests extended with the resolvable-but-not-selectable cases. Next steps tracked in #6464: stream parser with recorded fixtures, Bootstrap/Run with the ADR 0090 hook-adapter extension, transcript extraction, then ValidRuntimes() enable. Refs #6464 Assisted-by: Claude Signed-off-by: Wayne Sun <gsun@redhat.com>
PR Summary by QodoRegister pi as a stub runtime backend (resolvable, not user-selectable)
AI Description
Diagram
High-Level Assessment
Files changed (9)
|
Site previewPreview: https://10b028a0-site.fullsend-ai.workers.dev Commit: |
|
🤖 Finished Review · ✅ Success · Started 9:17 PM UTC · Completed 9:33 PM UTC Commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Code Review by Qodo
1.
|
ReviewFindingsMedium
Low
Previous runReviewFindingsMedium
Low
Previous run (2)ReviewFindingsMedium
Low
Previous run (3)ReviewFindingsMedium
Low
|
# Conflicts: # docs/runtimes.md
|
🤖 Finished Review · ✅ Success · Started 11:41 PM UTC · Completed 11:57 PM UTC Commit: |
Bake pi's safety env vars (PI_OFFLINE, PI_SKIP_VERSION_CHECK, PI_CODING_AGENT_DIR/SESSION_DIR) into the sandbox image directly, since the binary ships to every sandbox regardless of runtime selection while PiRuntime.EnvExports() only runs once Bootstrap is implemented. Add a build-time Node engine check (pi requires >=22.19.0) so an incompatible base image fails loudly instead of silently. Disable renovate automerge for pi's version pin given its documented history of breaking --mode json wire changes within a minor. Align docs/runtimes.md's pi columns with OpenCode's existing phrasing for stub hook rows. Add missing pi test parity alongside existing opencode cases (config validation rejection, SandboxPiConfig pinning, capability-table coverage) and cite sources for env var/CLI-flag claims in code comments. Assisted-by: Claude (fix), Claude (review), Grok (review) Signed-off-by: Wayne Sun <gsun@redhat.com>
|
🤖 Finished Review · ✅ Success · Started 12:02 AM UTC · Completed 12:19 AM UTC Commit: |
Derive PiRuntime.EnvExports() paths from ConfigDir() via fmt.Sprintf (matching ClaudeRuntime's pattern) instead of a second raw reference to sandbox.SandboxPiConfig, so a future path change only needs one update. Pass nil (not ui.New(nil)) for the *ui.Printer param in TestPiRuntimeRun_NotImplemented, matching OpenCode's equivalent test. Assisted-by: Claude (fix), Claude (review) Signed-off-by: Wayne Sun <gsun@redhat.com>
|
🤖 Finished Review · ✅ Success · Started 12:24 AM UTC · Completed 12:41 AM UTC Commit: |
Brings in the hand-written pi stub: runner-owned config dir (sandbox.SandboxPiConfig, outside the agent-writable workspace), EnvExports pinning PI_CODING_AGENT_DIR / PI_CODING_AGENT_SESSION_DIR and disabling startup network traffic, the version-pinned pi CLI in the sandbox image with a renovate rule, and the matching stub tests. Conflict resolution: pi.go / pi_test.go take #6466's config-dir and env handling (which closes the in-workspace ConfigDir concern on this PR); docs/runtimes.md keeps this PR's source-cited pi columns; the not-implemented errors keep their "(see #6464)" pointer. Assisted-by: Claude (merge) Signed-off-by: Wayne Sun <gsun@redhat.com>
|
🤖 Finished Retro · ✅ Success · Started 12:57 AM UTC · Completed 1:07 AM UTC Commit: |
Retro: PR #6466 — register pi as a stub runtimeTimeline
What went well
Review gapThe fullsend-ai-review agent missed the Existing issues with new evidence
Proposals filed
|
Brings in the hand-written pi stub: runner-owned config dir (sandbox.SandboxPiConfig, outside the agent-writable workspace), EnvExports pinning PI_CODING_AGENT_DIR / PI_CODING_AGENT_SESSION_DIR and disabling startup network traffic, the version-pinned pi CLI in the sandbox image with a renovate rule, and the matching stub tests. Conflict resolution: pi.go / pi_test.go take #6466's config-dir and env handling (which closes the in-workspace ConfigDir concern on this PR); docs/runtimes.md keeps this PR's source-cited pi columns; the not-implemented errors keep their "(see #6464)" pointer. Assisted-by: Claude (merge) Signed-off-by: Wayne Sun <gsun@redhat.com>
Brings in the hand-written pi stub: runner-owned config dir (sandbox.SandboxPiConfig, outside the agent-writable workspace), EnvExports pinning PI_CODING_AGENT_DIR / PI_CODING_AGENT_SESSION_DIR and disabling startup network traffic, the version-pinned pi CLI in the sandbox image with a renovate rule, and the matching stub tests. Conflict resolution: pi.go / pi_test.go take #6466's config-dir and env handling (which closes the in-workspace ConfigDir concern on this PR); docs/runtimes.md keeps this PR's source-cited pi columns; the not-implemented errors keep their "(see #6464)" pointer. Assisted-by: Claude (merge) Signed-off-by: Wayne Sun <gsun@redhat.com>
Summary
Registers pi (earendil-works/pi) as a stub runtime — step 1 of the pi runtime plan (#6464), mirroring the OpenCode stub precedent (#6035). The stub is resolvable via
runtime.Resolve()for dev/testing but deliberately not inValidRuntimes()(a selectable stub would burn pre-script side effects + a sandbox before failing), and the pi CLI is version-pinned into the sandbox image so subsequent fixture-recording and Bootstrap/Run work runs against a reviewed version.Related Issue
Refs #6464
Changes
internal/runtime/pi.go—PiRuntimeimplementingRuntime+TranscriptHandleras explicit not-implemented stubs.System() = "pi"(multi-provider, same rationale as OpenCode's merged precedent).ConfigDir() = /sandbox/pi-config(newsandbox.SandboxPiConfig) — runner-owned, outside the agent-writable workspace, applying the lesson flagged on the OpenCode stub'sConfigDircomment from day one.EnvExports()pinsPI_CODING_AGENT_DIR/PI_CODING_AGENT_SESSION_DIRthere and setsPI_OFFLINE=1+PI_SKIP_VERSION_CHECK=1(no startup network traffic; does not affect inference).internal/runtime/registry.go—case "pi";ValidRuntimes()untouched.images/sandbox/Containerfile—ARG PI_VERSION=0.84.2+npm install -g --ignore-scripts @earendil-works/pi-coding-agent@${PI_VERSION}(upstream-recommended install; package shipsnpm-shrinkwrap.json);renovate.jsoncustomManagers regex tracks the ARG. The comment records that pin bumps must re-verify the upcoming stream-parser fixtures — pi changed its--mode jsonwire shape within 0.84.docs/runtimes.md— registered-runtimes row +pi (stub)column (allN/A — stub) in the security feature matrix and config-key support matrix.pi_test.go(metadata incl. config-dir-outside-workspace invariant, env exports, not-implemented errors, no-ops, capability defaults: no CLAUDE.md bridge, default debug-log name); registry + config tests extended with pi resolvable-but-not-selectable cases.Deliberately deferred to the Bootstrap/Run PR: the
anthropic-vertexprovider pin (upstream earendil-works/pi#5262 still open; community extension unchanged since July; and #6445 may change the image-install mechanism), thepi --mode jsonstream parser, and any runner wiring.Note: the
docs/runtimes.mdmatrix edits will need a trivial rebase if #6405 (which rewrites the Claude column cells) merges first — I'll rebase this branch when it lands.Testing
make lintpasses (staged first)go test ./internal/{runtime,config,sandbox}/...green;pi.gofunctions at 100% coverage; registry/config stub-bypass cases coveredpython -c "json.load(open('renovate.json'))"— renovate config valid JSON; regex mirrors theCLAUDE_CODE_VERSIONmanager@earendil-works/pi-coding-agent@0.84.2is the current npmlatestChecklist
refactor(runtime)— internal registration, no user-visible capability; same type as the OpenCode stub PR refactor(runtime): register opencode as a stub runtime #6035)