Repository navigation
fix(agents): upgrade Pi to 1.5.0 - #2794
Closed
github-actions[bot] wants to merge 1 commit into
Closed
github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
Move every @earendil-works pin to 1.5.0 (peer ranges ~1.5.0) and adapt agents/harness/pi and the pi tool adapters: tool schemas move from pi-ai's removed TypeBox re-export to @earendil-works/pi-schema (new optional peer), PiSession.events() becomes watch() on Pi's conversation view, and retry() and the parked status are removed now that Pi ends restart-limited tasks. The three AgentEvent-based examples still need rewriting. Gardener-Operation: op_bed681da0c423c05b523abcc1f21a6cbc46ed74c1ca453d8c5db5dc43cd6a557:d943d9d686e2a78ebf729dd739f00a82af5cfb7de7b46bda0f3db4abfda66a3a
🦋 Changeset detectedLatest commit: 6c7a4cd The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
Author
|
Superseded by #2855. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Moves
agents/harness/pi,agents/models/pi-aiand the pi tool adapters from Pi 1.4.0 to Pi 1.5.0.@earendil-works/pi-ai@earendil-works/pi-durable@earendil-works/chord@earendil-works/pi-tui(dev, exact)@earendil-works/pi-telemetry,pi-agent-core(examples, experimental)@earendil-works/pi-schemachord,pi-ai,pi-durable~1.4.0~1.5.0Pi 1.5.0 came out on 2026-11-02, the only release since 1.4.0. Our
~1.4.0peer range doesn't cover it, so users can't install it withagentsyet. pi-durable 1.5 breaks its API in many places (durable changelog).Draft: the library, its tests and its docs are done and pass. Three example apps are built on
watchEvents()/AgentEvent, which Pi removed, and still need a client rewrite. See What's left.What changed upstream that affects us
@earendil-works/pi-schema… now that pi-ai itself no longer re-exports TypeBox" (release, 6536f801).import { Type } from "@earendil-works/pi-ai"stops compiling inharness/pi/skills.ts:1,browser/tools/pi.ts:2,web/fetch/tools/pi.ts:6,web/search/tools/pi.ts:6, plus test fixtures and examples. These now use pi-schema's builders, the replacement upstream's migration note names:watchEvents()and its typesAgentEvent,AgentEventStream,SnapshotEvent,MessageChange…" (durable changelog, f3255de7). Our publicPiSession.events()(harness/pi/harness.ts:969before) returnedwatchEvents()'s stream. It is replaced bywatch(), which returns Pi's own conversation view:events()are covered under What's left.Harness.retryTask(), therestart_limitblocked reason… and thetask_parkedreport… are removed" (durable changelog).pi.retryTask(harness.ts:497before) and therestart_limitcheck (harness.ts:832before) no longer compile. With parking gone, the code that worked around it has nothing left to do, so it is deleted:#parked(),retryParked(),PiHarness.retry(),PiSession.retry(), and the"parked"value ofPiPendingOperation.status(types.ts:78). A cut-off task now ends visibly: the tool gets an error result, or the run endsunanswered.session_failed→storage_failed, madedocs/agents/harnesses/pi.mdwrong (the call table, How recovery works, the tool example usingType, the install line). It now documentswatch(), Pi ending restart-limited tasks,task_interrupted,storage_failedand pi-schema.commit(batches, receive, context),runCounted). We get it throughregisterStorageConformance, andsession-store.test.tsnow runs 37 cases, up from 30, all passing. OurSqliteStoragecomes from pi-durable, so nothing of ours changes.whenIdle: "reject"on input submissions (#11149).tests-d/pi-durable-contract.test-d.ts:31requires every pi input option to be exposed or excluded on purpose. Not adopted: it is a new option and nothing forces it on us. It is excluded explicitly with a comment. Possible follow-up:PiSubmitOptions.whenIdle.ConversationTranscript,HarnessOptions.readOnly, continue submissions,maxTurns, run-end tasks,beforeProviderRequest,Usage.cost.totalFromProvider, GPT-6.1 Terra. Not adopted: all are new APIs that nothing forces on us. Users reach them throughharness.pi()or pi-ai directly.No effect on us (pi-durable, chord, pi-ai and pi-tui items: 40)
SqliteExecutor… gainsrunCounted": we use pi-durable's own SQLite storage; no customSqliteDatabase.Storage.commit()stores a group of commits in one call": no customStorage; the conformance suite passes.Storage.mintId()'s contract is narrowed": bundled storage.WatchHandle/WatchEnd… listeners take one change object… taggedWatchCall": our only watch iswatch()above; tests usecall.kind === "value".documentState(),viewState(),taskGraph()": unused.persistWithinMs": we don't usesubscribeCommits(); harness tests pass.FileSystem.watch()…WatchChange→FileChange" and "FileChangeis tagged…stop()": we don't usepi-durable/env.HostCallbackgainstelemetry": no switch over it.ConversationView.entriesis a window":messages()readsConversation.context(), not the view.Conversation.watch(context, window?)…ConversationWindow": passed through bywatch().pi.liveis no longer empty after a failed run… checkrun === undefined":busy()already checkslive?.run !== undefined(harness.ts).Observer<T>… shapes", "subscribeCommitsisobserveCommits": unused.HarnessOptions.onReport(report)takes oneReport": our factory leavesonReportto the host; only the examples pass it, with a single parameter that still compiles.DocumentCommitChangeis tagged": unused.CompactionStatus.reason…trigger": unused.TaskInspection.state…pending(wasready)": we only readsubmissionsfrominspect()now.SessionEnd… tagged bykind":#piClosingpassesclosedthrough without reading its reason.ReportFrom… tagged": unused.afterToolruns on every result": we register noafterTool.pi.tooltask": pi-internal.SubmissionRecordgains atype: \"continue\"":#resultalready returnsdonefor a non-inputrecord.RunFailureReasongainsnothing_to_answer,turn_limit,interrupted,restart_limit":PiOperationResult.reasonpasses pi's reason through.pi.live.runhas a requiredturnsfield": we never writepi.live.failed": unused.control.handoff…", memory-retention fixes (#9265),thinkingLevelon stored messages,__proto__partial-commit fix, rejected-commit publication, throwing telemetry adapter: pi-internal fixes.readresolving to\"\"for an image in Code Mode", Code Mode WASM import,tool_searchranking and non-ASCII tokenizing: built-in tools we don't register.models/pi-ai/wires/partial-arguments.tsstill usesparseStreamingJson, which is still exported;models/pi-aitests pass.Usage.cost.totalFromProvider": optional field; our wires compile and tests pass.responseModelmetadata":wires/chat-completions.ts:371already setsresponseModel.@cf/id in pi-ai 1.4's Workers AI catalog is missing from 1.5, and the ids our docs and examples use are still there.gpt-6.1-sol": coding-agent default; we pass models explicitly.const", Bedrock strict-tool fallback, OpenRouter cost and alias fixes, OpenCode endpoints, Zhipu 1308, LiteLLM overflow, Kimi K3.1, DeepSeek V4.1, GPT-5.4/5.5 namespace, Claude system-update and effort fixes: provider internals we don't wrap.No effect on us (coding agent, CLI and extensions: 55)
All of these are in
@earendil-works/pi-coding-agentor the terminal app, which we don't depend on: extension changelogs andcollapseChangelog; custom self-update command andpi updatefixes (--min-release-age, pnpm naming, Windowsgit clean, stale extension versions);pi.exec()maxBuffer/truncated, crash, SIGKILL, UTF-8 and spawn-error fixes; device-code login actions;keyText()/keyHint();MarkdownTransformContextids;ctx.ui.custom()blocked; extensions' TypeBox compat entry andTypeBoxAgentTool; tightened system prompt;/modelnames and search ranking;/resumesearch; MCP OAuth client registration and URL hardening;pi mcp login -l; glob DoS fix; saved "Do not trust"; Apple Terminal Shift+Enter; OSC 7501/133; SDK compaction OAuth;setActiveToolsordering; nestedpackage-lock.jsonthrough symlinks;fd/rgon ARM32; login URL and control-character hardening;tui.select.pageUp/pageDown; control-sequence parameters in tool output;pi -erefresh; Windows path casing;~prefix display; HTML export blank page and system messages; macOS bash abort; WSL helpers and external editor; codemode description summaries; fullscreen model-scope notice; deleted cwd; failed session writes;/treethinking level and context edits; hidden-thinking blank rows; npm audit advice; extension editor over a dialog;grepwith lone CR;--modelwith slashes; slow forking; failing package install at startup; todo example; undici and Gondolin bumps; image resizing JPEG-first;[Skill warnings]label; terminal title escapes; fullscreen double-click selection; removedsandbox/extension example.Decisions
~1.5.0) ofagents. pi-ai no longer exportsType, and upstream's migration is pi-schema'sobj()/str(). The alternative, plain JSON Schema literals, would type every tool'sargsasunknown. pi-durable already depends on pi-schema 1.5.0 exactly, so Pi users have it installed already.{ open: true }. pi-schema'sobj()is closed by default (additionalProperties: false), but TypeBox'sType.Objectwas open.open: truekeeps the schema the model sees, and the arguments we accept, as they were. Literal unions stayanyOfofconst(union([lit(...)])), as before.events()is replaced bywatch(context?, window?), not emulated. Pi removed the event stream on purpose ("a renderer renders state instead of assembling it from events"). Rebuilding events on top of views would be our own copy of a removed upstream API.watch()returns Pi'sConversationWatchunchanged.retry()and theparkedstatus are removed, not kept as no-ops. With parking gone,retry()could only returnfalse, which hides the change from callers. Removing it makes their code fail to compile, and the docs say what to do instead: submit again.retry()test (harness.test.ts,park:) is gone. The restart-limit test now asserts the operation settles,pending()empties, and no alarm or wake job is left. The events test now checks the view shows a run, then a tool, then idle, and that a latewatch()carries the same transcript asmessages(). Thesearch.test.tscast changed because pi-schema typespropertiesasunknown.minor. The peer range moves, andagents/harness/pi's public API changes.Needs a maintainer
ConversationTranscript; (b) for the channels example, map view changes toSessionEvents. Recommendation: (a) forharnesses/piandtools/browser(they shareprotocol.ts/view.ts/sockets.ts), because the ops carry the same text and tool deltas the events did. Then (b) for channels.retry()and theparkedstatus from a public API. Options: remove them (this PR), or keep them as deprecated no-ops for one release. Recommendation: remove, because Pi no longer parks anything, so a no-op would silently reportfalse.whenIdle: "reject". Options: add it toPiSubmitOptionsnow, or later. Recommendation: later, in its own PR. This PR only moves to 1.5.Affected open PRs
harness/pi/harness.ts,tests/worker.tsandtests/factory-fixture.ts, which this PR also changes (Type→ pi-schema,events(), parking removed). Its pi tools need pi-schema too.examples/next/harnesses/pi, whoseevents()/AgentEventprotocol Pi 1.5 removes.examples/next/harnesses/pifiles predate the current example and use pi-durable's event types.experimental/pi-recovery, which usespi-agent-core. That project typechecks on 1.5, so no conflict from the upgrade.Other changes
packages/agents/package.json: dev and peerchord/pi-ai/pi-durableto~1.5.0, devpi-tuito1.5.0, new dev + optional peer@earendil-works/pi-schema@~1.5.0.pnpm-workspace.yaml: thepi-agent-core>pi-aioverride to~1.5.0.pnpm-lock.yaml: regenerated bypnpm install. It resolves only 1.5.0 for every@earendil-works/*package, addspi-schemaand drops pi-ai'stypebox. The install also re-resolved the peer suffixes of the existing@opencode/*2.0.24 entries (ws,openai); their versions are unchanged.examples/next/{channels,harnesses/pi,models,tools/browser}/package.json,experimental/pi-recovery/package.json: pi pins to~1.5.0.channels,harnesses/piandmodelsalso add@earendil-works/pi-schemafor their tool schemas.examples/next/channels/src/pi/agent.ts,examples/next/models/src/pi.ts,examples/next/harnesses/pi/src/tests/worker.ts:Type→ pi-schema builders.examples/next/harnesses/pi/README.md: package-sources line to~1.5.0, and pi-schema added.docs/agents/harnesses/pi.md: as above.docs/agents/models-pi-ai.md:372: requiredpi-airange to~1.5.0.packages/agents/src/harness/pi/types.ts:PiPendingOperation.statusdropsparked; the header comment says "conversation views" instead of "events".harness.ts: thesession_failedcomment now saysstorage_failed; unused imports removed..changeset/pi-1-5.md:agentsminor, including the one-way note.Evidence
src/tests/models/pi-ai110/110, channels 144/144,examples/next/harnesses/pi9/9.packages/agentsfailed typecheck:Typemissing from pi-ai (6 files),watchEvents/AgentEventStream/AgentEventmissing,retryTaskmissing,restart_limitcomparison, and thewhenIdlecontract test.src/tests/models/pi-ai110/110, workerssrc/tests/models/pi-ai src/tests/web src/tests/browser618/618, channels 144/144.packages/agentsbuilds. All 9packages/agentstsconfigs typecheck (includingtests-d), and so doexamples/next/modelsandexperimental/pi-recovery.oxfmt --check .,oxlint .andsherifpass.check:exportsreportsagents - all exports valid; the other packages it lists were not built in this run.What's left
examples/next/harnesses/piandexamples/next/tools/browserdon't typecheck.src/protocol.ts,src/sockets.tsandsrc/view.tsimportAgentEvent,AgentEventStreamandMessageChange, and callsession.events().examples/next/harnesses/pi/src/tests/worker.ts(watch(),snapshotTexts()) does the same, so that example's tests can't pass yet. Cause: Pi 1.5 removed the event stream. Fix to try: change the socket protocol to sendConversationWatchvalues and ops, and rebuildview.tsonConversationTranscript.merge()pluspi.live(generation.message,tools,runFailure), following upstream's migration table.examples/next/channelsdoesn't typecheck.src/pi/channels-harness.tstranslatesAgentEvent/MessageChangeinto channelSessionEvents fromsession.events(). Fix to try: translate from conversation-view calls instead (text appends frompi.live.generation.message, tool slots frompi.live.tools, idle frompi.live.rungoing away).docs/agents/harnesses/pi.md:266(Run the example),examples/next/harnesses/pi/README.mdandNOTES.mdsay the example streamssession.events(). Update them together with the rewrite.Merge Danger
Door: one-way
Blast Radius: Pi users
Pi 1.5 migrates stored state as it writes.
pi.livegoes to version 3, and thepi.toolandpi.generationtasks to versions 3 and 2. Its changelog says "code built against version 1 cannot read a conversation this version wrote to", and an older Harness leaves the new tasks blocked (task_too_old). After a Durable Object runs this version, rollingagentsback to a Pi 1.4 build can't read its sessions. Users on~1.4.0get a peer-dependency warning until they move pi-ai, pi-durable and chord to 1.5 and install@earendil-works/pi-schema. Code that callssession.events(),retry(), or checks for theparkedstatus has to change.Opened by Gardener's
pi-upgradetask. Commits pushed by Gardener don't start CI: close and reopen this pull request, or push to it, to run it. Review comments are handled by Gardener'spr-review-fixtask.