fix: sanitize before-agent hook failure logs

This commit is contained in:
jesse-merhi
2026-05-06 16:37:56 +10:00
committed by clawsweeper
parent 27f63781f4
commit 77023b18e8
2 changed files with 4 additions and 3 deletions

View File

@@ -2855,7 +2855,7 @@ export async function runEmbeddedAttempt(
hookCtx,
);
} catch (err) {
log.warn(`before_agent_run hook failed: ${formatErrorMessage(err)}`);
log.warn("before_agent_run hook failed; blocking request");
beforeAgentRunBlocked = true;
beforeAgentRunBlockedBy = "before_agent_run";
await persistBlockedBeforeAgentRun({

View File

@@ -14,11 +14,12 @@ export type HookDecisionPass = {
export const BLOCK_MESSAGE_PREFIX = "Your message could not be sent";
/**
* Content is blocked. `reason` is internal; `message` is user-facing.
* Content is blocked. `reason` is internal plugin-local detail; core must not log,
* persist, broadcast, or expose it verbatim. `message` is user-facing detail.
*/
export type HookDecisionBlock = {
outcome: "block";
/** Internal reason for logging/observability. Never shown to user. */
/** Internal plugin-local reason. Do not log, persist, broadcast, or expose verbatim. */
reason: string;
/** Optional user-facing detail included in the block response envelope. */
message?: string;