Repository navigation
Version Packages - #3204
Version Packages#3204
Conversation
| "agents": "./dist/cli.js" | ||
| }, | ||
| "version": "0.34.0", | ||
| "version": "0.34.1", |
There was a problem hiding this comment.
🔴 Patch upgrade breaks Pi tool waits
The version bump lets apps on ^0.34.0 pick up Pi 1.6.1 support without changing their dependency range. Tools using the old sleep result still compile but return empty output instead of waiting for a signal.
Learn more
Agents 0.34.0 documented the { sleep: { signals, until } } tool result in its Tools that wait guide. A dependency range such as ^0.34.0 admits 0.34.1, which requires Pi 1.6.1 or a later patch in that minor series. The new runtime expects a kind: "sleep" result instead. An application that upgrades Agents and its Pi peers but leaves its tool unchanged gets an empty result rather than a parked call.
Example: An approval tool displays a question and returns { sleep: { signals: [approvalKey] } }. After the upgrade, the call completes empty before the user can answer instead of resuming when the answer arrives.
Recommended fix: Keep the legacy sleep result working on the 0.34 release line, or publish the incompatible Pi integration in a version outside the ^0.34.0 range. If retaining compatibility, add a runtime regression test that parks a legacy tool and resumes it on signal delivery.
Was this helpful? React with 👍 or 👎 to provide feedback.
|
✅ agents import sizes: no significant changes ( |
agents
@cloudflare/ai-chat
@cloudflare/codemode
hono-agents
@cloudflare/shell
@cloudflare/think
@cloudflare/voice
@cloudflare/worker-bundler
commit: |
* ci: release from release/** branches too Lets a fix ship from an earlier release's code while main carries unfinished work. A push runs the workflow file from the pushed branch, so this commit only has to be on the release branch. * fix(agents): support Pi 1.6.1, whose tool parks already reach agents 0.34 (#3171) * chore(agents): bump Pi to 1.6.1 Pi packages to ~1.6.1 (pi-tui 1.6.1 exact) in agents, the Pi examples and experimental/pi-recovery, and the pi-agent-core>pi-ai override to ~1.6.1. Pi 1.6.1 is a patch, but it ships everything on Pi main since 1.6.0, including tagged tool parks, so a fresh install of a released agents already picks it up. It stores pi.tool v4 and pi.generation v3 as 1.6.0 does, so rolling back to 1.6.0 stays safe. * fix(agents): word an error finish reason as pi-ai does on the chat-completions wire A chat-completions stream that ends with `finish_reason: "error"` now fails with pi-ai's own message, "Provider finish_reason: <reason>", instead of our "The model stopped with finish_reason ...". pi-ai's retry classifier matches "provider finish_reason: error" since earendil-works/pi@a00a504, so PiHarness retries such a mid-stream vendor failure, as Pi 1.6.1 does with its own openai-completions API. * docs(agents): park Pi tools and read signals with Pi's tagged forms earendil-works/pi@32c71a6 tags tool parks ({ kind: "sleep", ... }, flat) and SignalState ({ kind: "value" } or { kind: "expired" }). Every result field is optional, so the old { sleep: { ... } } still type-checks and Pi takes it as an empty result: the harness's parked-tool tests failed that way. The test tools and the pi.md samples now use the tagged forms; a beforeTool gate keeps { sleep: { ... } }. * test(agents): use a Groq model pi-ai still lists in the chat-completions tests Pi main drops Groq models that models.dev marks deprecated, including llama-3.1-8b-instant, so the fixture lookup threw. openai/gpt-oss-20b is listed with the same compat in Pi 1.6.0 and on Pi main. * fix(agents): record OpenRouter's native finish reason as pi-ai does on the chat-completions wire Pi main's openai-completions records OpenRouter's native_finish_reason (the upstream provider's own reason) in rawStopReason, e.g. error.MALFORMED_FUNCTION_CALL, and appends it to error messages after pi-ai's "Provider finish_reason:" prefix, so retry matching is unchanged. Our wire assembles the message itself, so it now sets rawStopReason and uses pi-ai's own OpenRouter helpers for the native reason. Needs the Pi release that ships utils/openrouter-finish-reason. * fix(agents): report every response to onResponse, failures included, as pi-ai does earendil-works/pi@8a57d42 makes pi-ai's onResponse fire for HTTP error responses and each retried attempt. pi-ai's Anthropic implementation now reports a vendor's error response through the gateway too, but AI Gateway's own failures (a gateway envelope, or any non-2xx from /run) threw before onResponse on all three wires. sendGateway now awaits the callback before it throws, the chat-completions and Responses wires report through it, and the Anthropic wire reports a response the SDK never sees because sendGateway threw. * fix(agents): read a large streamed SSE event in linear time earendil-works/pi@da7e26c fixes pi-ai's SSE readers rescanning an incomplete event on every chunk. sseDataStream, which the pi-ai chat-completions and Responses wires and the AI SDK provider read streams with, had the same cost: it ran its line regex over the whole buffer on each chunk, so an 8 MB event in 512-byte chunks took about 6 s. It now scans only the new text and joins an incomplete line once, when it ends. * test(agents): send no disabled thinking to a catalog Claude that cannot turn it off earendil-works/pi@433c1fd marks "off" unsupported on Claude Opus 5.5 and Sonnet 5.5 in pi's Cloudflare AI Gateway catalog, which reject thinking: { type: "disabled" } with a 400. The Anthropic wire reads the catalog's thinkingLevelMap through pi-ai, so the fix reaches it unchanged; this pins that a streamSimple call without reasoning sends no disabled thinking to anthropic/claude-opus-5.5 and still disables it on Haiku 5.5. On Pi 1.6.0's catalog the Opus call sends disabled. * chore(changeset): name Pi 1.6.1 and link its changelog * test(agents): run a Pi wake's alarm once it is armed instead of racing it Backports the harness.test.ts part of #3098 (e44ff29) onto release/0.34. On agents 0.34.0 the restarted-root test read the alarm while the wake its startup pushed was still pending, and failed about 2 runs in 5. It now runs that wake's alarm itself and waits for the fallback alarm to clear. * Version Packages (#3204) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Brings the Pi 1.6.1 support from cloudflare#3171, the 0.34.1 version and CHANGELOG from cloudflare#3204, and the release/** trigger in release.yml onto main, so main's next release builds on 0.34.1 and doesn't reuse its version or changeset. The one conflict, the restarted-root test in packages/agents/src/harness/pi/tests/harness.test.ts, takes release/0.34's version, which runs the wake's alarm instead of racing it.
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to release/0.34, this PR will be updated.
Releases
[email protected]
Patch Changes
9448cd8Thanks @ben-reitz! - Support Pi 1.6.1 (~1.6.1). Pi tools now park with{ kind: "sleep", signals, until }instead of{ sleep: { ... } }, and a signal's state is{ kind: "value", value }or{ kind: "expired" }; a tool that still returns the old shape compiles but ends with an empty result, so update parking tools when you upgrade.agents/models/pi-ainow matches pi-ai 1.6.1: a chat-completions stream that ends withfinish_reason: "error"fails with an error the Pi harness retries under its retry settings,rawStopReasonrecords the provider's reason (with OpenRouter'snative_finish_reason), an OpenRouterstopwith no output and a failing native reason is a retryable error, andonResponsesees every response, failures included. Theagents/modelsSSE decoder reads large streamed events in linear time. See pi-durable 1.6.1's changelog and Pi harness.@cloudflare/[email protected]
Patch Changes
9448cd8]: