Skip to content

PermissionRequest hook does not fire when the approval prompt originates from a (background) subagent #4070

Description

@Natsume-kkk

Summary

When a (background) subagent's tool call requires user approval, the approval prompt renders in the main TUI, but:

  • no PermissionRequest hook fires, and
  • nothing is written to either the main or the subagent wire.jsonl while the prompt is pending.

Only after the user decides does the subagent wire record interaction.resolved and permission.record_approval_result. Approvals triggered by the main agent's own tool calls are unaffected.

Environment

  • kimi-code 2.1.1
  • Windows 11
  • Permission mode: Ask When Needed

Steps to reproduce

  1. Configure a PermissionRequest hook in ~/.kimi-code/config.toml, e.g. one that appends the stdin payload to a log file.
  2. In an interactive session, have the main agent dispatch a background coder subagent that executes a command requiring approval (e.g. a recursive delete).
  3. Wait for the approval prompt to appear in the TUI.

Actual behavior

  • The approval prompt renders and waits in the main TUI.
  • The PermissionRequest hook is never invoked (log stays empty).
  • Neither agents/main/wire.jsonl nor agents/<subagent>/wire.jsonl records anything while the prompt is pending; the subagent wire only records interaction.resolved and permission.record_approval_result after the user approves or rejects.

Expected behavior

PermissionRequest fires for subagent-originated approval waits too — ideally carrying agent identity (agent_name / agent_id) as proposed in #3742, so observers can tell which subagent is blocked.

Impact

Any external approval-notification tooling (terminal workbenches, remote approval via hooks) cannot detect that the session is blocked on a subagent approval. From the outside the session looks idle while it is actually waiting for the user. This defeats hook-driven approval UX exactly where it is most needed: unattended background delegation.

Related

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