Component: agent-core-v2 external hooks + goal feature
Observed (verified on latest main 7f5debf, also present in released 0.41.0):
packages/agent-core-v2/src/features/externalHooks/agent/agentExternalHooksService.ts:341:
if ((ctx.promptMessage.origin ?? USER_PROMPT_ORIGIN).kind !== 'user') return false;
so the UserPromptSubmit hook runs ONLY when the prompt origin kind is user.
- Goal continuations are submitted with a different origin —
packages/agent-core-v2/src/features/goal/goalService.ts:101:
{ kind: 'system_trigger', name: 'goal_continuation' }.
- Therefore during goal mode every auto-continuation turn skips the
UserPromptSubmit hook
entirely, however long the goal runs.
Impact: hooks configured on UserPromptSubmit (mailbox sweeps, session-facts injection,
input gating, metrics) silently never fire for the whole duration of a goal session, which is
exactly the mode where the machine is meant to work unattended. There is no other hook event
that fires per goal turn (PreToolUse/PostToolUse fire only when tools run; Stop/
PreCompact are turn/compaction-adjacent and do not carry prompt input).
Suggested fix (any of):
- Fire
UserPromptSubmit for system_trigger origins whose name is goal_continuation
(and document the matcher value), or
- Add a dedicated
GoalContinuation hook event so consumers opt in explicitly, or
- Document this exclusion in the hooks reference so consumers can choose
PostToolUse
instead.
Test seam exists: the hook service already subscribes to PromptQueued and TurnStarted;
a RED test asserting the hook runs on a goal-continuation-shaped prompt would cover it.
Component: agent-core-v2 external hooks + goal feature
Observed (verified on latest main 7f5debf, also present in released 0.41.0):
packages/agent-core-v2/src/features/externalHooks/agent/agentExternalHooksService.ts:341:if ((ctx.promptMessage.origin ?? USER_PROMPT_ORIGIN).kind !== 'user') return false;so the
UserPromptSubmithook runs ONLY when the prompt origin kind isuser.packages/agent-core-v2/src/features/goal/goalService.ts:101:{ kind: 'system_trigger', name: 'goal_continuation' }.UserPromptSubmithookentirely, however long the goal runs.
Impact: hooks configured on
UserPromptSubmit(mailbox sweeps, session-facts injection,input gating, metrics) silently never fire for the whole duration of a goal session, which is
exactly the mode where the machine is meant to work unattended. There is no other hook event
that fires per goal turn (
PreToolUse/PostToolUsefire only when tools run;Stop/PreCompactare turn/compaction-adjacent and do not carry prompt input).Suggested fix (any of):
UserPromptSubmitforsystem_triggerorigins whose name isgoal_continuation(and document the matcher value), or
GoalContinuationhook event so consumers opt in explicitly, orPostToolUseinstead.
Test seam exists: the hook service already subscribes to
PromptQueuedandTurnStarted;a RED test asserting the hook runs on a goal-continuation-shaped prompt would cover it.