Skip to content

fix(chat): tell unanswered output truncation to compact instead of retrying - #968

Merged
agegr merged 2 commits into
agegr:mainfrom
uvforce:pr/unanswered-truncation
Sep 30, 2026
Merged

agegr merged 2 commits into
agegr:mainfrom
uvforce:pr/unanswered-truncation

Conversation

@uvforce

@uvforce uvforce commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • When a response stops at length without text or a tool call, the notice no longer tells the user to send another message. That follow-up hits the same exhausted output budget.
  • The latest unanswered truncation explains this in English, Simplified Chinese, and Traditional Chinese, and offers the existing compact action. A partial answer still uses the old follow-up notice.
  • Compaction progress and a compaction error stay with that reply.

Test

  • node --experimental-strip-types --test components/MessageView.test.mjs

wayne.luo added 2 commits September 26, 2026 15:03
…trying

A length stop with no text or tool call has no room for another message.
Say so in English, Simplified Chinese, and Traditional Chinese, and offer
compaction on the latest unanswered reply.

agegr commented Sep 30, 2026

Copy link
Copy Markdown
Owner

Reviewed. The problem is real. pi clamps each request's output to the room left in the context (clampMaxTokensToContext: contextWindow − context − 4096), so a thinking-only reply that stops at length usually means the context is close to full or the thinking budget ate the ceiling. "Send a follow-up to continue" hits the same wall, and pointing to compaction or a lower thinking level is the right advice.

The rest also checks out:

  • hasAssistantAnswer() treats text, images or a tool call as an answer, so a partial answer keeps the old notice.
  • The inline Compact button only shows on the latest turn when nothing is streaming, and it reuses the existing handleCompact, isCompacting and compactError.
  • MessageView's memo comparator covers the new props.

Merged locally with current main (clean): tsc --noEmit, eslint, and the full unit suite (1324/1324) pass. CI (checks, e2e, demo build) is green. LGTM 👍

Optional nit, not blocking: an empty length reply with no thinking block at all (possible when the clamp leaves almost no output room) still reads "used up by thinking". Something like "The output limit was reached before any answer was produced…" would cover both cases.


Generated by Claude Code

@agegr
agegr merged commit 342fc9a into agegr:main Sep 30, 2026
4 checks passed
agegr pushed a commit that referenced this pull request Sep 30, 2026
Resolve the MessageView props conflict with #968: keep dropping
onNavigate (the edit branches on send now) and take the new
onCompact / isCompacting / compactError props.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q8e4GL1QSNFveKtnFfP3FZ
agegr added a commit that referenced this pull request Sep 30, 2026
* fix(open-in-explorer): authorize the path before looking at it

POST stat()ed the requested cwd before the allow-list check, so a path
outside the roots answered 400 (a file), 500 (missing) or 403 (a
directory) and told the caller whether it exists. Check the allow-list
first; isExistingFilePathAllowed() already requires the path to exist.

Also translate the new module's comments to English like the rest of the
codebase, note that macOS `open` launches .app bundles, and add the
route to the AGENTS.md file map.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q8e4GL1QSNFveKtnFfP3FZ

* refactor(subagents): share parseNpmSource through lib/npm-source

subagents.ts imported plugin-updates.ts only for parseNpmSource, which
pulled child_process, semver and the SDK package manager into the
session-reader import graph. Move the parser into a dependency-free
module that both use.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q8e4GL1QSNFveKtnFfP3FZ

* fix(chat): word the unanswered truncation notice for a full context too

A length stop with no answer is not always thinking's fault: pi clamps
the output to the room left in the context, so a nearly full context can
return nothing at all. Name both causes and drop the fixed "medium or
below" advice, which is wrong for sessions already on a low level.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q8e4GL1QSNFveKtnFfP3FZ

---------

Co-authored-by: Claude <[email protected]>
Kano-u pushed a commit to Kano-u/pi-web that referenced this pull request Oct 2, 2026
…#907 agegr#941 agegr#946 agegr#961 agegr#968 agegr#969 agegr#1007 agegr#1008 agegr#1009 agegr#1010)

上游已把我们提前摘取的 agegr#884 / agegr#871 / agegr#996 / agegr#961 原样合并(agegr#961 逐字节相同),
agegr#967 与 agegr#963 由上游的 agegr#1009 / agegr#1008 接管。

