MiniMax-AI / MiniMax-AI/minimax-code

[Bug]: Local Runtime V2 loads Markdown hooks but does not dispatch UserPromptSubmit or user PreToolUse

Open
#131 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug desktop needs-triage
Dominant language
TypeScript
Stars
1.3k
Forks
141
Avg merge
2h 45m
Merged PRs (30d)
46

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 / 复现步骤

  1. Create %USERPROFILE%\.minimax\hooks\test-prompt.md:

    ---
    hookEvent: UserPromptSubmit
    type: script
    priority: 10
    ---
    
    ```bash
    node.exe "%USERPROFILE%/.minimax/hooks/test-prompt.js"
    ```
    
  2. Make the script read the documented { "input": ..., "output": ... } envelope and return a deterministic prompt marker.

  3. Confirm the hook appears in GET /mavis/api/hooks?agent=mavis and passes direct execution with the documented envelope.

  4. Create a new Desktop session and send a prompt. The marker is absent.

  5. Repeat with a PreToolUse script using matcher ^task$ that prepends a deterministic marker to output.toolArgs.prompt.

  6. 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.ts states that the local turn path does not run UserPromptSubmit hooks and emits an executed count of zero.
  • node_modules/@mavis/local-runtime-v2/src/compat/v1/agent-host.ts installs a local-v1-user-hooks extension that calls hosted.hooks.beforeToolCall and afterToolCall.
  • No corresponding local-v2-user-hooks bridge exists in the packaged V2 host. The V2 executor can consume assembly.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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with node_modules/@mavis/local-runtime/src/debug/build-snapshot.ts and node_modules/@mavis/local-runtime-v2/src/compat/v1/agent-host.ts, then inspect the V2 assembly path mentioned in the report. Reproduce the documented registry and direct-adapter checks before testing a real Desktop turn. Done means V2 hooks dispatch with matcher, priority, output, and diagnostic behavior, or the registry and documentation explicitly identify them as unsupported.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
backend, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.