fix(pi): 修复长首轮 prompt 投递 - #564
Merged
deepcoldy merged 2 commits intoJul 23, 2026
Merged
Conversation
长首轮 prompt 改用 @file positional 参数传给 Pi,避免 TUI paste 拆成多轮 user message。 同时补充隐藏运行上下文防线与 focused 回归测试。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Justin1989
force-pushed
the
wt/claude-botmux-pi-prompt
branch
from
July 23, 2026 02:13
02950e8 to
efd8d85
Compare
Owner
|
已修复独立复核发现的两个阻塞项,提交: 修复摘要
验证
代码已推送到 PR head 分支;未合码。 |
Owner
Pi 独立三审与合并结果(head
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改动
@/path/to/*.prompt.mdpositional 参数启动 Pi。SESSION_DATA_DIR时 fail closed,避免退回 paste 导致上下文刷屏。buildArgs()前执行 adapter 级首轮 prompt 预处理,并把 prompt 文件目录加入 Linux sandbox readonly roots;session 清理时 best-effort 删除生成文件。<user_message>。@file投递、adapter args、no TUI queue fallback、短 prompt 行为和 routing 防御文案。为什么
Pi TUI 在长多行首轮 prompt 通过 paste + Enter 投递时会把 botmux 启动上下文拆成多轮 user message,模型会把
botmux_routing、identity、builtin skills 等隐藏上下文碎片误判为真实请求并连续回复“已了解/已补充”。Pi 支持pi [options] [@files...] [messages...],因此长 prompt 用@file可以保持单个完整初始 user turn。影响面
prepareInitialPromptArghook,启动方式不变。.botmux隐藏策略遮住@file。验证
pnpm vitest run --project unit test/pi-initial-prompt.test.ts test/startup-commands.test.ts test/prompt-builder.test.ts:69 passedpnpm build:通过pnpm switch:here && pnpm daemon:restart,用当前 checkout 部署 live daemon 后在飞书 @pi 做长 prompt 回归验证:Pi 返回唯一 markerpi-long-prompt-single-turn-ok-20260723,未出现“已了解/已补充”等隐藏上下文确认噪音。user_turn_count = 1,首轮 user turn 约 38863 bytes,包含完整 prompt;没有单独以- botmux-*/<identity>/<routing_rules>开头的碎片 user turn。备注
pnpm test在当前 macOS 环境仍有与本改动无关的既有/环境型失败(例如部分测试里rmSync对目录、git clone hardlink、端口竞争、v3 distillation 环境凭据隔离测试)。本 PR 相关 focused 回归和 build 均已通过。🤖 Generated with Claude Code