Skip to content

Review follow-ups for #907, #946 and #968 - #1010

Merged
agegr merged 3 commits into
mainfrom
claude/review-followups
Sep 30, 2026
Merged

agegr merged 3 commits into
mainfrom
claude/review-followups

Conversation

@agegr

@agegr agegr commented Sep 30, 2026

Copy link
Copy Markdown
Owner

Small fixes I noted as non-blocking while reviewing these PRs. One commit per topic.

fix(open-in-explorer): authorize the path before looking at it (#907)

  • POST /api/open-in-explorer ran stat() before the allow-list check. A path outside the roots therefore answered 400 (a file), 500 (missing) or 403 (a directory), which told the caller whether it exists. The allow-list now runs first. isExistingFilePathAllowed() already requires the path to exist.
  • New app/api/open-in-explorer/route.test.mjs: an existing and a missing path outside the roots both get 403, and a non-loopback Host gets remote. The test fails against the old check order.
  • Housekeeping:
    • The module's comments are now in English, like the rest of the codebase.
    • A note that macOS open launches .app bundles, so callers should only pass project directories.
    • The route is added to the AGENTS.md file map.

refactor(subagents): share parseNpmSource through lib/npm-source.ts (#946)

subagents.ts imported plugin-updates.ts only for parseNpmSource. That pulled child_process, semver and the SDK package manager into the session-reader import graph. The parser now lives in a dependency-free module that both files use. No behavior change.

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

A length stop with no answer isn't always thinking's fault. pi clamps each request's output to the room left in the context, so a nearly full context can return nothing at all. The notice now names both causes and drops the fixed "medium or below" advice, which is wrong for sessions already on a low thinking level. Updated in en, zh-CN, zh-TW and the demo's copies. A new test covers an empty length reply.

Verification

tsc --noEmit, npm run lint, and npm test (1356/1356) pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q8e4GL1QSNFveKtnFfP3FZ


Generated by Claude Code

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
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
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
@agegr
agegr merged commit fe288c0 into main Sep 30, 2026
4 checks passed
@agegr
agegr deleted the claude/review-followups branch October 1, 2026 13:28
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 的其他入口另行收尾)。
Kano-u pushed a commit to Kano-u/pi-web that referenced this pull request Oct 2, 2026
上游只接受「资源管理器头部一个按钮」的窄版(agegr#907 / a0c00f3,含 agegr#1010 的收尾),
并以「超出薄前端范围」关闭了我们的宽版 agegr#951,因此移除 agegr#951 的两个额外入口:

- 聊天回复里行内代码路径的 chip(MarkdownBody.tsx 还原上游版本,
  lib/file-links.ts、MarkdownBody.test.mjs、file-links.test.mjs 与
  app/globals.css 的样式一并还原)
- 文件查看器头部的「在资源管理器中显示」按钮

同时删除只服务于它们的模块:/api/open-folder、lib/open-folder.ts、
lib/path-actions.ts、hooks/useLocalFileManager.ts、lib/loopback-host.ts,
以及两条只被它们使用的 i18n 文案。上游的 /api/open-in-explorer +
lib/open-in-file-manager.ts(含平台文案、远程/不支持时的置灰与错误提示)
保持不变。
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
* 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