Skip to content

chore(deps): upgrade pi to 1.2.0 - #723

Merged
Rinat S (rsolmano) merged 2 commits into
mainfrom
chore/pi-1.2
Oct 13, 2026
Merged

Rinat S (rsolmano) merged 2 commits into
mainfrom
chore/pi-1.2

Conversation

@rsolmano

@rsolmano Rinat S (rsolmano) commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Fresh installs of pi 1.1.0 stopped working on 2026-10-13: @earendil-works/pi-coding-agent@1.1.0 depends on
@earendil-works/pi-codemode@^1.1.0, which now resolves to the newly published 1.2.0, and 1.1.0's bundled
codemode tool imports MCP_TYPESCRIPT_PREAMBLE / mcpStructuredContentSchema that 1.2.0's
declarations entry no longer exports. The result is a SyntaxError on import under Node, so the
check:pi-packages parity gate (vanilla pi under Node) fails on every PR, including main.

Pi 1.2.0 also carries MCP fixes ThinkRail wants: cancelled/timed-out MCP calls are no longer sent after
an OAuth refresh, an unverifiable OAuth iss is rejected, servers with resources register their tools
without listing every resource first, and structuredContent accepts any JSON value.

Approach

Move the whole pinned pi family (pi-coding-agent, pi-ai, pi-agent-core, pi-tui) to exact 1.2.0 in
the root catalog so the transitive pi-mcp / pi-codemode / pi-telemetry resolve coherently. The
upgrade needs exactly one runtime adaptation:

  • pi-delegation preflight cancellation. Pi 1.2 counts a session busy from before_agent_start on and
    calls preflightResult inside that busy span, outside its try/finally. The old mechanism — throwing from
    preflightResult when the child's run was cancelled during preflight — therefore left the child busy
    forever (5 pi-delegation/pi-dag tests hung). A prompt whose run was cancelled is now dropped by an internal
    input handler every child loads after its own extensions: no user message is written, no request is
    made, and the child stays reusable. Cancellation is still reapplied at agent_start for the remaining
    window. Rationale is in packages/pi-delegation/SPEC.md.

Everything else was audited and intentionally left unchanged:

  • before_agent_start is now a union on messageType and also fires for extension-triggered runs. The
    five handlers (titleTool, pi-thinkrail-workflow, pi-todos, spec-graph, pi-subagents) only add
    system-prompt sections or re-register a tool and never read prompt, so applying them to custom-message
    runs is the behavior pi intends; the workflow test gained the discriminant and a custom-run case.
  • Theme schema validation does not apply (all loaders use noThemes; the headless theme is constructed
    directly). serializeConversation and the widened structuredContent need no code change here.
  • packages/server/src/agent/SPEC.md corrects the reload-gate wording for pi 1.2's busy-at-start semantics.

The MCP stack (#691–#695) is rebased on this branch and re-checks its pi adaptations against 1.2.0 in its
own commits; nothing MCP-specific lives here.

Changes

  • package.json catalog: pi family 1.1.0 → 1.2.0; bun.lock regenerated (pi-mcp, pi-codemode,
    pi-telemetry 1.2.0; @earendil-works/chord and the removed experimental packages leave the lockfile).
  • packages/pi-delegation/src/service.ts + SPEC.md: input-handler drop replaces the throwing
    preflightResult; extensionFactories is always passed.
  • packages/pi-thinkrail-workflow/index.test.ts + SPEC.md: messageType discriminant, custom-run coverage.
  • packages/server/src/agent/SPEC.md: reload-gate idle wording.
  • packages/pi-dag/extension/adapter.test.ts: the 128-node / >64 KiB snapshot test gets a 30 s budget. It runs in ~0.3 s locally
    but 1.1–8.4 s on CI runners (on main and on these branches alike) against Bun's 5 s default, and timed out twice in this
    PR's and the stack's CI runs; the assertion is unchanged.

Screenshots

Not applicable — no frontend changes.

Related issues

None.

Testing

All isolated: env -i, fresh HOME / PI_CODING_AGENT_DIR / THINKRAIL_DATA_DIR, PI_OFFLINE=1, pinned Bun 1.4.0, Node 22.19.0.

  • bun install → lockfile regenerated; bun run check:deps → OK (23 catalog entries)
  • bun run typecheck → 20/20; bun run lint → clean; check:boundaries / check:seams / check:spec-surface / check:compiler → green
  • bun run test → 20/20 package tasks, 0 failures (before the delegation fix: pi-delegation 2 and pi-dag 3 failed/hung)
  • bun run check:pi-packages → OK, pi 1.2.0 under Node 22.19 — the gate that fails on main today
  • bun run e2e (4 lanes, standard retries) → 542 passed + 1 flaky (chat-scroll touch-momentum, a known
    baseline flake that also reproduces on clean main; passed on retry)
  • bun apps/cli/scripts/build-binary.ts && bun run smoke:binary → passed
  • After rebasing onto main bf4da661 (fix(server): keep the attention dot off while background commands or subagents run #716): turbo run typecheck --filter='!@thinkrail/desktop' → 19/19 (the
    desktop electrobun prepare step was blocked by another local worktree's electrobun dev; it passed before the
    rebase and fix(server): keep the attention dot off while background commands or subagents run #716 does not touch desktop) and bun run test → see the CI run for this head; the rebased MCP stack
    built on this exact commit passed the complete bar again (gates 20/20, units 20/20, bun run e2e 551 passed + the same
    flaky, binary smoke)
  • Focused live specs on the rebased MCP stack that includes this commit:
    bun run e2e:full e2e/agent.live.spec.ts e2e/queue.live.spec.ts e2e/chat-resources.live.spec.ts e2e/tool-cards.live.spec.ts e2e/subagents.live.spec.ts → 11 passed
  • Independent focused review of the delegation change against installed 1.2 internals (session-id keying,
    handler scope/ordering, residual abort window) → no findings

Checklist

  • Fast gates pass: bun run lint, bun run typecheck, bun run test
  • E2E suite passes for app-affecting changes (bun run e2e, or bun run e2e:full when touching agent behavior)
  • Before/after screenshots are included for frontend changes, or marked not applicable
  • Relevant SPEC.md / top-level specs updated to reflect any boundary, contract, or behavior change
  • I have read the Contributing guide and agree to the Code of Conduct

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

🌐 Website preview

Preview retired when this pull request closed.

@jetbrains-air jetbrains-air Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved — ready to merge.

@jetbrains-air jetbrains-air Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved — ready to merge.

@rsolmano
Rinat S (rsolmano) added this pull request to the merge queue Oct 13, 2026
Merged via the queue into main with commit 1a782c8 Oct 13, 2026
19 checks passed
@rsolmano
Rinat S (rsolmano) deleted the chore/pi-1.2 branch October 13, 2026 11:55
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