fix(agent-loop): scope blocked admission cleanup

This commit is contained in:
_Kerman
2026-07-31 14:35:58 +08:00
parent 12a48558f2
commit c2ff9ddec8
18 changed files with 162 additions and 51 deletions

View File

@@ -222,7 +222,11 @@ export function apply(ctx: Context, config: Config): void {
const content = messages.flatMap(message => message.content)
const merged = await runPoint('UserPromptSubmit', '', promptPayload(ctx, agent, content), { agent, signal })
if (merged.decision === 'deny') {
return { kind: 'block', reason: merged.reason ?? 'blocked by UserPromptSubmit hook' }
return {
kind: 'block',
reason: merged.reason ?? 'blocked by UserPromptSubmit hook',
discardClaimed: true,
}
}
// Delegate so later listeners may still rewrite or block, then prepend our
// context only to a downstream allow decision.