Skip to content

chore: sync reviewed upstream changes (batch 2) - #61

Merged
CoderDoubleflower merged 30 commits into
mainfrom
sync/upstream-batch2-20260805
Aug 5, 2026
Merged

chore: sync reviewed upstream changes (batch 2)#61
CoderDoubleflower merged 30 commits into
mainfrom
sync/upstream-batch2-20260805

Conversation

@CoderDoubleflower

Copy link
Copy Markdown
Owner

Integrate the second reviewed upstream batch from earendil-works/pi with semantic conflict handling.

Included upstream changes:

Required preservation:

  • pi-claude package identity and CLI branding
  • fullscreen-only UI behavior
  • Claude-style UI, TodoWrite, and Plan mode
  • remote compaction artifacts and fallback behavior
  • mid-turn compaction and Claude-style compaction UI
  • published npm runtime compatibility

The temporary integration workflow stops at the first conflict and records the exact files for semantic resolution.

CoderDoubleflower and others added 18 commits August 5, 2026 11:41
…imental-cli-composition

feat(coding-agent): compose experimental CLI commands

Upstream-Commit: 35fe555
…ion (earendil-works#7370)

* fix(coding-agent): preserve agent events during compaction

Manual compaction already waits for the active agent run to settle, and summary generation does not emit Agent events. Keep the agent subscription connected so unexpected concurrent events are not dropped, and remove the obsolete reconnect helper.

closes earendil-works#7253

Upstream-Commit: e56893f
…l-works#7540)

* fix(coding-agent): resume after context-limited length stops

Treat length stops as context overflow when prompt usage is within 1% of
Pi's configured context window. Include cache-write tokens in that usage
and allow non-zero output because OpenAI may emit reasoning tokens before
returning an incomplete response.

After compaction, remove any retryable error or truncated-length assistant
message restored from persisted session history so the interrupted agent
turn can continue.

This is specifically for handling this case for openai models:
https://developers.openai.com/api/docs/guides/reasoning

> If the generated tokens reach the context window limit or the max_output_tokens value you’ve set, you’ll receive a response with a status of incomplete and incomplete_details with reason set to max_output_tokens. This might occur before any visible output tokens are produced, meaning you could incur costs for input and reasoning tokens without receiving a visible response.

This detection currently assumes the reported prompt usage is within 1% of
the context window configured in Pi. Its reliability therefore depends on
Pi's model contextWindow metadata matching the provider's effective limit.

Maybe we should consider treating OpenAI incomplete responses as requiring compaction
regardless of the local context-window estimate?

fixes earendil-works#7020

* fix(coding-agent): recover truncated responses after compaction

Classify length stops by comparing provider-reported output usage with the model's intended output limit. Compact and retry once when generation ends below that limit, avoiding unreliable context-window estimates while preserving genuine max-output stops.

Normalize OpenAI Responses incomplete reasons so only max_output_tokens is treated as a length stop. Preserve qualified provider reasons for diagnostics, surface other reasons as errors, and use neutral truncation wording in the TUI.

Upstream-Commit: 32850ef
…7394)

Fixes earendil-works#7290

Co-authored-by: Mario Zechner <badlogicgames@gmail.com>

Upstream-Commit: a447534
@CoderDoubleflower
CoderDoubleflower marked this pull request as ready for review August 5, 2026 03:55
Copilot AI lite review requested due to automatic review settings August 5, 2026 03:55

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@CoderDoubleflower
CoderDoubleflower merged commit 23e5781 into main Aug 5, 2026
4 checks passed
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.

4 participants