Skip to content

feat(kimi-code): summarize workspace trust with configuration sources - #4056

Merged
7Sageer merged 33 commits into
mainfrom
feat/trust-panel-disclosure
Sep 29, 2026
Merged

7Sageer merged 33 commits into
mainfrom
feat/trust-panel-disclosure

Conversation

@7Sageer

@7Sageer 7Sageer commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Requirement or Bug

信任目录之前,用后果摘要说明会激活什么,并给出可自行核查的配置文件或目录。

Bug Reproduction Steps

N/A

Root Cause

N/A

Code Changes

WorkspaceTrustDisclosureService
  已有 MCP origins / local.toml configPath / skill paths
  已有 AGENTS.md paths 与 warning / agent scannedRoots
             ↓ 聚合为摘要、核查路径和警告
SDK WorkspaceTrustInfo → TrustPromptComponent
  后果摘要 + 配置路径
  持续信任与审批说明 + 固定操作区

来源聚合限定在 trust disclosure 内,复用加载器已有的结果;不修改其他 service、AgentProfile、指令加载器或状态清单,也不增加来源追踪机制。agent 配置直接提供已有扫描目录作为核查入口,目录以 / 结尾,不承诺精确到生效文件或单个 agent 文件的符号链接目标。

MCP 和 AGENTS.md 文件、项目外目录的实际位置会解析符号链接;skill 来源优先归并到已有根目录。项目内路径相对当前工作目录显示,项目外保留绝对路径。面板不显示 MCP 命令、参数、env/header/token 详情,也没有独立详情页;完整配置由用户按路径打开查看。

扫描失败在面板显示通用提示,AGENTS.md 直接复用现有加载警告;不为精确标注失败路径新增跨模块字段。project skills 最多等待 1 秒,watcher 初始化失败或超时后继续显示信任入口,并提示用户检查 skill 目录。长内容在同一面板分页,目录和核查路径不会按固定数量截掉。信任存储、工具审批和启动生命周期不变。

Preview

实际组件渲染,80×24 终端(23 个可用行):

────────────────────────────────────────────────────────────────────────────────
 Trust this folder?
 ↑↓ navigate · Enter select · Esc exit

 /tmp/example-project

 Start 2 MCP servers automatically
   Config: .mcp.json, .kimi-code/mcp.json

 Access 2 folders outside this project
   Config: .kimi-code/local.toml

 Load project instructions and agent profiles
   Check: AGENTS.md · .kimi-code/skills/ · .kimi-code/agents/

 Trust is remembered for this folder, including future project config changes.
 Tool approvals follow your permission settings.

  ❯ Trust and continue
    Exit
────────────────────────────────────────────────────────────────────────────────

Behavior Changes and Affected Users

行为 改动前 改动后 谁依赖旧行为 退路
MCP 披露 内联展示 command/args/cwd/url 自动启动的数量和配置路径;移除内联命令/参数 未信任目录中的 TUI 用户 按列出的路径查看源配置;维护者已明确确认此取舍
项目外目录和指令 面板只展示 MCP 展示外部目录数量与配置目录,以及指令文件、skills、agent 的核查入口 项目配置附加目录、skills 或 agent 的 TUI 用户 按列出的配置路径查看完整目录和指令
禁用 MCP 可能仍列入清单 enabled=false 的 MCP 不计入将启动的数量 配有禁用 MCP 的用户 加载行为不变,仅修正披露
空态与失败 空列表只有通用提示 无激活项明确说明;扫描失败或已有 AGENTS.md 警告单独显示 空配置、无效配置或指令读取异常的用户 核查配置或退出;不提供新的精确错误定位机制
skill watcher 初始化失败 信任信息等待 project skills 完成加载 最多等待 1 秒,超时后显示 skill 根目录和“仍在加载”提示,Trust/Exit 仍可用 Windows 目录监听被 EPERM 拒绝、Linux watcher 配额耗尽等用户 继续查看配置或退出;watcher 在后台按原策略重试
持续信任说明 说明会记住目录 固定说明后续配置变更也会生效,审批遵循当前设置 未信任目录中的 TUI 用户 Esc 或 Exit 退出;存储和审批行为不变
长内容、小窗口 选项可能超出可视区域 ←→ / PgUp/PgDn 分页;操作区固定;极小窗口需放大后确认 小终端、长路径和较多配置的 TUI 用户 翻页查看全部路径;Esc 始终可退出
SDK 信任信息 trusted 与 gatedMcpServers 增加配置来源、外部目录、指令核查路径和警告;保留原有 MCP 字段 调用 getWorkspaceTrustInfo 的 SDK 消费方 原有读取字段保留,新字段按需使用