冲突解决:
- demo/ 对齐上游 fe288c0,撤销 agegr#963 对 demo 的两处改动(`@/lib/chat-phase-label`
  在 demo/lib 下不存在,会打断 Pages 构建)。
- AGENTS.md:保留我们的 default-project 条目,open-folder 换成上游的
  open-in-explorer。
- MessageView.tsx / SessionSidebar.tsx / FileExplorer.tsx:以上游为准,
  DismissButton 采用上游的独立文件,保留我们的思考卡片与文件管理改动。
- SessionSidebar 移除引用已删函数的旧 agegr#951 工作区按钮(agegr#951 的其他入口另行收尾)。
windli2018 pushed a commit to aiti-ai/aiti-ai that referenced this pull request Nov 6, 2026
…trying (agegr#968)

* fix(chat): tell unanswered output truncation to compact instead of retrying

A length stop with no text or tool call has no room for another message.
Say so in English, Simplified Chinese, and Traditional Chinese, and offer
compaction on the latest unanswered reply.

* fix(demo): keep the demo icon path while adding truncation recovery

---------

Co-authored-by: wayne.luo <[email protected]>
windli2018 pushed a commit to aiti-ai/aiti-ai that referenced this pull request Nov 6, 2026
* fix(open-in-explorer): authorize the path before looking at it

POST stat()ed the requested cwd before the allow-list check, so a path
outside the roots answered 400 (a file), 500 (missing) or 403 (a
directory) and told the caller whether it exists. Check the allow-list
first; isExistingFilePathAllowed() already requires the path to exist.

Also translate the new module's comments to English like the rest of the
codebase, note that macOS `open` launches .app bundles, and add the
route to the AGENTS.md file map.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q8e4GL1QSNFveKtnFfP3FZ

* refactor(subagents): share parseNpmSource through lib/npm-source

subagents.ts imported plugin-updates.ts only for parseNpmSource, which
pulled child_process, semver and the SDK package manager into the
session-reader import graph. Move the parser into a dependency-free
module that both use.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q8e4GL1QSNFveKtnFfP3FZ

* fix(chat): word the unanswered truncation notice for a full context too

A length stop with no answer is not always thinking's fault: pi clamps
the output to the room left in the context, so a nearly full context can
return nothing at all. Name both causes and drop the fixed "medium or
below" advice, which is wrong for sessions already on a low level.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q8e4GL1QSNFveKtnFfP3FZ

---------

Co-authored-by: Claude <[email protected]>
windli2018 pushed a commit to aiti-ai/aiti-ai that referenced this pull request Nov 8, 2026
…trying (agegr#968)

* fix(chat): tell unanswered output truncation to compact instead of retrying

A length stop with no text or tool call has no room for another message.
Say so in English, Simplified Chinese, and Traditional Chinese, and offer
compaction on the latest unanswered reply.

* fix(demo): keep the demo icon path while adding truncation recovery

---------

Co-authored-by: wayne.luo <[email protected]>
windli2018 pushed a commit to aiti-ai/aiti-ai that referenced this pull request Nov 8, 2026
* fix(open-in-explorer): authorize the path before looking at it

POST stat()ed the requested cwd before the allow-list check, so a path
outside the roots answered 400 (a file), 500 (missing) or 403 (a
directory) and told the caller whether it exists. Check the allow-list
first; isExistingFilePathAllowed() already requires the path to exist.

Also translate the new module's comments to English like the rest of the
codebase, note that macOS `open` launches .app bundles, and add the
route to the AGENTS.md file map.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q8e4GL1QSNFveKtnFfP3FZ

* refactor(subagents): share parseNpmSource through lib/npm-source

subagents.ts imported plugin-updates.ts only for parseNpmSource, which
pulled child_process, semver and the SDK package manager into the
session-reader import graph. Move the parser into a dependency-free
module that both use.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q8e4GL1QSNFveKtnFfP3FZ

* fix(chat): word the unanswered truncation notice for a full context too

A length stop with no answer is not always thinking's fault: pi clamps
the output to the room left in the context, so a nearly full context can
return nothing at all. Name both causes and drop the fixed "medium or
below" advice, which is wrong for sessions already on a low level.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q8e4GL1QSNFveKtnFfP3FZ

---------

Co-authored-by: Claude <[email protected]>
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