Repository navigation
v0.5.2
v0.5.2
PiG 0.5.2 is a bug-fix and Pi-catch-up release. It follows Pi v1.4.0. Install it with go install github.com/MichaelKinsy/PiG/cmd/pig@latest.
PiG is a Go implementation of Pi, the reference. Pi's behavior is the contract, and every place PiG differs is a numbered divergence. PiG is not an official Pi project, and Pi's maintainers have not endorsed it. It was created by Michael Kinsy and originally developed at Hewlett Packard Enterprise.
Thanks
This release has fixes that came straight from your reports and patches 🐷
- @JihongWEI reported #264 (a Node extension kept seeing a session entry the host had refused), #265 (MCP registration was quadratic in the number of tools) and #266 (CodeMode sandbox construction and discovery were quadratic, and discovery ignored cancellation). All three are fixed. Their report on headless MCP (#214) is also answered in this release.
- @liangzhiyu reported #271 and sent #270: two parallel
editcalls through two names of one file could lose an edit. Their commit is in the fix with their authorship kept. - @mblarsen sent #215, which makes
ctx.hasPendingMessages()ask the host (their commit is in this release, with their authorship), and reported #267, the/reloadstale-context error. - @ShoichiTect reported #259: prompts failing with "No model selected" after
/scoped-modelsand Ctrl+P. - @edersohe reported #260,
pig --list-modelsshowing different models than Pi. The client half is fixed here; see Known issues for the rest.
Fixes for reported issues
- #259: after
/scoped-modelsrefreshed the catalogs and Ctrl+P switched models, prompts failed with "No model selected". The scope now holds the Session's runtime-bound models, as Pi's selector does. - #260 (client half):
pig --list-modelsprints only the models the runtime reports as available, as Pi does. It used to add every bundled model of each provider with a key, so models a refreshed catalog had dropped came back. The hosted half of #260 is not part of this release. - #264: a Node extension no longer sees an appended entry the host refused (#272).
- #265, #266: MCP registration, CodeMode sandbox construction and tool discovery are linear in the number of tools. For a 100,000-tool catalog, sandbox construction went from 22.4 s to 40 ms and MCP registration after the last page from 53.2 s to 2.45 s on the reporter's repro programs (#268). Discovery stops when its context is cancelled.
- #267:
/reloadno longer reportsExtension "builtin:codemode" error: This extension ctx is stale after session replacement or reload.(#286). - #271: parallel
editcalls through a hard link or a case alias of one file are ordered, so neither edit is lost (#284, building on #270). Pi has the same lost edit for hard links, so this goes beyond Pi on purpose: divergence D190. - #215:
ctx.hasPendingMessages()reports a steering or follow-up message queued while a handler is awaited, as Pi's live getter does. - #245: opening a Durable store written by pi-durable 1.3.0 no longer leaves you unable to go back to it. PiG writes schema version 2, which no Pi release reads yet, so it first copies an older store to
<path>.schema-<N>.bak. Divergence D188 (#256).
Pi catch-up
- Pi 1.4.0, including client identity (
User-Agentand provider attribution), Rex terminal support (hyperlinks, true color, Kitty images),PI_CODEMODE_MAX_WORKERSand waiting for a free codemode worker,MiniMax-M3.1-Flash,gpt-6.1-solas the default GitHub Copilot model, HTTP 413 treated as context overflow, the retry classifier fixes,@autocomplete with regex characters,/compact <instructions>on a split turn, extension tools after resume and/tree, concurrent extension dialogs, terminal-mode restore on abnormal exit, unclosed$$math and tables, CJK Markdown emphasis, UTF-8 BOM inmcp.json. greprunsrg --no-configas Pi does, and a session recovered from a response cut off at the output limit omits the tool results of the truncated call (Pi 8c4e8738 and 02726086).- Image input for System One classifiers (Pi 7f225f25): codemode
models.classify()acceptsimagesfor the classifier models Pi 1.4.0 lists (Jev ontypesafeandcloudflare-workers-ai, Clef oncloudflare-workers-ai, OpenRouter decision models whose catalog lists image input), with thecompatfieldsimageInputandsendImageOptInHeader. - Divergences retired because Pi changed: D126 and D171.
Extension SDKs
- Go, Python and Rust extensions can create child agent sessions (
createAgentSession), constructSessionManager,SettingsManagerandModelRuntime, override a built-in tool and delegate to it, and use Pi's pi-ai helpers and pi-tui helpers.pi.exechonors an abort signal in every SDK. - Dialogs return the JSON value the client answered with, as Pi's do. This changes return types in Go, Python and Rust (see Upgrading).
- Extension tool calls of one parallel batch, and timer callbacks, reach the host and RPC clients in Pi's order. The wire field that carries this is recorded as D189 in
docs/additive-features.md. - A per-SDK ledger of every runtime export Pi serves to extensions is checked in CI (
docs/extension-sdk-exports.md).
Durable and Chord
- Durable: a crash-loop guard (a task cut off five times in a row without committing is parked,
HarnessSettings.RestartLimit), richerOnReportinformation,HarnessSettings.AfterFailedRun, and telemetry spans and metrics from Pi's telemetry commits. - Chord link protocol version 4, with the host API changes listed under Upgrading.
- Many concurrency fixes found by stress runs under the race detector (host manager, chord links, cache locks on file systems without locks, fork from file, packed cells).
Size and speed
Numbers below are the ones recorded in the changelog fragments, each from its own measurement.
- The root module
go installdownloads is about 184 MB, under the 185 MB budget that keeps it well inside Go's 500 MB limit. - The
pigbinary is 3.7 MB smaller (linux/amd64: 70,348,960 to 66,601,120 bytes). - Interactive sessions start with less memory (syntax grammars decode on first use), and idle sessions hold less.
- RPC and JSON mode, long sessions, and Anthropic and OpenAI Completions request building use less CPU per turn. Fragments give per-change figures.
Upgrading
Breaking changes for Go code and the SDKs (each has a before and after in the CHANGELOG):
chord/host:CreateHostneedsSelf;ConnecttakesConnectOptions;Host.Getwaits until ready (Host.Holdis the old behavior);GetOptions.Atis gone.chord/outputis a new package; the output buffer types moved there fromdurable/harness.durable/storage/sqlite:OptionsisSqliteStorageOptions; the Node options split intoNodeSqliteDatabaseOptions.ai:TelemetryContextisTelemetry;ai.PiUserAgentis gone (useai.FormatUserAgent).- Go SDK: dialog methods return
anyvalues;ModelRegistry.Findreturns an error;sdk.ReadonlySessionManagerreplacessdk.SessionManageras the type ofctx.SessionManager(). Rust:ModelRegistry::findreturnsio::Result<Option<Value>>;before_agent_starttakes a typed event.pig extension upgraderewrites what has one safe form and lists the rest. agent.SettleGateandextension.CallLaneare removed from the public API.- A Durable task cut off five times in a row is parked; set
RestartLimitto+Infto keep the old behavior.
Security
Two security events landed on 2026-10-20 and 2026-10-21, and this release answers both.
Update your own Node.js. Node.js published security releases on 2026-10-21 (22.23.4, 24.22.1 and 26.12.1). The four high severity issues are CVE-2026-105482 (dns.resolve truncates names that contain a NUL), CVE-2026-105483 and CVE-2026-106069 (TLS certificate hostname checks bypassed with fullwidth-digit and loosely resolving IP addresses) and CVE-2026-111497 (Brotli decoder out-of-bounds write that permits remote code execution). The advisory lists the medium and low issues too: https://nodejs.org/en/blog/vulnerability/october-2026-security-releases. PiG embeds no Node.js binary, so nothing in PiG's own build changes for you. The Node.js that runs your TypeScript and JavaScript extensions is the one you installed, so update it to 22.23.4, 24.22.1, 26.12.1 or later. PiG's CI, parity image and devcontainer moved to 24.22.1 (current 26.12.1).
eMudhra and emSign certificate authorities (D191). The private keys of eight eMudhra intermediate CAs can be recovered from their public certificates (Mozilla bug 2083449). Sectigo cross-signed the same keys, so some systems still trust chains through them, and Go clients check neither revocation nor Certificate Transparency. Mozilla also removed three emSign roots from NSS 3.131.1 (emSign ECC Root CA - G3, emSign Root CA - C1 and emSign ECC Root CA - C3). PiG's own TLS connections now refuse a chain through any of the eight intermediates (by public key, so the cross-signed paths are refused too) or any of the three roots. That covers model providers, OAuth, MCP, package and tool downloads, self-update, the Codex WebSocket and Bedrock, and the error names the CA. Go 1.27.3 already distrusts the eight intermediates. D191 adds the three roots, covers builds with an older Go (go.mod says go 1.26.0), and gives the clear error. D191 is an additive record in docs/additive-features.md, not a divergence from Pi. TLS that an extension process opens itself (Node, Python, Rust) is outside this check; for Node, the update above covers it.
Node.js 24.22.1 changes the microtask order of values().next() after a buffered byte-stream read, as Node 26.7.0 does. See Known issues.
Known issues
- PiG's Web Streams microtask models and goldens (
ai/testdata/node-microtasks) record Node 24.19.0 (oracle-node-version). Node 24.22.1, which CI now runs, orders one case differently (values-buffered/bytes); the live comparison is skipped on it. Moving the models to the new order is separate work. - Three Windows-only test failures (a Python test fixture's line endings, a Windows Pi comparison for OpenAI responses, and a conformance package timeout) are fixed after the release on main. They are tests only and change nothing you install.
- #260 is not closed: the model catalog route on pi-in-go.dev is hosted outside this repository.
Full changelog
See CHANGELOG.md (0.5.2 section). Thanks also to @sam-phinizy for #222, the v0.5.0 module zip report that 0.5.1 fixed.