默认选中信任,↑↓ 选择,Enter/Space 确认,Esc 退出。

验证:

  • TUI 信任面板、启动和信号处理:98 项通过。
  • SDK workspace trust:6 项通过,覆盖来源复用、agent 扫描目录、已有 AGENTS.md 警告、MCP 扫描失败、符号链接、..cache 项目内目录和信任持久化。
  • 状态清单检查:2 项通过,清单无净改动。
  • CLI、SDK、agent-core-v2 类型检查通过;修改文件 type-aware lint 无错误;禁注释检查通过。
  • 受控 watcher-EPERM repro:原路径 120ms 后仍 pending;收窄版在 1.2s 内返回,afterPromptStarted=true,重试继续在后台运行。

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue — none exists; this follows maintainer-approved workspace trust UX feedback.
  • I have added tests that prove my feature works.
  • The behavior-change table is complete; replacing inline MCP commands with configuration paths was explicitly approved by the maintainer and is named in the changeset.
  • Ran gen-changesets; the existing CLI patch entry describes the final behavior.
  • Ran gen-docs; no user-guide changes in this revision, preserving the PR's removal of keyboard documentation.

Copilot AI balanced review requested due to automatic review settings September 28, 2026 06:07
@changeset-bot

changeset-bot Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 206ce33

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

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

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.

@7Hanrui

7Hanrui commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f5af4442e2

ℹ️ 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".

