Repository navigation
Conversation
Pi repeats the message history on agent_end. Read large histories one message at a time to retain the last assistant outcome and willRetry. Confirm recovered results on agent_settled and keep usage accounting on the individual message_end events. Signed-off-by: Ben Kapner <benkapner@gmail.com>
|
🤖 Finished Review · ✅ Success · Started 6:32 PM UTC · Completed 6:42 PM UTC Commit: Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $1.58 |
|
Risk Assessment: moderate (2/5) DetailsSmall two-file bug fix with 50% test coverage and no protected paths, moderately elevated by recent fix churn in pi_progress.go and absence of a feature flag. Previous runRisk Assessment: moderate (2/5) DetailsSmall two-file bug fix with 50% test coverage and no protected paths, moderately elevated by recent fix churn in pi_progress.go and absence of a feature flag. |
|
Looks good to me Previous run<!-- fullsend:review-findings-v2:eyJ2ZXJzaW9uIjoyLCJhY3Rpb24iOiJhcHByb3ZlIiwiZmluZGluZ3MiOltdfQ== --> Looks good to me Previous run (2)<!-- fullsend:review-diff-hash:cd90016bd3b0aa2bf6b293acf4a4b38521d77e90734c62ff58d1d405bc776e23 --> Looks good to me Labels: The PR changes the Go Pi stream parser in the agent runner (internal/runtime). Previous run (3)<!-- fullsend:review-findings-v2:eyJ2ZXJzaW9uIjoyLCJhY3Rpb24iOiJhcHByb3ZlIiwiZmluZGluZ3MiOltdfQ== --> Looks good to me Labels: The PR changes the Go Pi stream parser in the agent runner (internal/runtime). |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
PR Summary by QodoRecognize oversized Pi agent_end events
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
|
🤖 Review · ❌ Terminated · Started 7:19 PM UTC · Ended 7:24 PM UTC Commit: |
Code Review by Qodo
1. Large earlier replies still fail runs
|
| if oversized { | ||
| // A single oversized assistant may have lost its message_end | ||
| // as well. Its stop reason cannot be recovered safely. | ||
| valid = piNonAssistantMessage.Match(message) |
There was a problem hiding this comment.
1. Large earlier replies still fail runs 🐞 Bug ≡ Correctness
readPiAgentEnd rejects the entire history when any assistant entry exceeds the buffer, even if a later, readable assistant entry contains the final outcome. If an earlier turn contains a large assistant message, the terminal event is discarded and a successfully settled run is reported as incomplete.
Agent Prompt
## Issue description
An oversized assistant entry earlier in `agent_end.messages` invalidates the entire event, even when a later assistant entry supplies a readable final outcome.
## Fix Focus Areas
- internal/runtime/pi_progress.go[110-130]
- internal/runtime/pi_progress.go[178-182]
- internal/runtime/pi_progress_test.go[493-498]
## Recommended Fix
Continue scanning after an oversized assistant entry and track whether the latest assistant remains unreadable. Clear that condition when a later valid assistant entry is read; reject the recovered event only if its final assistant outcome is unreadable. Add a test with an oversized earlier assistant followed by a small final assistant and `agent_settled`.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Superseded by updated review
|
🤖 Finished Review · ✅ Success · Started 7:19 PM UTC · Completed 7:24 PM UTC Commit: Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $0.70 |
Summary
Pi includes the full message history in
agent_end. Once that line exceeds 1 MiB, Fullsend can reportincompleteand exit 1 after Pi has finished successfully.Related Issue
Closes #9449.
Changes
willRetryflag.agent_settled. Turn counts, tokens, and cost still come from the individualmessage_endevents.Testing
make lintandmake go-vetpassed.-race, including retries, errors, aborts, and interrupted streams.PiRuntime.Run.mainexited 1 withincomplete. This branch exited 0 withstopand reported the same token counts and cost.Checklist