Skip to content

build(agentic): upgrade pi to 1.4.0 - #1950

Merged
pyramation merged 3 commits into
mainfrom
feat/pi-1-4-0
Nov 3, 2026
Merged

pyramation merged 3 commits into
mainfrom
feat/pi-1-4-0

Conversation

@marslavish

Copy link
Copy Markdown
Contributor

Summary

  • @agentic-kit/run-log reads pi 1.4.0 system messages and stop reasons from transcripts.
  • @agentic-kit/pi and @agentic-kit/cli move to pi 1.4.0.
  • Pending and deferred model spans stay open in the span projector instead of closing early.

Dependents

The desktop (airpage) and constructive-db PRs depend on this PR and on the run-log publish that follows the merge. Lerna publishes new @agentic-kit/run-log, pi and cli versions from main. Versions are not bumped by hand here.

Test plan

  • agentic/run-log: build, lint, test (118 passed)
  • agentic/pi: build, lint, test (75 passed)
  • agentic/cli: build, lint, test (51 passed)

pi 1.4.0 persists the prompt and tool loadout as role: system message
entries. The pi reader skips them, so no projection carries the prompt
and none becomes an empty compaction summary. The entries stay in the
log verbatim, because pi rebuilds a resumed session by walking parentId
links and a missing entry would cut the history before it.

PiAssistantMessage.stopReason adds pending and deferred.
@agentic-kit/pi moves its dev dependency on pi-coding-agent to 1.4.0.
The peer floor stays >=0.79.0, because constructive-db still runs 0.79.6.
@agentic-kit/cli pins pi-coding-agent 1.4.0 exactly. Both build, lint
and test green with no source changes.
A pi 1.4.0 response with stop reason pending or deferred has not
arrived yet, so the turn did not end. The span projector gives such a
model span status open with no end, the same as an unsettled tool call.
@tenki-reviewer

tenki-reviewer Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Review complete. 🟡 2 medium

💬 Inline comments (1)

  • 🟡 aborted and unknown stopReasons map to ok — spans.ts:109
📍 Findings outside the diff (1) — 🟡 1 medium — defects on lines GitHub can't attach comments to

🟡 Medium — Superseded pending model span never gets closed · spans.ts:150–171 · unchanged line

