Repository navigation
feat: support folder-scoped git status - #4527
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
🦋 Changeset detectedLatest commit: 128d4e1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
…panels # Conflicts: # packages/agent-core-v2/src/app/git/gitService.ts # packages/kap-server/src/routes/fs.ts # packages/kap-server/test/fs.test.ts
…o feat/session-context-panels
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ef0b51d6f3
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 62658a9134
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9ebedb0e7d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| "@moonshot-ai/agent-core-v2": patch | ||
| "@moonshot-ai/kap-server": patch | ||
| --- | ||
|
|
||
| Add batched, folder-scoped Git and pull request queries for multi-root workspace panels. |
There was a problem hiding this comment.
Add a CLI changeset for the draft-state correction
Existing fs:git_status callers with a draft pull request now receive draft instead of open because this PR adds the isDraft field and changes its parsing, but the changeset only announces the new folder and batch queries and versions internal packages. The user-visible correction therefore will not appear in the CLI changelog; record it as a separate logical changeset for @moonshot-ai/kimi-code.
AGENTS.md reference: AGENTS.md:L108-L109
Useful? React with 👍 / 👎.
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 128d4e1a54
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Stops before #4538 so the code-app branch can pin a commit that has both this change and the server code code-app main runs on, without the tool-select API change that desktop has not adapted to yet.
Port of the local-environment hardening in upstream MoonshotAI/kimi-code 75f35b0 (MoonshotAI#4649). GitService spawned bare git and gh with the workspace as cwd. On Windows a bare name is looked up in the cwd before PATH, so a binary planted in the workspace could run. Both now resolve through resolveProgramPath, which refuses any match inside the working directory, and the timeout default moves from none to 30s so a hung git cannot wedge a status read. resolveProgramPath compares the PATH candidate against the working directory case-sensitively, so on Windows a PATH entry spelled with different casing (c:\repo\bin vs C:\Repo) let a workspace-local executable through; the containment check now folds case on win32. The pull request cache is keyed by branch, so a branch switch no longer serves the previous branch's pull request. Not ported from the same commit: reading the footer git status through the session environment, which needs the pull-request API of MoonshotAI#4527 and the session workdir of MoonshotAI#4062, neither of which this tree has. The startup "Ready." row it also removes does not exist here.
Fifteen rows enter the ledger: the six commits that landed on upstream/main after the last refresh, and the nine commits that reach main only through the release/2026-11-04 sync (MoonshotAI#4674), which is where the 2.5.0 changelog entries come from. Each 2.5.0 row records what it needs from this tree, so the next batch starts from the blocker instead of rediscovering it: - MoonshotAI#4658 and MoonshotAI#4659 are ported (79a4199, 7a531f5) with tests that fail on the pre-change tree. - MoonshotAI#4649 is in_progress: its agent-core-v2 half landed in 2fa7b6b, while the footer and welcome half needs the pull-request API of MoonshotAI#4527 and the session workdir of MoonshotAI#4062. - MoonshotAI#4653, MoonshotAI#4666 and MoonshotAI#4670 build on the MoonshotAI#4525 plugin marketplace, absent here; MoonshotAI#4670 additionally needs isError2. - MoonshotAI#4664 needs the MoonshotAI#4062 remote environments. - MoonshotAI#4667 and MoonshotAI#4672 are generated-bundle and release commits; settling them as not-applicable needs a signature. Rows were appended by a one-off writer because --refresh fetches and that fetch does not complete on this network; the file still parses under the tool's own column contract, and --verify --batch B5 passes both new probes.
Port of upstream MoonshotAI/kimi-code 1853dae (MoonshotAI#4527). Multi-root panels need the git state of one folder, not of the whole worktree: status and diff now accept a `root`, return entry paths relative to it, and refuse a path that escapes it. A batch pair (`git_status:batch`, `pull_request:batch`) reads several roots in one call with at most two in flight, folding a failing root into a per-root error instead of failing the request. Pull requests load independently of status, keyed by branch, and a draft open pull request reports `draft` instead of `open`. Fork adaptations: - Local resolveWithin rejects absolute paths outright, and that stays. A registered root is resolved through a separate path that reuses the workspace and realpath containment checks, so `root: '/'` still needs an explicit registration. - The upstream batch error mapping covers EnvironmentError and HandshakeError; only EnvironmentError exists here, since handshake failures come with the remote environments of MoonshotAI#4062. - parsePorcelain now returns a null-prototype entry map so a repository path named `__proto__` lands in results instead of the prototype. - Test stubs gain the new interface members, and the fake fs records `/` as an existing directory so a registered filesystem root can resolve. Not ported: the node-sdk session-workdir door to these actions, which arrives with MoonshotAI#4062.
…AI#4649's blocker MoonshotAI#4527 lands in 5eedb6f with a probe over the batch case. MoonshotAI#4649's remaining half no longer waits on the pull-request API it now has; only the MoonshotAI#4062 session workdir is missing.
…obes Both halves of the cross-folder search are in place: the fuzzy walk (14ba59e) and the empty-query listing, which now anchors an absolute path at the nearest registered root (a14144d). Upstream's route-level test is not ported, and the evidence says so, but the route forwarding it covers has been in place since MoonshotAI#4527's work. Ledger: closed 36 -> 37, remaining 62.
Requirement or Bug
多目录工作区的客户端需要分别获取每个目录的 Git 状态、改动统计和 PR,而不是复用主目录结果。本 PR 新增目录级单查询与批量查询能力,供 Desktop / Web 的右侧会话信息面板使用。
关联 app 仓 PR:https://github.com/MoonshotAI/kimi-code-app/pull/1049
Bug Reproduction Steps
N/A
Root Cause
N/A
Code Changes
核心思路:保留原有主目录调用方式,在现有
environment能力模型上增加可选root和批量 action;每个目录独立执行、独立返回结果或错误,避免单目录失败拖垮整个面板。Git 与 PR 行为
root缺省时保留原主目录语义和文件过滤方式;显式传入目录时,Git 状态和 numstat 只统计该目录范围。gh pr view增加isDraft,草稿 PR 返回draft而不是open。environment架构中申请fs / process能力,不恢复旧 runtime 路径。关键决策
results与errorsroot保持可选阅读指南
packages/kap-server/src/routes/fs.ts:单查询、批量 action、目录校验和错误映射。packages/agent-core-v2/src/workspace/workspaceFs/fsService.ts:目录级 Git 状态与 PR 查询入口。packages/agent-core-v2/src/app/git/gitService.ts:目录范围内的 status、numstat、diff 和 PR 查询。packages/agent-core-v2/src/app/git/gitParsers.ts:Git / PR 输出解析及草稿状态。packages/kap-server/test/fs.test.ts与对应 core 测试:真实 REST、批量隔离和目录范围验证。Behavior Changes and Affected Users
root的 Git 状态root的 Git 状态rootroot保留原主目录统计open返回draft返回agent-core-v2和kap-server使用patch验证
pnpm vitest run packages/agent-core-v2/test/app/git/gitService.test.ts packages/agent-core-v2/test/workspace/workspaceFs/fsService.test.ts packages/kap-server/test/fs.test.ts:3 个文件、186 项测试全部通过,包含真实 REST 的附加目录查询。pnpm --filter @moonshot-ai/kap-server run typecheck:通过。pnpm --filter @moonshot-ai/agent-core-v2 run typecheck:仍有test/program/program.test.ts:617的参数数量错误;该文件与origin/main一致,并非本 PR 修改。Checklist
rootkeep their previous behavior.gen-changesetsskill,仅更新@moonshot-ai/agent-core-v2与@moonshot-ai/kap-server的patchchangeset,不包含 CLI。