@windyroad/risk-scorer 0.16.1-preview.900 → 0.16.2-preview.902
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/hooks/lib/risk-gate.sh
CHANGED
|
@@ -38,7 +38,7 @@ check_risk_gate() {
|
|
|
38
38
|
# 1. Score file must exist (fail-closed)
|
|
39
39
|
if [ ! -f "$SCORE_FILE" ]; then
|
|
40
40
|
RISK_GATE_CATEGORY="missing"
|
|
41
|
-
RISK_GATE_REASON="No ${ACTION} risk score found. Delegate to wr-risk-scorer:pipeline (subagent_type: 'wr-risk-scorer:pipeline') to assess cumulative pipeline risk."
|
|
41
|
+
RISK_GATE_REASON="No ${ACTION} risk score found. Delegate to wr-risk-scorer:pipeline (subagent_type: 'wr-risk-scorer:pipeline') to assess cumulative pipeline risk. Dispatch the scorer SYNCHRONOUSLY (run_in_background: false): a background-launched scorer does not fire its PostToolUse:Agent mark hook, so no marker persists and this gate re-blocks despite a within-appetite score (P402)."
|
|
42
42
|
return 1
|
|
43
43
|
fi
|
|
44
44
|
|
|
@@ -60,6 +60,13 @@ assert_gate_allows() {
|
|
|
60
60
|
assert_gate_denies "$TEST_SESSION" "commit" "No commit risk score found"
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
@test "missing-score deny instructs synchronous scorer dispatch (P402)" {
|
|
64
|
+
# A background-launched scorer's PostToolUse:Agent mark hook does not fire, so
|
|
65
|
+
# no marker persists and the gate re-blocks. The deny must tell the agent to
|
|
66
|
+
# dispatch synchronously. Mirrors external-comms-gate-canonical.bats.
|
|
67
|
+
assert_gate_denies "$TEST_SESSION" "commit" "run_in_background: false"
|
|
68
|
+
}
|
|
69
|
+
|
|
63
70
|
@test "score file with PENDING denies (non-numeric)" {
|
|
64
71
|
printf 'PENDING' > "$SCORE_FILE"
|
|
65
72
|
assert_gate_denies "$TEST_SESSION" "commit" "invalid value"
|
package/package.json
CHANGED
|
@@ -79,7 +79,7 @@ skill: wr-risk-scorer:external-comms
|
|
|
79
79
|
prompt: <constructed review prompt from step 3>
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
-
Wait for the wrapper to return. The wrapper invokes the external-comms agent internally
|
|
82
|
+
Wait for the wrapper to return. The wrapper invokes the external-comms agent internally **synchronously** (`run_in_background: false`) — the `PostToolUse:Agent` mark hook fires reliably only for a synchronous agent, so a background-launched reviewer never persists its marker and the gate re-blocks despite a PASS verdict (P402 / P407). The agent's structured verdict block (`EXTERNAL_COMMS_RISK_VERDICT: PASS|FAIL` + optional `EXTERNAL_COMMS_RISK_REASON: ...` on FAIL) flows back verbatim. The `PostToolUse:Agent` hook (`risk-score-mark.sh`) fires on the wrapper's inner Agent invocation, derives the marker key from the prompt's `SURFACE:` + `<draft>` structure, and writes the marker automatically on PASS.
|
|
83
83
|
|
|
84
84
|
**Do not write to `${TMPDIR:-/tmp}/claude-risk-*` yourself.** The hook is the only correct mechanism.
|
|
85
85
|
|
|
@@ -23,10 +23,11 @@ This SKILL is an **invokable wrapper** around the `wr-risk-scorer:external-comms
|
|
|
23
23
|
|
|
24
24
|
### 1. Pass-through to the external-comms agent
|
|
25
25
|
|
|
26
|
-
Invoke the external-comms subagent via the Agent tool with the caller's `$ARGUMENTS` verbatim. The `SURFACE:` line and `<draft>...</draft>` markers MUST be preserved exactly — the PostToolUse hook depends on the prompt structure for marker-key derivation:
|
|
26
|
+
Invoke the external-comms subagent via the Agent tool with the caller's `$ARGUMENTS` verbatim. The `SURFACE:` line and `<draft>...</draft>` markers MUST be preserved exactly — the PostToolUse hook depends on the prompt structure for marker-key derivation. Dispatch it **synchronously** (`run_in_background: false`) — the `PostToolUse:Agent` mark hook (`risk-score-mark.sh`) fires reliably only for a synchronous agent; a background-launched reviewer's mark hook does not fire in time, so no marker persists and the external-comms gate re-blocks despite a PASS verdict (P402):
|
|
27
27
|
|
|
28
28
|
```
|
|
29
29
|
subagent_type: wr-risk-scorer:external-comms
|
|
30
|
+
run_in_background: false
|
|
30
31
|
prompt: $ARGUMENTS
|
|
31
32
|
```
|
|
32
33
|
|
package/skills/pipeline/SKILL.md
CHANGED
|
@@ -20,10 +20,11 @@ This SKILL is an **invokable wrapper** around the `wr-risk-scorer:pipeline` agen
|
|
|
20
20
|
|
|
21
21
|
### 1. Pass-through to the pipeline agent
|
|
22
22
|
|
|
23
|
-
Invoke the pipeline subagent via the Agent tool with the caller's `$ARGUMENTS` verbatim:
|
|
23
|
+
Invoke the pipeline subagent via the Agent tool with the caller's `$ARGUMENTS` verbatim. Dispatch it **synchronously** (`run_in_background: false`) — the `PostToolUse:Agent` mark hook that writes the risk-gate marker fires reliably only for a synchronous agent; a background-launched scorer's mark hook does not fire in time, so no marker persists and the commit/push gate re-blocks despite a within-appetite score (P402):
|
|
24
24
|
|
|
25
25
|
```
|
|
26
26
|
subagent_type: wr-risk-scorer:pipeline
|
|
27
|
+
run_in_background: false
|
|
27
28
|
prompt: $ARGUMENTS
|
|
28
29
|
```
|
|
29
30
|
|