[Bug]: /permission status reports "Full access" while the runtime still enforces Auto — the displayed and enforced permission modes diverge
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 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分
- マージ済み PR(30日)
- 9
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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
-
area:api bug good first issue priority:high
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Doezer/Questarr#1486 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
area:import difficulty:good-first good first issue help wanted priority:P1 roadmap size:S type:test
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
Sergey-Bar/Penny#245 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
mihazs/lazysh#3377 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Approve the Cloudflare agent plugin for harness sessions対応中かも @joshtsch が今日担当しました。 オープンenhancement ready-for-agent
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信