Skip to content

feat(agent-core-v2): persist user and project permission rules - #4550

Open
sailist wants to merge 3 commits into
mainfrom
feat-137-09-02-permission-rule-persistence
Open

sailist wants to merge 3 commits into
mainfrom
feat-137-09-02-permission-rule-persistence

Conversation

@sailist

@sailist sailist commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Requirement or Bug

配置系统已经暴露 PermissionRule.scope 的 user / project 持久化语义,但 v2 Agent 没有加载配置中的规则,也不会在 addRules 时写回。这个 PR 用最小且自洽的支持范围,让用户级和项目级权限规则在会话启动时生效,并在显式写回及新建会话后继续生效。

Bug Reproduction Steps

  1. 在用户 config.toml 或受信任项目的 .kimi-code/local.toml 中配置一条 deny 规则并创建会话;修复前匹配的工具调用不会按该规则拒绝。
  2. 通过 addRules 添加 scope = "user" 或 scope = "project" 的规则;修复前规则仅存在于当前 Agent 内存,重启后丢失。

Root Cause

IConfigService 和项目本地配置虽然能解析规则,但没有连接到 Agent 的权限规则服务;addRules 也只分发非持久化事件。本 PR 通过启动时配置加载和可等待的显式写回完成根本修复。

Code Changes

核心设计是持久化规则只以配置文件为数据源。不再把 user / project 规则复制进 Agent state,也不做项目热重载,避免配置与内存副本不一致。

flowchart LR
  U[用户 config.toml] --> A[Agent 权限规则合并]
  T{workspace 已信任?}
  T -->|是| P[当前环境 .kimi-code/local.toml]
  T -->|否| N[不加载项目规则]
  P --> S[Session 启动时项目规则快照]
  S --> A
  R[await addRules] -->|user| U
  R -->|project| Q[串行 + 原子写回]
  Q --> P
  A --> G[既有权限策略]
Loading
  • addRules 现在返回 Promise<void>:turn-override / session-runtime 仅 dispatch live-only 事件;user / project 仅写配置,写回错误由调用方感知。
  • 用户配置继续接受旧四种 scope,其中旧 runtime scope 为兼容直接忽略且不 warning;项目配置仅接受 project / user,非法项目规则仍 fail closed。
  • 本地项目规则只在 workspace 已信任时加载;配置损坏、不可读或规则非法会阻止会话启动,不降级为空规则集。
  • 首期不支持远程项目规则:非本地环境不读取项目文件,project 写回直接报不支持;本地项目根、.kimi-code 或 local.toml 为 symlink 时拒绝写入。
  • 同一配置的读取—追加—写入在进程内串行,项目文件通过同目录临时文件和 rename 原子替换。
  • 项目外部修改需要新建会话;不做 watcher、跨进程写锁、local.toml 注释/格式保留、运行中 trust 动态切换、legacy 配置形态或全局 first-match 重构。
  • 中英文配置文档及 config manifest 已同步;wire/state manifest 未变化。

阅读顺序:先看 permissionRulesService.ts 的运行时/持久化分流,再看 projectPermissionRulesService.ts 的 trust 与启动加载,最后看 projectLocalConfigService.ts 的串行原子写回及 Session/Program 的环境接线。

Behavior Changes and Affected Users

Behavior Before After Who relies on the old behavior Escape hatch
用户 config.toml 中的权限规则 不进入 v2 Agent 权限评估 校验后参与评估;user 新增规则可 await 写回 在用户级配置中声明 allow / deny / ask 的 CLI、desktop、web、VS Code、ACP 与 SDK 会话 无需退路,恢复文档已声明的行为
项目 .kimi-code/local.toml 中的权限规则 不进入权限评估 仅在本地且 workspace 已信任时于 Session 启动加载;project 新增规则写回本地环境;远程不支持 使用项目级规则的本地工作区 未信任或远程工作区不加载;外部修改需新建会话
用户配置中的旧 turn-override / session-runtime 规则 schema 接受但 v2 不加载 为兼容继续接受并静默忽略,不 warning;运行时 API 行为不变 带有旧 runtime scope 配置的用户 保持旧配置可启动,无需迁移
addRules 写回 同步返回,持久化失败只能记录 warning 返回 Promise,成功表示写回完成,失败可由调用方捕获 通过 API 添加持久化规则的客户端 调用方 await 后即可区分成功与失败
权限策略优先级 既有策略顺序 不改策略;文档明确 deny → ask → allow 所有使用权限规则的用户 行为不变