// agentic/run-log/src/projectors/spans.ts
150	      if (event.kind === 'model-response') {
151	        const span: ModelSpan = {
152	          id: `model:${event.entryId ?? String(seq)}`,
153	          kind: 'model',
154	          name: event.model ?? 'model',
155	          // The turn began no earlier than the previous entry was written; with
156	          // no previous entry the interval is unknown and the span is a point.
157	          startedAt: previous ?? at,
158	          startSeq: seq,
159	          timing: 'bounded',
160	          status: modelStatus(event.stopReason),
161	          ...(event.model ? { model: event.model } : {}),

projectSpans builds a new ModelSpan for every model-response event (agentic/run-log/src/projectors/spans.ts:150-171) and leaves spans with stopReason pending/deferred open (agentic/run-log/src/projectors/spans.ts:111); nothing later closes an earlier open model span, so an aborted or superseded turn stays open forever with no endSeq/durationMs — a finished run rendered as in-flight, against the projector's own honesty rule. When a completed response follows a pending entry, a second span keyed model:${entryId} is pushed, and repeated tool calls push a second ToolSpan with the same tool:${toolCallId} key, breaking the span-id invariant for renderers. The same superseded pattern also interacts with dropAlreadyWritten entry-id dedupe in agentic/run-log-client/src/client.ts:479-489.


The change bumps agentic/pi and agentic/cli to pi-coding-agent 1.4.0 and updates agentic/run-log to handle the widened session-log schema, including the new system role, patched system messages (sections/toolsAdded), and the expanded stopReason union with pending/deferred values. Transcript reading (pi-reader, pi-entry) and span projection (spans.ts) were adjusted accordingly, and the test fixtures and suites were extended to cover the new shapes.

Files Change
agentic/pi/package.json, agentic/cli/package.json Version bump to pi-coding-agent 1.4.0 with matching dependency updates.
agentic/run-log/src/transcripts/pi-entry.ts, pi-reader.ts Transcript typing and reading updated for the system role, patched system messages, and widened stopReason values.
agentic/run-log/src/projectors/spans.ts Span open/close and status mapping adjusted for the new stop reasons.
agentic/run-log/src/index.ts Re-exports updated alongside the transcript changes.
agentic/run-log/__tests__/* Fixtures and test suites extended for the 1.4.0 entry shapes and new stop reasons.

Reviewed commit: 005d019

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​earendil-works/​pi-coding-agent@​0.79.6 ⏵ 1.4.075 +81009997 -1100

View full report

@tenki-reviewer tenki-reviewer Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This PR upgrades the agentic packages to pi-coding-agent 1.4.0 and adapts run-log transcript reading and span projection to the new entry shape.

Key findings

  • 🟡 aborted and unknown stopReasons map to ok — spans.ts:109
  • 🟡 Superseded pending model span never gets closed — spans.ts:150

Comment on lines +109 to +113
/** A pending or deferred response has not arrived yet, so its turn has not ended. */
const modelStatus = (stopReason: string | undefined): SpanStatus => {
if (stopReason === 'pending' || stopReason === 'deferred') return 'open';
return stopReason === 'error' ? 'error' : 'ok';
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 bug · medium

aborted and unknown stopReasons map to ok

The rewritten modelStatus helper (agentic/run-log/src/projectors/spans.ts:109-113) returns 'ok' for every stopReason except pending/deferred/error, so a user-aborted turn (stopReason: 'aborted', a member of the union at agentic/run-log/src/transcripts/pi-entry.ts:92) is closed with status: 'ok' and a duration. Unrecognized stopReasons from a newer writer are likewise flattened to success, unlike the projector's otherwise-explicit unknown handling. Trace consumers cannot distinguish a completed turn from a cancelled one.

📋 Prompt for AI Agents

In agentic/run-log/src/projectors/spans.ts at modelStatus (lines 109-113), map stopReason 'aborted' to a non-success status — either return 'error' or extend SpanStatus (line 31) with 'aborted' — and add a final branch for unrecognized stopReason values that keeps the span open or returns an 'unknown' status, so aborted and future stopReason semantics are not reported as success. Update spans projection tests to cover an 'aborted' entry and a fabricated stopReason value.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not changing this here. aborted already mapped to ok before this PR; only the pending/deferred branch is new. The raw stopReason stays on the span, so consumers can tell an aborted turn from a completed one. Adding an aborted status widens SpanStatus, which downstream consumers switch on, so it should be its own change.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The concern stands. The current diff still shows the same return stopReason === 'error' ? 'error' : 'ok' fallthrough, meaning 'aborted' maps to 'ok'. The argument that the raw stopReason field is still on the span is reasonable for consumers who inspect that field directly, but it does not address the semantic mismatch of status: 'ok' on an aborted turn — consumers switching on status alone will misread it as success. The fix (adding an explicit 'aborted' branch or an unknown-fallback) is not visible in this hunk. If it landed elsewhere in the file or in a related file, I will need more context to verify.

@marslavish

Copy link
Copy Markdown
Contributor Author

Reply to the out-of-diff finding about a superseded pending model span: not changing it in this PR. Nothing in pi 1.4.0 (pi-coding-agent, pi-ai) writes a settled entry that supersedes a pending one with a shared responseId. Any pairing rule would guess at an embedder's writer behavior. A model span that is still open is the intended signal that no response has arrived. The tool span id collision needs a repeated toolCallId, which is not a new pi 1.4.0 case. Happy to add pairing once a writer that emits the pair exists.

@marslavish marslavish changed the title build(agentic): upgrade pi to 1.4.0 and teach run-log its transcript shapes build(agentic): upgrade pi to 1.4.0 Nov 2, 2026
@pyramation
pyramation merged commit 870674e into main Nov 3, 2026
20 checks passed
@pyramation
pyramation deleted the feat/pi-1-4-0 branch November 3, 2026 03:05
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.

2 participants