diff --git a/.changeset/normalize-codex-risk-targets.md b/.changeset/normalize-codex-risk-targets.md new file mode 100644 index 00000000..09c53b82 --- /dev/null +++ b/.changeset/normalize-codex-risk-targets.md @@ -0,0 +1,5 @@ +--- +"@windyroad/risk-scorer": patch +--- + +Recognize relative Codex completion targets for canonically named risk agents. diff --git a/packages/risk-scorer/hooks/codex-agent-completion.mjs b/packages/risk-scorer/hooks/codex-agent-completion.mjs index 40dd2fbb..7ef9ed88 100644 --- a/packages/risk-scorer/hooks/codex-agent-completion.mjs +++ b/packages/risk-scorer/hooks/codex-agent-completion.mjs @@ -65,7 +65,8 @@ function diagnoseSubagentStop(input, outcome, reason) { } function statePath(input, target, suffix = "") { - return join(riskDir(input.session_id), `codex-agent-${Buffer.from(target).toString("base64url")}${suffix}`); + const normalized = target.startsWith("/root/") ? target.slice("/root/".length) : target; + return join(riskDir(input.session_id), `codex-agent-${Buffer.from(normalized).toString("base64url")}${suffix}`); } function clearTarget(input, target) { diff --git a/packages/risk-scorer/hooks/test/codex-agent-completion.bats b/packages/risk-scorer/hooks/test/codex-agent-completion.bats index 7f6988b3..d48f176d 100644 --- a/packages/risk-scorer/hooks/test/codex-agent-completion.bats +++ b/packages/risk-scorer/hooks/test/codex-agent-completion.bats @@ -70,7 +70,7 @@ current_pipeline_close_input() { direct_pipeline_interrupt_input() { printf '{"session_id":"%s","cwd":"%s","tool_name":"interrupt_agent","tool_input":{"target":"%s"},"tool_response":{"previous_status":{"completed":"RISK_SCORES: commit=4 push=4 release=4\\nRISK_CWD: %s"}}}' \ - "$SESSION" "$OTHER_REPO" "$TARGET" "$PIPELINE_REPO" + "$SESSION" "$OTHER_REPO" "${TARGET#/root/}" "$PIPELINE_REPO" } current_empty_wait_input() {