Skip to content

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

Description

@tcflying

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions