[Bug]: /permission status reports "Full access" while the runtime still enforces Auto — the displayed and enforced permission modes diverge
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 28/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- nodejs, typescript
- 领域
- cli
调研方向
Start by reading packages/tui/src/tui/controller/interaction/permission-mode-flow.ts and packages/tui/src/runtime/adapters/product-access.ts, then compare with the accessor in packages/local-runtime/src/permissions/facade.ts and the routes in packages/local-runtime/src/api/routes/permissions.ts. Reproduce with /permission status against an ask rule in ~/.minimax/permission.json and diff the printed mode against the permission.decision lines in the session runtime log. Done means the displayed mode is resolved through the facade's accessor (or flagged as unapplied) and /permission full re-applies instead of returning early.
由索引模型根据 Issue 内容生成。
描述
Product or interface
CLI - interactive TUI
Version
0.7.7 (npm @minimax-ai/code). Note the public repo's latest release tag is v0.7.2, so main may not reflect the shipped build — the file paths below are cited from main, where the structure still matches.
Platform
Linux
OS version and architecture
NixOS 26.11 (Zokor) x86_64, kernel 6.18.56
Issue area
Tool call / permission / sandbox
Desktop log upload ID (optional)
No response
Steps to reproduce
-
Launch the interactive TUI (
mcode). -
Run
/permission status. It prints:Permission mode: Full access.(
Full accessis the label forbypassPermissions—PERMISSION_MODE_LABELSinpackages/tui/src/application/permission-mode.ts.) -
Run any command that matches an
askrule in~/.minimax/permission.json. Minimal synthetic example — with this rule in place:"ask": [ { "tool_name": "bash", "matcher": { "kind": "command", "pattern": "mv:*" } } ]the command
mv ./a.txt ./b.txtstill raises a permission card. -
Inspect the runtime log at
~/.minimax/v2/observability/logs/sessions/<sessionId>/runtime-*.log. Every decision recordsauto:{"tool_name":"bash","permission_mode":"auto","policy_owner":"core","raw_behavior":"ask","final_behavior":"ask","ask_gate_applied":false,"raw_rule_count":1}and every permission-context snapshot records
autotoo:{"agent_name":"...","permission_mode":"auto","native_delete":true,"working_directory":"/tmp","rules":[...]} -
~/.minimax/config.yamlstill containspermissionMode: auto, and noconfig.permission_mode.changedevent was ever emitted (that event is published byapplyAfterin the config writer wheneverpermissionModeis actually written).
Expected and actual behavior
Expected: the mode reported by /permission status and the status bar is the mode the permission engine actually enforces. If they differ, the UI should say so.
Actual: /permission status reports bypassPermissions ("Full access") while the engine enforces auto. Every ask rule in ~/.minimax/permission.json still fires, and permission cards keep appearing.
The value shown in the UI is never persisted anywhere: config.yaml is unchanged, no config.permission_mode.changed event was emitted, and no file under ~/.minimax stores the string bypassPermissions (checked JSON/YAML/SQLite — the only SQLite hits are unrelated historical chat transcripts). So the reported bypassPermissions is a process-local / host-local value the turn system never observes.
Redacted error summary
# /permission status
Permission mode: Full access.
# ~/.minimax/v2/observability/logs/sessions/<sessionId>/runtime-<date>.log
[13:10:05.470] INFO: [] permission.context {"agent_name":"...","permission_mode":"auto","native_delete":true,"working_directory":"/tmp","rules":[...]}
[13:10:05.471] INFO: [] permission.decision {"tool_name":"bash","permission_mode":"auto","policy_owner":"core","raw_behavior":"ask","final_behavior":"ask","ask_gate_applied":false,"raw_rule_count":1}
[13:11:30.951] INFO: [] permission.context {"agent_name":"...","permission_mode":"auto",...}
[13:11:30.952] INFO: [] permission.decision {"tool_name":"read","permission_mode":"auto","policy_owner":"core","raw_behavior":"ask","final_behavior":"ask",...}
[13:12:01.254] INFO: [] permission.context {"agent_name":"...","permission_mode":"auto",...}
... (14/14 permission.context snapshots and 62/62 permission.decision records in this session say "auto")
# ~/.minimax/config.yaml
permission:
nativeDelete: true
permissionMode: auto
Root cause analysis
The mode the UI displays and the mode the engine enforces are resolved through two different accessors, and in this session they disagree.
What the TUI displays
packages/tui/src/tui/controller/interaction/permission-mode-flow.ts → runtime.getPermissionMode()
→ packages/tui/src/runtime/adapters/product-access.ts:77-79 → context.service("config.permission.read").getPermissionMode()
→ packages/local-runtime-v2/src/compat/v1/runtime.ts:855-856:
getPermissionMode: async () =>
readLocalPermissionMode(host.apiHost.configGetter().permissionMode),
What the engine enforces
packages/local-runtime/src/permissions/facade.ts:460-466:
const config = this.deps.configGetter();
...
params.permissionModeOverride ??
readLocalPermissionMode(config.permissionMode);
and the route that feeds it, packages/local-runtime/src/api/routes/permissions.ts:97-104 and 188-199:
const permissionMode = readLocalPermissionMode(ctx.configGetter().permissionMode);
...
permissionModeOverride: permissionMode,
The facade's own doc comment states the intent:
configGetter()is a live view of daemon config, andPUT /config { permissionMode: ... }can flip … the pipeline then falls back to a freshconfigGetter()read
Both sides call configGetter().permissionMode, so in principle they cannot diverge — yet here they do. packages/local-runtime/src/api/host.ts:469 shows the host's getter is options.configGetter ?? (() => getConfig()), so the value ultimately comes from getConfig() or a host-supplied closure. Which of the two configGetter instances (route context vs. facade deps vs. getConfig()) is the stale one, and where does the bypassPermissions value in the TUI's copy originate?
The published 0.7.7 bundle also contains a launch-time / process-scope override that the public main branch does not show: the minified build has aN = t.permissionMode feeding configGetter(), plus a permissionModeScope === "process" path that writes the mode into process memory instead of config.yaml. That is the most likely source of a value visible in the UI but never written to config.yaml — but it could not be confirmed against main.
Secondary problem: /permission full is a no-op in this state
packages/tui/src/tui/controller/interaction/permission-mode-flow.ts:
async set(nextMode: TuiPermissionMode): Promise<void> {
if (this.isStopped() || this.updatingValue) return;
if (!this.modeValue) { ... return; }
if (nextMode === this.modeValue) {
this.options.setHint(`Permission mode · ${formatTuiPermissionMode(nextMode)}`);
this.options.onChanged();
return; // ← early return, nothing is written
}
...
const mode = await this.options.runtime.setPermissionMode(nextMode);
Because the UI already believes the mode is bypassPermissions, running /permission full only shows a hint and never calls setPermissionMode. The user can neither re-apply the mode they think they selected nor fall back to a working state through the obvious path. Alt+M (nextTuiPermissionMode) cycles default → auto → bypassPermissions → default, so it does escape the state, but the early return makes the UI look stuck.
Impact
- The failure direction is fail-safe — the UI looks more permissive than the enforcement actually is, so nothing is over-permitted — but the user's model of what is guarded is wrong, and the mode cannot be applied from the UI.
mcode exec --permission fullis unaffected and does enforcebypassPermissions(verified separately:askrules are skipped,denyrules and the catastrophic-command layer still apply).
Workaround
Write the mode into ~/.minimax/config.yaml directly (permissionMode: bypassPermissions) and restart the session, or cycle the mode with Alt+M until the write actually happens.
Suggested fixes
- Make
/permission statusand the status bar report the mode the engine will actually enforce (resolve it through the same accessor the facade uses), or mark the value as "not applied" when the two disagree. - Drop the
nextMode === this.modeValueearly return, or make it re-apply the mode instead of doing nothing — a user who selects the mode they already see should still get it applied. - Investigate why a
bypassPermissionsvalue can be visible to the TUI without ever being written toconfig.yamlor published asconfig.permission_mode.changed.
Screenshots
No response
Before submitting
- I have searched existing issues.
- I have included my version and removed sensitive information.
- 主要语言
- TypeScript
- 星标
- 2.3k
- 派生
- 315
- 平均合并
- 3 小时 54 分钟
- 30 天内合并 PR
- 9
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
MiniMax-AI/minimax-code 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
MiniMax-AI/minimax-code#639 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
MiniMax-AI/minimax-code#636 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
MiniMax-AI/minimax-code#615 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
MiniMax-AI/minimax-code#556 · 4 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
MiniMax-AI/minimax-code#507 ·
维护者通常 1 天内回复
查看 MiniMax-AI/minimax-code 的全部 Issue
相似的 Issue
-
blocklist addition
难度 1/5 1 小时以内 新手友好度 76/100
MetaMask/eth-phishing-detect#319194 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
continuedev/continue#13533 · 1 条评论 ·
维护者通常 6 天内回复
-
bug codex:automation
难度 2/5 1-3 小时 新手友好度 76/100
genfeedai/genfeed.ai#12060 ·
维护者通常 1 天内回复
-
bounty good first issue help wanted
难度 2/5 1-3 小时 新手友好度 78/100
fitzss/valun-open#15 · 1 条评论 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复