Repository navigation
[Bug]: Local Runtime V2 loads Markdown hooks but does not dispatch UserPromptSubmit or user PreToolUse #131
Description
Version / 版本号
MiniMax Code Desktop 3.0.67.129 on Windows 11 x64.
Issue area / 问题类型
Local Runtime V2 / user hooks
What happened? / 问题描述
Local Runtime V2 loads documented Markdown hook registrations from %USERPROFILE%\.minimax\hooks, but normal Desktop turns do not dispatch user UserPromptSubmit or user PreToolUse hooks.
The registry is healthy: GET /mavis/api/hooks?agent=mavis returns HTTP 200 and lists the test hooks with the expected events, priorities, and matchers. The script adapters also pass direct documented-envelope tests. However, a new real Desktop session produces neither the UserPromptSubmit prompt marker nor the PreToolUse ^task$ argument mutation.
This is separate from hook parsing and separate from the task tool itself: the native task completes successfully, but receives the original prompt.
Steps to reproduce / 复现步骤
-
Create
%USERPROFILE%\.minimax\hooks\test-prompt.md:--- hookEvent: UserPromptSubmit type: script priority: 10 --- ```bash node.exe "%USERPROFILE%/.minimax/hooks/test-prompt.js" ```
-
Make the script read the documented
{ "input": ..., "output": ... }envelope and return a deterministic prompt marker. -
Confirm the hook appears in
GET /mavis/api/hooks?agent=mavisand passes direct execution with the documented envelope. -
Create a new Desktop session and send a prompt. The marker is absent.
-
Repeat with a
PreToolUsescript using matcher^task$that prepends a deterministic marker tooutput.toolArgs.prompt. -
Invoke native
task. The task succeeds, but receives the unmodified prompt.
Bundled-source evidence
The packaged Local Runtime source corroborates the live result:
node_modules/@mavis/local-runtime/src/debug/build-snapshot.tsstates that the local turn path does not runUserPromptSubmithooks and emits an executed count of zero.node_modules/@mavis/local-runtime-v2/src/compat/v1/agent-host.tsinstalls alocal-v1-user-hooksextension that callshosted.hooks.beforeToolCallandafterToolCall.- No corresponding
local-v2-user-hooksbridge exists in the packaged V2 host. The V2 executor can consumeassembly.hooks.beforeToolCallHook, but the hosted user-hook service is not wired into that assembly path.
Expected behavior / 预期行为
Normal Local Runtime V2 turns should dispatch the documented loaded user hooks, merge their output according to the bundled Hook contract, honor matchers and priority, and report accurate execution diagnostics.
If user hooks are intentionally unsupported in V2, the registry/API and bundled Hook documentation should say so explicitly and avoid presenting loaded registrations as active turn hooks.
Actual behavior / 实际行为
- Hook registry: loaded.
- Direct adapter/manual execution: passes.
- Real V2
UserPromptSubmit: not dispatched. - Real V2
PreToolUse ^task$: not dispatched. - Native task operation: succeeds without the hook mutation.
Local workaround
For project workflow rules, use a delimited global AGENTS.md rule plus an installed skill that performs live project/task discovery. This restores behavior for new sessions but cannot implement general user PreToolUse/PostToolUse semantics.
No application ASAR or official plugin-cache file was modified during diagnosis.
Activity
hetaoBackend commentedon Sep 21, 2026
Thanks for the precise isolation (registry returns the hooks with correct events/matchers; adapters pass envelope tests; real turns don't dispatch) — that cleanly separates parsing from dispatch.
Plugin-scoped hook dispatch in the v2 turn system is wired; what needs verification is whether user-scope (
~/.minimax/hooks) registrations are included in the turn dispatch path forUserPromptSubmit/PreToolUse, or only plugin-sourced hooks are. We'll audit the registry→dispatcher wiring for user-scope sources. Tracked as bug.hetaoBackend commentedon Oct 19, 2026
Closing as part of a backlog cleanup: this issue was filed more than a month ago against an older release, and the codebase has changed substantially since then. If it still reproduces on the latest version, please open a new issue with the current version and reproduction steps. Thank you for the report!
批量清理积压:该 issue 创建已超过一个月,针对的是较旧版本,代码已有较大变化。如果在最新版本上仍能复现,欢迎附上当前版本号和复现步骤重新提交 issue。感谢反馈!