受影响模块为 agent-core-v2 的权限规则、项目本地配置、Program workdir 和 Session 生命周期,以及中英文配置文档。没有修改 wire、state 或公开客户端协议。

验证结果
  • 本地聚焦测试全部通过:170 个既有回归测试,以及本轮 6 个 scope/Session 测试;权限与项目配置测试数分别保持 5 和 4,净增为 0。
  • m0-dev 远程 agent-core-v2 全量:393 个文件、7,760 个测试通过,10 个跳过。此前 trust DI 装配导致的 forkParity / sessionTodo 失败及新增 Session config stub 问题均已修复。
  • 唯一剩余失败是未触及的 test/app/sessionIndex/sessionIndex.test.ts:1601 workspace mtime 断言,与本次权限改动无关。
  • 根仓库 corepack pnpm typecheck:通过,包含 packages 构建及 CLI、VS Code、vis 类型检查。
  • 根仓库 corepack pnpm lint:0 error;lint:imports 另有 3 个未触及文件的既有违规。
  • 中英文 VitePress 文档构建:通过。
  • 真实 ConfigService + 环境文件系统 + 权限策略端到端验证:启动 deny、await 写回、重启后 deny、保留 [workspace]、非法项目文件 fail closed,均通过。
  • 主 Review 已覆盖生成契约、远程路径、并发写回、trust DI 和敏感信息扫描。

Checklist

  • I have read the CONTRIBUTING document.
  • Related requirement is described above; no issue link is available.
  • I have added tests that prove my feature works.
  • The behavior-change table above is complete, and every removed behavior or flipped default is named in the changeset and either has an escape hatch or was explicitly approved by a maintainer in this PR.
  • Ran gen-changesets skill and included the confirmed patch changeset.
  • Updated English and Chinese configuration documentation and regenerated the config manifest.

@changeset-bot

changeset-bot Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8a0808f

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T08:54:56.835397Z 8a0808f New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 2b2b481736

ℹ️ 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 +61 to +64
const loaded = await this.localConfig.readPermissionRules(this.cwd);
this.projectRoot = loaded.projectRoot;
this.configPath = loaded.configPath;
this.currentRules = parseProjectPermissionRules(loaded.rules, this.log);

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 Gate project permission rules on workspace trust

When a session is created through the server API or another path that does not first complete the TUI trust prompt, this unconditional read activates rules from an untrusted checkout. A committed .kimi-code/local.toml can therefore contain an allow rule that runs before the normal fallback, sensitive-file, and git-control approval policies, silently relaxing approvals even though project MCP configuration is withheld until trust is granted; inject the workspace trust service and load/unload these rules with trust changes.

AGENTS.md reference: AGENTS.md:L131-L133

Useful? React with 👍 / 👎.

