[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
-
Media browser returns "Not found" for repositories using the SHA-256 object format可能已有人在做 @adamchodera 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 66/100
janhesters/remixcn#318 ·
維護者通常 1 天內回覆
-
Interceptor LaunchTestProfile.sh: no Windows (Git Bash/MSYS) branch, test profile never launches未關閉
難度 2/5 1-3 小時 新手友好度 84/100
danielmiessler/LifeOS#3150 ·
維護者通常 5 天內回覆
-
難度 2/5 1-3 小時 新手友好度 75/100
維護者通常 1 天內回覆
-
Make the "%" unit spacing the same in the web and in A10可能已有人在做 @kragent66-glitch 今天認領。 未關閉bug good first issue
難度 2/5 1-3 小時 新手友好度 74/100
maiychrus25/OpenTea-DX-OS#226 · 1 則留言 ·