Skip to content

Upgrade pi agent packages and Codex defaults#4702

Open
KyleAMathews wants to merge 3 commits into
mainfrom
upgrade-pi-agent-core-openai
Open

Upgrade pi agent packages and Codex defaults#4702
KyleAMathews wants to merge 3 commits into
mainfrom
upgrade-pi-agent-core-openai

Conversation

@KyleAMathews

Copy link
Copy Markdown
Contributor

Upgrade the agents runtime stack to the renamed Earendil Works pi packages and refresh the built-in Codex defaults to GPT-5.6 models. Users keep the same agents APIs, while the repo stops depending on deprecated @mariozechner/* packages in the core agents packages and affected examples.

Root Cause

The upstream pi-agent-core / pi-ai packages moved from @mariozechner/* to @earendil-works/*, and the newer pi-ai release carries the latest OpenAI SDK and Codex model catalog. The new pi-ai root entrypoint also moved away from the legacy global helpers this repo still uses, so the migration needs the package rename plus the compatibility entrypoint.

Approach

  • Replace core agents package imports and dependencies with:
    • @earendil-works/pi-agent-core@^0.80.5
    • @earendil-works/pi-ai@^0.80.5
  • Import the legacy global pi-ai helpers from @earendil-works/pi-ai/compat while leaving a full non-compat migration out of scope.
  • Update Codex defaults to the GPT-5.6 catalog exposed by pi-ai@0.80.5:
    • built-in Codex default: gpt-5.6-terra
    • low-cost Codex default: gpt-5.6-luna
    • desktop enabled defaults: gpt-5.6-terra and gpt-5.6-sol
  • Preserve public custom provider compatibility by typing runtime providers as ProviderId rather than only known built-ins.
  • Remove direct deprecated pi-agent-core dependencies from the agents examples and use @electric-ax/agents-runtime's exported AgentTool type instead.

Key Invariants

  • Existing runtime code that relies on getModel, getModels, streamSimple, or completeSimple continues to use the compatibility API.
  • Custom/faux provider ids remain valid public inputs through ProviderId.
  • Moonshot remains handled by the existing runtime special case.
  • Generated dist files are not committed; package builds regenerate them.

Non-goals

  • Do not migrate off @earendil-works/pi-ai/compat in this PR.
  • Do not introduce an internal import shim for the pi packages.
  • Do not commit generated runtime dist artifacts.

Trade-offs

Using the compat entrypoint keeps this PR focused on the package/model upgrade and avoids mixing in a larger ModelManager/provider-collection migration. The downside is that a future PR still needs to migrate to the new root pi-ai API, but this preserves behavior while unblocking the latest OpenAI/Codex catalog.

Verification

Passed:

pnpm --filter @electric-ax/agents-runtime typecheck
pnpm --filter @electric-ax/agents typecheck
pnpm --filter @electric-ax/agents-runtime test --run test/model-runner.test.ts
pnpm --filter @electric-ax/agents-runtime test --run test/pi-adapter.test.ts
pnpm --filter @electric-ax/agents-runtime test --run test/pi-adapter.test.ts test/model-runner.test.ts
pnpm --filter @electric-ax/agents build
GITHUB_BASE_REF=main node scripts/check-changeset.mjs

Attempted, but blocked by unrelated/pre-existing workspace/build-order or environment type issues:

pnpm --filter @electric-ax/agents-server typecheck
pnpm --filter @electric-ax/agents-desktop typecheck
pnpm --filter @electric-ax/example-agents-chat-starter typecheck
pnpm --filter @electric-ax/example-deep-survey typecheck

Observed failures included missing workspace package/type resolution for @electric-sql/client / @electric-ax/agents before package builds, and existing process.loadEnvFile / import.meta.dirname type support issues in examples.

Also ran:

pnpm install

with Node 24.11.1 to update the lockfile.

Files changed

  • .changeset/upgrade-pi-agent-core-openai.md — adds patch changesets for affected agents packages.
  • packages/agents-runtime/** — migrates pi imports/deps, uses ProviderId, updates low-cost Codex defaults/tests, and replaces an assistant-message cast with a type guard.
  • packages/agents/** — migrates pi imports/deps and updates built-in Codex defaults.
  • packages/agents-server/** and packages/agents-server-conformance-tests/** — migrates pi-agent-core imports/deps.
  • packages/agents-desktop/src/credentials/model-picker.ts — updates desktop default enabled Codex models to GPT-5.6 options.
  • examples/agents-chat-starter/** and examples/deep-survey/** — removes deprecated direct @mariozechner/pi-agent-core dependencies.
  • pnpm-lock.yaml — resolves the new Earendil Works packages and removes deprecated direct example deps.

@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Electric Agents Desktop Builds

Build artifacts for commit fa36b93.

Platform Status Artifact
macOS Apple Silicon Passed DMG
macOS Intel Passed DMG
Windows x64 Passed Installer
Linux x64 Passed AppImage / deb

Workflow run

@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.90909% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 60.04%. Comparing base (3ef7614) to head (85d4deb).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
packages/agents-runtime/src/model-runner.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4702      +/-   ##
==========================================
- Coverage   60.20%   60.04%   -0.16%     
==========================================
  Files         412      397      -15     
  Lines       44396    43771     -625     
  Branches    12586    12589       +3     
==========================================
- Hits        26727    26281     -446     
+ Misses      17587    17408     -179     
  Partials       82       82              
Flag Coverage Δ
electric-telemetry ?
elixir ?
packages/agents 72.64% <100.00%> (ø)
packages/agents-mcp 77.70% <ø> (ø)
packages/agents-mobile 80.67% <ø> (ø)
packages/agents-runtime 83.70% <90.00%> (-0.03%) ⬇️
packages/agents-server 75.67% <ø> (+0.02%) ⬆️
packages/agents-server-ui 8.32% <ø> (ø)
packages/electric-ax 51.06% <ø> (ø)
packages/experimental 87.73% <ø> (ø)
packages/react-hooks 86.48% <ø> (ø)
packages/start 82.83% <ø> (ø)
packages/typescript-client 91.78% <ø> (ø)
packages/y-electric 56.05% <ø> (ø)
typescript 60.04% <90.90%> (-0.01%) ⬇️
unit-tests 60.04% <90.90%> (-0.16%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Electric Agents Mobile Build

Local mobile checks ran for commit fa36b93.

The EAS Android preview build was skipped because the mobile-eas-build label is not present.
Add the mobile-eas-build label to this PR to produce an installable preview build.

Workflow run

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