Comment on lines +40 to +44
const configRules = this.config.get<PermissionConfig | undefined>(PERMISSION_SECTION)?.rules ?? [];
return dedupePermissionRules([
...this.agentState.get(permissionRulesKey).rules,
...this.projectRules.rules,
...configRules,

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 Reject or evaluate session-runtime config rules

When config.toml contains a valid rule such as decision = "deny", scope = "session-runtime", the new merge exposes it without any diagnostic, but evaluateUserConfiguredRule filters against a scope set containing only turn-override, project, and user. The documented and schema-accepted deny rule is consequently ignored and the tool call can proceed; either include this scope in evaluation or reject it when parsing persistent configuration.

AGENTS.md reference: AGENTS.md:L131-L133

Useful? React with 👍 / 👎.

Comment on lines +79 to +81
try {
await this.fs.mkdir(dirname(configPath), { recursive: true });
await this.fs.writeText(configPath, `${stringifyToml(file.raw)}\n`);

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 Preserve comments when appending project rules

When an existing local.toml contains comments, adding a project-scoped rule parses the entire file into plain objects and serializes it from scratch here, so every comment and the user's formatting are silently discarded. This file previously had a read-only compatibility role, so users can have hand-maintained annotations; update only the permission table through a comment-preserving TOML writeback instead of replacing the complete document.

AGENTS.md reference: AGENTS.md:L131-L133

Useful? React with 👍 / 👎.

Comment on lines +269 to +271
function enqueuePermissionWrite<T>(configPath: string, work: () => Promise<T>): Promise<T> {
const previous = permissionWriteTails.get(configPath) ?? Promise.resolve();
const run = previous.then(work, work);

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 Serialize permission appends across processes

When two Kimi processes use the same checkout, each has its own permissionWriteTails map, so simultaneous appends can both read the same old local.toml and then overwrite one another; whichever write finishes last silently drops the other process's rule. Use the repository's cross-process lock/atomic document mechanism or a locked read-modify-write rather than relying only on this in-memory queue.

AGENTS.md reference: AGENTS.md:L131-L133

Useful? React with 👍 / 👎.

Comment on lines +65 to +67
} catch (error) {
this.log.warn(`project permission rules load failed: ${String(error)}`);
this.currentRules = [];

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 Fail closed when project rules cannot be loaded

When local.toml is malformed, unreadable, or temporarily unavailable, this catch resolves session readiness after replacing all project rules with []. A session therefore starts—or a running session continues after reload—without configured deny or ask rules, and users receive only an internal warning; propagate the startup failure and retain the last valid rule set on reload rather than silently removing the restrictions.

AGENTS.md reference: AGENTS.md:L131-L133

Useful? React with 👍 / 👎.

Comment on lines +92 to +94
} catch (error) {
this.log.warn(`failed to persist user permission rules: ${String(error)}`);
}

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 failures to persist durable rules

When the user config is read-only, the disk is full, or a remote project filesystem is unavailable, these catches convert the requested user/project persistence into a warning while addRules has already installed the rule in memory and returns no completion or error signal. Users therefore believe a permanent rule was saved, but it silently disappears after restart; expose an awaitable result or user-visible failure instead of degrading durable scopes to session-only behavior.

AGENTS.md reference: AGENTS.md:L131-L133

Useful? React with 👍 / 👎.

Comment on lines +74 to +77
const handle = watchCandidates(this.projectRoot, [this.configPath], {
ignored: subtreeWatchFilter(this.projectRoot, [this.configPath]),
});
this._register(handle);

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 Share the project-config watcher across sessions

For local workdirs, every Session-scoped service creates its own watchCandidates handle even when many live sessions point at the same project, and the watch implementation does not deduplicate identical paths. A long-running kap-server or desktop workspace with many open sessions consequently accumulates one OS watcher and duplicate reload work per session, potentially exhausting watcher/file-descriptor limits; attach the watcher to the shared workdir/project service and let sessions consume its rule snapshot.

Useful? React with 👍 / 👎.

Comment on lines +40 to +44
const configRules = this.config.get<PermissionConfig | undefined>(PERMISSION_SECTION)?.rules ?? [];
return dedupePermissionRules([
...this.agentState.get(permissionRulesKey).rules,
...this.projectRules.rules,
...configRules,

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 Preserve first-match ordering across rule decisions

When a persisted rule list uses a specific exception before a broader fallback—for example, allow Bash(git status) followed by deny Bash(git *)—the new merge sends the array to a policy engine that evaluates every deny rule before every allow rule. The broader deny therefore wins despite the documented contract that the first matching [[permission.rules]] entry takes effect; evaluate the merged list once in order rather than partitioning it by decision.

AGENTS.md reference: AGENTS.md:L131-L133

Useful? React with 👍 / 👎.

Comment on lines +41 to +44
return dedupePermissionRules([
...this.agentState.get(permissionRulesKey).rules,
...this.projectRules.rules,
...configRules,

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 Let hot reload revoke newly persisted rules

After addRules persists a user- or project-scoped rule, the same rule remains permanently in the Agent's live state and is merged ahead of the backing configuration. If the user removes or changes that rule in config.toml or local.toml, the watcher reload succeeds but the stale state copy continues to allow or deny matching calls until the Agent is recreated; remove durable scopes from live-only state after successful persistence or reconcile them when their source reloads.

AGENTS.md reference: AGENTS.md:L131-L133

Useful? React with 👍 / 👎.

Comment on lines +79 to +81
try {
await this.fs.mkdir(dirname(configPath), { recursive: true });
await this.fs.writeText(configPath, `${stringifyToml(file.raw)}\n`);

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 Refuse symlinked project-config write targets

On Unix-like systems, a checkout can make .kimi-code/local.toml or its parent directory a symlink outside the project, and this direct writeText follows that link. When the user persists a project rule, Kimi can consequently parse and overwrite an unrelated valid or empty TOML file outside the workspace; resolve the target without following untrusted links, verify containment under the project root, and use a safe atomic replacement.

AGENTS.md reference: AGENTS.md:L131-L133

Useful? React with 👍 / 👎.

@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: e04134fa53

ℹ️ 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 +44 to +46
this.trusted = await this.trust.get();
if (!this.trusted) return;
const loaded = await this.localConfig.readPermissionRules(this.cwd);

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 Do not trust project rules from remote targets

When a session uses an SSH, Docker, or command environment, this.cwd and localConfig refer to the remote target, but the injected IWorkspaceTrust still represents the local workspace. Because workspace trust explicitly covers local paths only (docs/en/guides/remote-environment.md:141), trusting the local folder currently causes this code to read the remote checkout's .kimi-code/local.toml without a corresponding trust decision, allowing that checkout to install allow rules and relax approvals. Skip target-side project rules for non-local environments until target-specific trust exists.

Useful? React with 👍 / 👎.

Comment on lines +39 to +44
export const PersistedPermissionRuleSchema = PermissionRuleSchema.extend({
scope: z.enum(['project', 'user']).default('user'),
});

export const PermissionConfigSchema = z.object({
rules: z.array(PermissionRuleSchema).optional(),
rules: z.array(PersistedPermissionRuleSchema).optional(),

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 Keep previously valid permission scopes loadable

Existing config.toml files could validly contain scope = "turn-override" or scope = "session-runtime" under the previous schema and documentation. Narrowing the persisted schema here, combined with the new unconditional readUserPermissionRules() validation during session materialization, now makes every new or resumed session fail until the user manually edits the file. The earlier silent-ignore case is resolved, but the newly added startup validation is fresh evidence of a compatibility regression; accept and evaluate these scopes or provide a migration rather than rejecting an already valid configuration.

AGENTS.md reference: AGENTS.md:L111-L113

Useful? React with 👍 / 👎.

- load and watch user and project permission rules
- persist scoped rule additions without losing concurrent writes
- use the active environment's workdir and filesystem for project rules
- keep durable rules out of live agent state and await writes
- load trusted project rules at session startup and fail closed
- use atomic project writes and update config documentation
@sailist
sailist force-pushed the feat-137-09-02-permission-rule-persistence branch from e04134f to 2d2e4c0 Compare October 30, 2026 08:21
@pkg-pr-new

pkg-pr-new Bot commented Oct 30, 2026 •

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

commit: 8a0808f

@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: 2d2e4c04ca

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

});

export const PersistedPermissionRuleSchema = PermissionRuleSchema.extend({
scope: z.enum(['project', 'user']).default('user'),

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 Reject project-scoped rules in the user config

When ~/.kimi-code/config.toml contains scope = "project", this shared persisted schema accepts it and readUserPermissionRules() subsequently supplies the rule to every agent in every workspace. An allow intended to be project-local can therefore silently relax approvals in unrelated projects; the user-config schema should accept only user, while .kimi-code/local.toml should accept/default only project.

AGENTS.md reference: AGENTS.md:L131-L133

Useful? React with 👍 / 👎.

Comment on lines +68 to +69
writes.push(enqueueUserConfigWrite(this.config, async () => {
const current = this.config.get<PermissionConfig | undefined>(PERMISSION_SECTION);

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 Serialize user-rule appends across processes

When two CLI or server processes persist user rules concurrently, each process has its own userConfigWriteTails entry and can read the same old permission.rules array before calling replace; the later whole-section write then silently drops the other process's rule. Use a cross-process locked read-modify-write or compare-and-retry mechanism for the shared user config.

AGENTS.md reference: AGENTS.md:L131-L133

Useful? React with 👍 / 👎.

async readPermissionRules(workDir: string): Promise<ProjectPermissionRulesLoadResult> {
const projectRoot = await this.findProjectRoot(workDir);
const configPath = this.getProjectLocalConfigPath(projectRoot);
const file = await this.readProjectLocalToml(configPath);

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 Avoid validating ignored legacy fields when loading rules

For a trusted managed workspace whose .kimi-code/local.toml contains a malformed legacy workspace.additional_dir, this call goes through readProjectLocalToml(), which validates the unrelated workspace section and rejects session readiness. Managed workspaces deliberately skipped that legacy section before this change, so an otherwise usable workspace can no longer start even when the file contains no permission rules; the permission-loading path should validate only the permission section.

AGENTS.md reference: AGENTS.md:L111-L113

Useful? React with 👍 / 👎.

Comment thread docs/en/configuration/config-files.md Outdated
`permission` sets permission rules that are automatically loaded when a session starts, controlling whether the Agent needs user confirmation before calling a tool. Rules are written as a `[[permission.rules]]` array of tables, matched in order; the first matching rule takes effect.
`permission` sets permission rules that are automatically loaded when a session starts, controlling whether the Agent needs user confirmation before calling a tool. Rules are written as a `[[permission.rules]]` array of tables. Matching `deny` rules take precedence over matching `ask` rules, which take precedence over matching `allow` rules.

User rules are loaded from the user `config.toml` at session startup. Project rules are read from `.kimi-code/local.toml` only when the workspace is trusted, with an omitted `scope` defaulting to `project`; project rule changes take effect in a new session and are not hot-reloaded.

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 Update the local.toml writeability documentation

This newly documented project-rule behavior is backed by code that appends rules to .kimi-code/local.toml, but the same page's project-local section still tells users that local.toml is a read-only legacy file that current versions never write. Users may therefore commit or manage the file under the false assumption that approval choices cannot modify it; update the English and Chinese project-local sections to describe permission-rule writes.

AGENTS.md reference: AGENTS.md:L111-L113

Useful? React with 👍 / 👎.

- ignore legacy runtime scopes in user config without warning
- reject project rule persistence in remote environments
- update configuration docs and the generated manifest

@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: 8a0808fc89

ℹ️ 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 +30 to +32
this.cwd = workdir.cwd ?? session.cwd;
this.local = workdir.environmentId === LOCAL_ENVIRONMENT_ID;
this.ready = this.local ? this.enqueue(() => this.loadFromDisk()) : Promise.resolve();

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 Do not reuse workspace trust for alternate local directories

When a server or SDK caller creates a session with environment_id: "local" and an environment_cwd outside the registered workspace, this.cwd points at that alternate checkout while this.trust still represents the registered workspace root. Trusting one workspace can therefore load .kimi-code/local.toml from an unrelated, never-trusted local checkout, whose allow rules can silently bypass approvals; derive trust for this.cwd or skip project rules when the local binding directory differs from the trusted root.

AGENTS.md reference: AGENTS.md:L131-L133

Useful? React with 👍 / 👎.

This branch has not been deployed

No deployments
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.

1 participant