Repository navigation
Description
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.
Activity