Comment on lines +2917 to +2921
await Promise.all([
program.skills.ready,
program.agentProfiles.ready,
program.instructions.ready,
]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Do not block the trust prompt on full source discovery

When opening an untrusted workspace whose skill or instruction discovery is slow (for example, a large .kimi-code/skills tree or an unavailable filesystem), awaiting all three readiness promises prevents getWorkspaceTrustInfo() from resolving, so maybeRunWorkspaceTrustPrompt() cannot mount either choice. Previously this RPC only waited for MCP-config loading and the dialog could be shown while these loaders continued; keep this disclosure non-blocking or time-bounded so users can still choose “Don’t trust.”

AGENTS.md reference: AGENTS.md:L98-L100

Useful? React with 👍 / 👎.

@@ -0,0 +1,5 @@
---
"@moonshot-ai/kimi-code": patch

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Release the SDK contract alongside the CLI

This changes the public WorkspaceTrustInfo return shape and its getWorkspaceTrustInfo() implementation, but the only changeset bumps @moonshot-ai/kimi-code. Consequently, standalone SDK consumers will continue receiving the previously published SDK and cannot obtain these disclosure fields; add an @moonshot-ai/kimi-code-sdk changeset with the appropriate versioning/compatibility treatment.

AGENTS.md reference: AGENTS.md:L110-L112

Useful? React with 👍 / 👎.

Comment on lines +2906 to +2908
const localConfig = new FileProjectLocalConfigService(bootstrap, fs);
const result = await localConfig.readAdditionalDirs(workDir);
return result.additionalDirs;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 Badge Avoid claiming every configured directory is external

readAdditionalDirs() accepts and resolves any configured directory without excluding paths inside the project. Therefore, an untrusted repository with [workspace] additional_dir = ["."] will render this as granting access to a directory “outside this project,” even though it grants no new external access. Filter this list to actual external directories or describe it neutrally as additional directories so the trust decision is accurate.

Useful? React with 👍 / 👎.

@7Hanrui

7Hanrui commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2181e342b2

ℹ️ 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".

Comment on lines +2924 to +2927
await Promise.race([
Promise.all([program.skills.ready, program.agentProfiles.ready, program.instructions.ready]),
new Promise((resolve) => setTimeout(resolve, INSTRUCTION_DISCOVERY_TIMEOUT_MS)),
]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Surface discovery timeouts in the trust prompt

When a project has a skill, agent-profile, or instruction scan that takes longer than two seconds (for example, a large project skill tree), this race returns the still-empty snapshots. The prompt then renders “No project-level config found,” but the same loaders continue and their project sources are applied after the user selects Trust, so the user is asked to approve a misleadingly incomplete disclosure. Preserve the non-blocking startup behavior, but expose that discovery is incomplete rather than treating it as an empty configuration.

AGENTS.md reference: AGENTS.md:L118-L120

Useful? React with 👍 / 👎.

@7Hanrui

7Hanrui commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 68b288c823

ℹ️ 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".

Comment on lines +237 to +242
if (server.envKeys !== undefined && server.envKeys.length > 0) {
parts.push(`env keys: ${server.envKeys.map(sanitizeForDisplay).join(', ')}`);
}
if (server.headerKeys !== undefined && server.headerKeys.length > 0) {
parts.push(`header keys: ${server.headerKeys.map(sanitizeForDisplay).join(', ')}`);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Cap untrusted MCP key lists before rendering

When an untrusted project declares a MCP server with a very large env or headers map, the schema accepts every key and the SDK preserves them all; this formatter then joins the entire list before wrapping it. The server-count cap does not constrain these fields, so a crafted .mcp.json can generate thousands of prompt rows and make the trust dialog slow or unusable before the user can select “Don't trust.” Truncate these key lists and display a remaining-count suffix.

Useful? React with 👍 / 👎.

Comment on lines +2906 to +2908
return Object.entries(loaded.servers)
.filter(([name]) => projectPaths.has(loaded.origins[name] ?? ''))
.map(([name, config]) => describeWorkspaceMcpServer(name, config, loaded.origins[name] ?? ''))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Exclude disabled MCP servers from the trust disclosure

When a project MCP entry sets enabled: false, this origin-only filter still reports it as gated, and the dialog consequently says that trusting will run it automatically. The connection manager instead creates such entries with status disabled and never connects them, so users can be discouraged from trusting a folder by an activation that cannot occur. Filter disabled entries here or surface them as disabled rather than counting them as servers that will run.

Useful? React with 👍 / 👎.

@7Hanrui

7Hanrui commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6d80922b82

ℹ️ 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".

const projectPaths = new Set([paths.projectRoot, paths.project]);
return Object.entries(loaded.servers)
.filter(([name]) => projectPaths.has(loaded.origins[name] ?? ''))
.filter(([, config]) => config.enabled !== false)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Disclose disabled project MCP overrides

When an enabled user-level MCP server shares a name with a project entry whose enabled is false, this filter removes the project entry from the disclosure and the prompt can even state that no project config exists. Trusting nevertheless reloads the merged configuration with the project layer, and WorkspaceMcpService.apply() passes that disabled config to manager.connect(), which closes the user server and leaves it disabled. Surface this as a disabled override rather than omitting it so affected MCP users can make an informed trust decision.

AGENTS.md reference: AGENTS.md:L118-L120

Useful? React with 👍 / 👎.

Comment on lines +2941 to +2943
new Promise<boolean>((resolve) =>
setTimeout(() => resolve(false), INSTRUCTION_DISCOVERY_TIMEOUT_MS),
),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Clear the completed disclosure timeout

When instruction discovery completes before the two-second budget, the Promise.race resolves but this timer is neither cleared nor unref'ed. The pending timer keeps Node's event loop alive, so a standalone SDK caller that queries trust info and immediately closes its harness still takes roughly two additional seconds to exit. Retain the timeout handle and clear it when readiness wins (or unref it).

Useful? React with 👍 / 👎.

@7Hanrui

7Hanrui commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9f30a2444f

ℹ️ 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".

Comment on lines +2947 to +2950
const prefix = `${result.projectRoot}/`;
return result.additionalDirs.filter(
(dir) => dir !== result.projectRoot && !dir.startsWith(prefix),
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Resolve symlinked additional directories before hiding them

When an untrusted repository sets additional_dir = ["linked-dir"] and linked-dir is a symlink to (for example) the user's home directory, this lexical prefix check removes it from the disclosure as if it were inside the project. The filesystem service resolves every configured additional directory with realpath and treats that external target as an allowed root, so trusting grants undisclosed outside-project access and can even render the misleading empty-state prompt. Compare canonical paths before filtering, or disclose symlinked entries whose targets escape the project.

AGENTS.md reference: AGENTS.md:L118-L120

Useful? React with 👍 / 👎.

Comment on lines +2918 to +2922
const enabledUserNames = new Set(
Object.entries(userLoad.servers)
.filter(([, config]) => config.enabled !== false)
.map(([name]) => name),
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Disclose disabled overrides of plugin MCP servers

When an enabled plugin provides a server such as plugin-demo:finance and a project .mcp.json sets that same runtime name to enabled: false, this set only considers user JSON entries, so the disclosure omits the override. WorkspaceMcpConfigService merges file servers after plugin servers, therefore trusting applies the disabled project entry and shuts down the plugin server despite the prompt potentially claiming no project config. Fresh evidence: the plugin manager explicitly emits the plugin-<id>:<server> names that the file layer can override; include enabled plugin-server names in this check.

AGENTS.md reference: AGENTS.md:L118-L120

Useful? React with 👍 / 👎.

Comment on lines +281 to +284
function formatNameList(names: readonly string[]): string {
const shown = names.slice(0, MAX_NAME_LIST).map(sanitizeForDisplay);
const suffix = names.length > MAX_NAME_LIST ? `, +${names.length - MAX_NAME_LIST} more` : '';
return `${shown.join(', ')}${suffix}`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Limit each untrusted source name before wrapping

A project skill accepts any non-empty frontmatter name, so one crafted multi-megabyte name reaches formatNameList; the count cap only limits the number of names, not their length. At the dialog's minimum wrap width this produces hundreds of thousands of rendered rows before either choice is usable, allowing an untrusted workspace to effectively block the user from selecting “Don't trust.” Truncate each displayed skill/profile name with an omitted-length suffix before joining and wrapping.

Useful? React with 👍 / 👎.

@7Hanrui

7Hanrui commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

const args = server.args === undefined ? '' : ` args=${JSON.stringify(server.args)}`;

P2 Badge Cap untrusted MCP target fields before wrapping

A project .mcp.json can supply an unbounded args array (and arbitrary-length command, cwd, or URL strings), and this serializes the complete value before the rendered text is wrapped. The server-count and key-list caps do not constrain these fields, so a crafted workspace can generate enough rows to make the pre-trust dialog unusable before the user can select “Don't trust.” Truncate each displayed field and cap the number of displayed arguments with an omitted-count suffix.

ℹ️ 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".

}
const fs = this.engineAccessor.get(IHostFileSystem);
const bootstrap = this.engineAccessor.get(IBootstrapService);
const [mcp, dirs, instructions] = await Promise.all([

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Bound all pre-trust disclosure I/O

On a slow or unavailable filesystem, this Promise.all still prevents the trust dialog from mounting because readGatedAdditionalDirs() and the MCP loaders have no deadline, and describeInstructionSources() performs its Git-root probe before its internal two-second race. An untrusted workspace on such a mount therefore cannot select “Don't trust”; apply one outer, non-blocking timeout to the entire disclosure collection. Fresh evidence: the current timeout only starts after the awaited findGitWorkTree() call and does not cover the sibling disclosure promises.

Useful? React with 👍 / 👎.

}

function isInsideOrEqualDir(child: string, parent: string): boolean {
return child === parent || child.startsWith(`${parent}/`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Normalize Windows canonical paths before filtering

On Windows, IHostFileSystem.realpath() returns native backslash paths, so for additional_dir = ["sub"] this check compares C:\repo\sub with the constructed prefix C:\repo/ and classifies an in-project directory as external. The prompt then falsely says trusting grants access outside the project; normalize both canonical paths to one separator convention or use a path-aware relative containment check.

Useful? React with 👍 / 👎.

.flatMap((entry) => entry.profiles)
.toSorted();
const agentsMdPaths = snapshot.sources.instructionPaths
.filter((path) => path.startsWith(`${projectRoot}/`))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 Badge Include root-level instructions in the disclosure

When Kimi is launched from the filesystem root (or a Windows drive root) outside a Git worktree, projectRoot already ends in /, so this prefix becomes // (for example, C://) and filters out the /AGENTS.md that WorkspaceInstructionsService loads. disclosureComplete remains true and the prompt can claim no project config even though trusting injects that instruction file; normalize the boundary prefix or handle root paths explicitly.

Useful? React with 👍 / 👎.

@7Hanrui

7Hanrui commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 0b034cb098

ℹ️ 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".

@7Hanrui

7Hanrui commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

const args = server.args === undefined ? '' : ` args=${JSON.stringify(server.args)}`;
const cwd = server.cwd === undefined ? '' : ` cwd=${server.cwd}`;
return sanitizeForDisplay(`${server.name} (stdio): command=${server.command ?? ''}${args}${cwd}`);

P2 Badge Bound untrusted MCP target fields before wrapping

A project .mcp.json accepts arbitrarily long command, args, cwd, and URL strings, but this formatter only removes control characters and then passes the complete value to wrapTextWithAnsi. For example, an untrusted workspace with a multi-megabyte stdio command produces hundreds of thousands of prompt rows at the minimum width, making the trust dialog unusable before the user can select “Don't trust.” Truncate each displayed target field (with an omitted-length/count suffix) before wrapping.

ℹ️ 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".

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6e5c45d1b6

ℹ️ 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".

Comment on lines +131 to +135
await Promise.all([
this.skills.ready,
this.agentProfilesLoader.ready,
this.instructions.ready,
]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Await competing profile loaders before disclosing profiles

When an SDK host uses the new process-level agentFiles option and that explicit file is slower to read than the workspace agent directory, this waits only for the workspace loader and snapshots the registry before the explicit loader registers. A same-named workspace profile is then displayed as becoming available, but the session catalog later selects the higher-priority explicit profile and suppresses the workspace one. Fresh evidence is that explicit profiles are loaded asynchronously from bootstrap.args.agentFiles; wait for the competing loaders or mark this portion of the disclosure incomplete.

Useful? React with 👍 / 👎.

@7Sageer 7Sageer changed the title feat(kimi-code): show what trusting activates in the workspace trust prompt feat(kimi-code): summarize workspace trust with configuration sources Sep 29, 2026
@7Hanrui

7Hanrui commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8081d74879

ℹ️ 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".

Comment on lines +278 to +280
function isInsideOrEqualDir(child: string, parent: string): boolean {
const rel = relative(parent, child);
return rel === '' || (!rel.startsWith('..') && !isAbsolute(rel));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 Badge Treat ..-prefixed child paths as inside the project

When an untrusted project's local.toml configures additional_dir = ["..cache"] and /repo/..cache exists, relative('/repo', '/repo/..cache') is ..cache; this prefix check classifies that in-project directory as escaping. readGatedAdditionalDirs() then tells the user that trusting grants outside-project access even though it grants no new external access. Restrict the parent check to .. itself or a parent-segment prefix such as ../.

Useful? React with 👍 / 👎.

@7Hanrui

7Hanrui commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: ea6c7492dc

ℹ️ 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".

@7Hanrui

7Hanrui commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: be1a6a7b77

ℹ️ 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".

@7Hanrui

7Hanrui commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 206ce332c0

ℹ️ 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".

@7Sageer
7Sageer marked this pull request as ready for review September 29, 2026 06:46
@pkg-pr-new

pkg-pr-new Bot commented Sep 29, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@206ce33
npx https://pkg.pr.new/@moonshot-ai/kimi-code@206ce33

commit: 206ce33

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 206ce332c0

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

readonly paths: readonly string[];
}

/** Trust state of a workspace directory, plus everything trusting it would activate. */

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Gate disclosed workspace inputs on the trust state

For SDK hosts that call createSession() without first calling trustWorkspace(), this contract is inaccurate: session materialization never checks IWorkspaceTrust, while WorkspaceDirsService has already loaded local.toml and the session is seeded directly with those directories, project skills, instructions, and profiles. Such a session therefore receives the disclosed external access and prompt inputs while trusted remains false, so consumers cannot treat the new gatedAdditionalDirs or instruction disclosure as things that trusting actually activates; either enforce the gate in session creation or avoid exposing these inputs as trust-gated.

AGENTS.md reference: AGENTS.md:L110-L112

Useful? React with 👍 / 👎.

@7Sageer
7Sageer merged commit 395d537 into main Sep 29, 2026
17 checks passed
@7Sageer
7Sageer deleted the feat/trust-panel-disclosure branch September 29, 2026 08:24
@github-actions github-actions Bot mentioned this pull request Sep 29, 2026
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Oct 5, 2026
Step 11, the tail of the sync: 13 upstream commits over 177 files. The
step lands the WaitFor steering rework, the workspace-trust summary, the
sticky user messages, and the completion-budget cleanup.

Upstream's changes in this step, all absorbed:
- interrupt tower wake turns on user input and harden tower operations
  (MoonshotAI#3998)
- cap WaitFor at 90s and let new input end the wait (MoonshotAI#4061)
- summarize workspace trust with configuration sources (MoonshotAI#4056)
- trust the workspace via KIMI_CODE_TRUST_WORKSPACE (MoonshotAI#4059)
- add sticky user messages in fullscreen mode (MoonshotAI#4031)
- omit the completion token cap unless explicitly configured (MoonshotAI#4091)
- clear inherited cron tasks at the fork record (MoonshotAI#4083)
- fold UserPromptSubmit hook output into the prompt message (MoonshotAI#4081)
- remove the interruption reminder on undo of its turn (MoonshotAI#4076)
- publish permission mode changes on agent.status.updated (MoonshotAI#4057)
- stop NotifyUser nudges in hosts without the update panel (MoonshotAI#4054)
- add regression and user-impact review to the PR workflow (MoonshotAI#4023)
- sync the 2.1.1 changelog into the release notes (MoonshotAI#4018)

Fork behaviour that had to survive:
- the message-dispatch controller split: upstream's new steering path
  (the steering set, the queue-wide steer, the settle callback, the
  transcript rollback on a failed steer) was ported into
  MessageDispatchController, and KimiTUI keeps delegating to it
- the i18n layer: the rewritten trust prompt goes through `t()` with new
  en/zh entries, and the Code Review Rules section lands in DEVELOP.md
  (the fork's renamed AGENTS.md)
- the fork's node-local → host rename, its sixel graphics work in pi-tui,
  and its Windows-safe test cleanup stay in place
- the fork's tool list: the recorded tools-snapshot hashes keep the
  fork's own tool set
- the fork's path-image ingestion no longer defers the media-free submit
  path: extractMediaAttachments returns synchronously when the text
  carries no image file path, so a plain prompt reaches dispatch in the
  same tick again (upstream's steering tests assert exactly that)

Verified: typecheck clean across every package and app; full suite
17879 passed / 0 failed / 81 skipped / 1 todo, plus kimi-inspect's own
115 tests; lint 0 errors.
@github-actions github-actions Bot mentioned this pull request Oct 14, 2026
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