Skip to content

[BUG] Sub-agent sessions cause gateway blocking — before_prompt_build hooks starve other sessions #601

@jlin53882

Description

@jlin53882

Issue #601 — Sub-agent sessions cause gateway blocking

Problem

When a sub-agent session (sessionKey contains :subagent:, e.g., agent:main:channel:123:subagent:def456) runs a before_prompt_build hook, the gateway thread is blocked because:

  1. auto-recall → LanceDB I/O (embedding + rerank)
  2. reflection-injector → LanceDB I/O (loadAgentReflectionSlices)

These run sequentially on the same thread. While the sub-agent is doing I/O, all user sessions wait.

Solution

Skip expensive before_prompt_build hooks for sub-agent sessions — they already inherit full context from the parent agent.

PR

PR #613#613

與 PR #516 的關係:為什麼不重疊?

PR 修改目標 Issue
#516 isInvalidAgentIdFormat() agent ID 驗證邏輯 #492
#613 before_prompt_build hooks 新增 subagent skip guard #601

兩者完全獨立:

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