diff --git a/pm-stack/aggregator/scripts/sync-decision-events.ts b/pm-stack/aggregator/scripts/sync-decision-events.ts index d54c6a6831..1ea54c860c 100644 --- a/pm-stack/aggregator/scripts/sync-decision-events.ts +++ b/pm-stack/aggregator/scripts/sync-decision-events.ts @@ -98,11 +98,16 @@ function parseArgs(): { files: string[]; outboxDir?: string; target?: string; st } async function main(): Promise { + // Parse first, kill switch second (#9794): the operator-script + // contract (root AGENTS.md) requires every unaccounted-for + // argument to produce a non-zero usage error, and a disabled + // invocation is not exempt — a typo'd flag must exit 2, not + // silently succeed because the sync is switched off. + const opts = parseArgs(); if (process.env.DECISION_EVENTS_SYNC === "0") { console.log("sync-decision-events: disabled by DECISION_EVENTS_SYNC=0"); return 0; } - const opts = parseArgs(); const files = opts.files.length > 0 ? [...opts.files] : [defaultDecisionEventsOutboxFile()]; if (opts.outboxDir) { const entries = await readdir(opts.outboxDir).catch(() => [] as string[]);