Repository navigation
fix(agents): support Pi 1.5.1 - #2855
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 the pi-tui pin and the lockfile to Pi 1.5.1. Set pi-ai's two new openai-completions compat fields in the strict profile. Keep Anthropic message threads off for models routed through AI Gateway unless the model or the caller opts in. Gardener-Operation: op_7dd0beba0a96d266d1378795a9294a618524b3048bcbc0865f8466b6176d2d0b:63178bb40b15db8d47127cd2e8dc6e3da152e84d2473c56101813c60673e6e0e
🦋 Changeset detectedLatest commit: da24816 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 |
Comment on lines
+237
to
+240
| `sessionId` does not start Anthropic message threads here. pi-ai turns them on only for a model | ||
| whose `baseUrl` is `api.anthropic.com`, and this package sends that model through AI Gateway, so | ||
| each request carries the whole conversation. To thread anyway, set | ||
| `compat.supportsMessageThreads: true` on the model or `disableContinuation: false` on the call. |
Contributor
This was referenced Nov 10, 2026
Contributor
Author
|
Superseded by #2862. Pi 1.5.2 is out, and that pull request carries this one's fixes over unchanged and moves to 1.5.2. |
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/models/pi-ai,agents/harness/piand the pi tool adapters from Pi 1.5.0 to Pi 1.5.1.@earendil-works/pi-ai,pi-durable,chord,pi-schema,pi-codemode(lockfile; dev and peer ranges stay~1.5.0)@earendil-works/pi-tui(dev, exact)@earendil-works/pi-telemetry,pi-agent-core(examples, experimental; lockfile)Pi 1.5.1 came out on 2026-11-09. It is the only release since 1.5.0. It is a patch, so users on our
~1.5.0peer range already get it. Two things change for us. pi-ai's resolved openai-completions compat type has two new required fields, which breaks our typecheck. pi-ai also now threads Anthropic requests, which would change what our gateway wire sends. Both are fixed here.What changed upstream that affects us
compat.requiresNonNullAssistantContentfor OpenAI-compatible endpoints…" and "openai-completionsno longer sends\"tools\": []… setcompat.requiresToolsWithToolHistory: true" (release).convertMessages' compat parameter now requires both fields, soSTRICT_OPENAI_COMPAT(packages/agents/src/models/pi-ai/wires/chat-completions.ts:58) no longer compiles. 3 of the 9packages/agentstsconfigs fail. Both are set tofalse, pi-ai's own default, which keeps the requests we send unchanged:sessionId(andcacheRetentionnot\"none\") now use message threads… the server continues from the previous reply and pi sends only the new messages" (release, #11545). pi-ai enables threads whenmodel.provider === "anthropic" && model.baseUrl.includes("api.anthropic.com"). It keeps them off for gateways because "Gateways that drop unknown request fields would silently turn acontinueinto a request without the earlier conversation". Our Anthropic wire (packages/agents/src/models/pi-ai/wires/anthropic.ts) sends a model object from pi-ai'santhropicregistry (form 3 indocs/agents/models-pi-ai.md) through AI Gateway without changing the model. pi-ai therefore saw api.anthropic.com and started sendingthread: { type: "create" | "continue" }with only the new messages through the gateway. The new test shows it: with 1.5.1 and our old code, the body carriedthread: { type: 'create' }. Threads now stay off through the gateway, as for pi-ai's owncloudflare-ai-gatewaycatalog models, unless the model's compat or the caller asks for them (anthropic.ts:100,anthropic.ts:169):...options, ...(request.simple ? thinkingOptions(model, options) : {}), + disableContinuation: + options.disableContinuation ?? !messageThreadsRequested(model), client,docs/agents/models-pi-ai.md:237now says this, and names the two opt-ins.StreamOptions.disableContinuation(used above), the prompt cache warming helpers, thepi-ai/lazy-oauthandpi-ai/lazy-bedrock-providersubpaths,Provider.refreshModelsAuth,compat.promptCacheKeyMode, Claude Fable 5.2,qwen-token-plan-individual-cn, Microsoft-Decision-1; pi-durable'sTx.submission(id), per-conversationconfigure({ compaction })and read-only JSONL storage; pi-schema'sunsafe(),recursive(),Validator.validate(),equal()andbigint(); pi-codemode'sresolveSchemaRef(); pi-telemetry'stelemetryNow(); pi-agent-core'sdisableContinuationinstreamProxy(). Not adopted: these are new APIs and nothing makes us use them. Users can reach them throughharness.pi()or the packages themselves. Possible follow-up: expose per-conversation compaction settings onPiSession.No effect on us (31)
startWorker,createWorkersandhost.reload: we import onlychord/contextandchord/delta.git diff v1.5.0 v1.5.1 -- packages/chord/src/context packages/chord/src/deltais empty.remoteAddress,readSignedCookie,invalid/forbidden,usePageState,onErrorreports, live queries, messages, telemetry,TuiScope.optimistic, deny-by-default HTTP,not_readybeforeload, reload ordering, calls acrossloading, group commit, answer after state, worker lock/heartbeat/link fixes, WebSocket1009, terminal sandbox): Chord v2 runtime surfaces we don't import.SqliteStorage.commit()costs a few SQL statements per call…": we use pi-durable's own SQLite storage, and its conformance suite still passes inharness-pi.waiting, orcompleting…" (#11892): scheduler fix inside pi; harness tests pass.tool_searchnot finding a deferred tool… behind a local$ref" and the code modeURI malformedfix (#11803): pi-internal tool rendering and search.numberorintegerno longer acceptsNaN,Infinity…": JSON tool arguments can't carry these.undefinedis valid when its schema takesundefined": our tool schemas have no such property.$idfix (#11697),THIRD_PARTY_NOTICES/rename, faster checks: internal.URIErrorandconsole.*NaNfixes (#11901): internal to the runtime we import throughpi-codemode/cloudflare.renderTraceescapes control characters": output formatting only.channels144/144).openai-completionsno longer sends\"tools\": []" (the behaviour, apart from the type change above): our wire builds its own body and already sendstoolsonly when there are some (chat-completions.ts:549).session_id…" (#11639): our Responses wire builds its own request, withprompt_cache_keyandx-session-affinity.claude-sonnet-5gainscompat.supportsTemperature: false, which pi-ai's Anthropic implementation reads, so our wire gets the fix as it is. Otherwise the catalogs we import are unchanged: the same 19 Workers AI ids and 59 gateway ids.strict: \"prefer\"tools strict again…" (#11626): inside pi's Anthropic implementation, which our wire runs unchanged.$defs…" (#9557): same; request shaping is pi's.retryable-errorstests pass.Type.BigInt()andType.Undefined()": our tools use pi-schema builders without these types.$refs with a relative root$id": none of our schemas has an$id.anthropicprovider is now Claude Opus 5.5" and the other default-model moves (including Kimi K2.7 Code forcloudflare-workers-aiandcloudflare-ai-gateway): we never use pi's default models; our examples name their model ids explicitly.GrepOperations.readFilecallbacks are no longer called for context lines": coding-agent grep tool, which we don't use.streamProxy()option above;experimental/pi-recoverytypechecks.pi-coding-agent):pi auth login/logout,pi updatesummaries,cacheWarmingdefault"idle"and the combinedCache warmedline, Mermaid rendering andregisterMarkdownTransformer({ messageTypes }),ctx.ui.custom()blocked,/loginordering, Dart/Nix/Groovy/Gradle highlighting.globrelative topath, grep context from ripgrep, find/ls limits, find on Windows and its untrackedfd, read streaming, edit line endings, bash timeout exit code, powershell 5.1 exit code,tool_search/codemode$refsummaries.ctrl+ofor!/!!,!truncation notice,/treethinking level, paste markers, Ctrl+P scope, model selector jumps, extension overlays on/reload, selection dialog height,pi configkeybindings, Ctrl+V on Windows/WSL, edit diff indentation, session-tree cursor, prompts overlapping navigation.pi mcp list, MCP stdio/HTTP/SSE size and shutdown fixes, OAuth refresh on exit, symlinkedauth.jsonlocks,pi update --modelsOAuth, RPCctx.shutdown()and shutdown cleanup, SDK/RPC reload during a response, runtime disposal order, changelog prerelease versions, image resize worker abort on macOS.Decisions
~1.5.0; only the exactpi-tuipin and the lockfile move. The pin policy is~X.Y.0for peer and dev ranges, and~1.5.0already covers 1.5.1. The peer floor is not raised either. On 1.5.0 the newdisableContinuationoption is an unknown field pi ignores, and the two compat fields live in a private constant, soagentsstill works there.disableContinuation, not by rewriting the model's compat. The wire's rule (anthropic.ts:11) is that the model object reaches pi-ai unchanged.disableContinuationis the option upstream added for requests that must not use threads. A caller's explicitdisableContinuationand a model'scompat.supportsMessageThreads: trueboth still win. pi-ai keeps sending themessage-threads-2026-08-12beta header for such a session, and per pi "With the threads beta, a request withoutthreadis a normal request".false. That is pi-ai's own default for both, and it matches the strict OpenAI profile this constant describes:nullcontent on tool-only assistant messages, and notools: [].packages/agents/src/tests/models/pi-ai/anthropic.test.ts. One checks that asessionIdrequest through the gateway has nothreadfield. The other checks thatcompat.supportsMessageThreads: truestill getsthread: { type: "create" }.patch. Source of the publishedagentspackage changes; no peer range moves.github-actions[bot]committed to it, andmainis already on 1.5.0.Needs a maintainer
threadfield or returns thread rejections in the shape pi-ai's resend logic expects. If threads were on and a gateway droppedthread, the model would get only the new messages.Affected open PRs
mainalready resolves 1.5.0 and this PR moves to 1.5.1. It is closed as superseded after this PR opens.pnpm-lock.yamlandpackages/agents/package.json(different lines). Whichever merges second regenerates the lockfile withpnpm install..changeset/pi-1-5-1.md.harness/piandexamples/next/harnesses/pi, which this PR doesn't change, and 1.5.1 changes no pi-durable API they use.experimental/pi-recoverytypechecks on 1.5.1.Other changes
packages/agents/package.json: dev@earendil-works/pi-tui1.5.0→1.5.1.pnpm-lock.yaml: updated withpnpm update -r --no-save "@earendil-works/*"(no specifier changes). Every@earendil-works/*package now resolves only 1.5.1. Chord's entries gain areactpeer suffix, because chord 1.5.1 declares an optionalreact@19.3.0peer. No other package changed.docs/agents/models-pi-ai.md:237: the message-threads paragraph above.packages/agents/src/models/pi-ai/wires/anthropic.ts,wires/chat-completions.ts,src/tests/models/pi-ai/anthropic.test.ts: as above..changeset/pi-1-5-1.md:agentspatch.Evidence
src/tests/models/pi-ai src/tests/web src/tests/browser637/637, channels 144/144.packages/agentstsconfigs failed withTS2322atchat-completions.ts:58("missing … requiresNonNullAssistantContent, requiresToolsWithToolHistory"). The new gateway-threads test failed withexpected { type: 'create' } to be undefined.src/tests/models/pi-ai src/tests/web src/tests/browser639/639 (2 new), channels 144/144,examples/next/harnesses/pi17/17.packages/agentsbuilds. All 9packages/agentstsconfigs typecheck, and so doexamples/next/{channels,models,harnesses/pi,tools/browser}andexperimental/pi-recovery.oxfmt --check .,oxlint .andsherifpass.check:exportsreportsagents - all exports valid; it then stops athono-agents, which this run didn't build.Merge Danger
Door: two-way
Blast Radius: Pi users
1.5.1 changes no stored format: pi-durable's SQLite commit path writes the same rows with fewer statements, and no schema or transcript version moves, so rolling back to 1.5.0 is safe. Users on
~1.5.0get no new peer warning fromagents. pnpm may warn that chord 1.5.1's optionalreact@19.3.0peer doesn't match their React; it only matters for chord's React bindings, which we don't use. Users who pass a pi-aianthropicmodel object with asessionIdkeep sending whole conversations, as on 1.5.0.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.