From d9ec148bb323755cd8f2e14acd38d6f19c1d48a3 Mon Sep 17 00:00:00 2001 From: Christian Nennemann Date: Sat, 4 Apr 2026 07:42:31 +0200 Subject: [PATCH] fix: address review findings (rollback mainline, audit flag, confidence gate, test pattern, jq args) - git revert uses --mainline 1 for merge commits - inject dispatch passes all args so --audit flag is reachable - confidence gate defaults to 0.0 (triggers gate) instead of 0.7 (bypasses) - test-first grep uses word-boundary patterns to avoid false positives - jq uses --arg instead of string interpolation for safe filtering --- lib/archeflow-memory.sh | 6 +++--- lib/archeflow-rollback.sh | 2 +- skills/run/SKILL.md | 15 ++++++++++----- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/lib/archeflow-memory.sh b/lib/archeflow-memory.sh index a4d4a32..a051fe8 100755 --- a/lib/archeflow-memory.sh +++ b/lib/archeflow-memory.sh @@ -296,7 +296,7 @@ cmd_audit_check() { # Get lessons injected for this run local injected - injected=$(jq -c "select(.run_id == \"$run_id\")" "$AUDIT_FILE" 2>/dev/null || true) + injected=$(jq -c --arg rid "$run_id" 'select(.run_id == $rid)' "$AUDIT_FILE" 2>/dev/null || true) if [[ -z "$injected" ]]; then echo "No audit records for run $run_id." >&2 @@ -319,7 +319,7 @@ cmd_audit_check() { # Get lesson description local lesson_desc - lesson_desc=$(jq -r "select(.id == \"$lid\") | .description" "$LESSONS_FILE" 2>/dev/null | head -1) + lesson_desc=$(jq -r --arg lid "$lid" 'select(.id == $lid) | .description' "$LESSONS_FILE" 2>/dev/null | head -1) [[ -z "$lesson_desc" ]] && continue # Check keyword overlap between lesson and findings @@ -515,7 +515,7 @@ case "$COMMAND" in cmd_extract "$1" ;; inject) - cmd_inject "${1:-}" "${2:-}" + cmd_inject "$@" ;; add) [[ $# -lt 2 ]] && { echo "Usage: $0 add " >&2; exit 1; } diff --git a/lib/archeflow-rollback.sh b/lib/archeflow-rollback.sh index 6d3aace..7a793e1 100755 --- a/lib/archeflow-rollback.sh +++ b/lib/archeflow-rollback.sh @@ -48,7 +48,7 @@ if timeout 300 bash -c "$TEST_CMD"; then fi echo "Tests FAILED — reverting merge..." -git revert --no-edit HEAD +git revert --no-edit --mainline 1 HEAD # Emit event if event script exists if [[ -x "$SCRIPT_DIR/archeflow-event.sh" ]]; then diff --git a/skills/run/SKILL.md b/skills/run/SKILL.md index 9a79083..3f4aba8 100644 --- a/skills/run/SKILL.md +++ b/skills/run/SKILL.md @@ -157,10 +157,15 @@ TASK_UNDERSTANDING=$(grep -i "task understanding" "$CONF_FILE" | grep -oE '[0-9] SOLUTION_COMPLETENESS=$(grep -i "solution completeness" "$CONF_FILE" | grep -oE '[0-9]+\.[0-9]+' | head -1) RISK_COVERAGE=$(grep -i "risk coverage" "$CONF_FILE" | grep -oE '[0-9]+\.[0-9]+' | head -1) -# Fallback: if unparseable, treat as 0.7 (safe default — proceed but not overconfident) -TASK_UNDERSTANDING="${TASK_UNDERSTANDING:-0.7}" -SOLUTION_COMPLETENESS="${SOLUTION_COMPLETENESS:-0.7}" -RISK_COVERAGE="${RISK_COVERAGE:-0.7}" +# Fallback: if unparseable, emit warning and default to 0.0 (triggers gate, not bypasses it) +if [[ -z "$TASK_UNDERSTANDING" || -z "$SOLUTION_COMPLETENESS" || -z "$RISK_COVERAGE" ]]; then + echo "WARNING: Could not parse confidence scores from plan-creator.md" >&2 + ./lib/archeflow-event.sh "$RUN_ID" decision plan "" \ + '{"what":"confidence_parse_failure","chosen":"warn","rationale":"one or more scores unparseable"}' "$SEQ_CREATOR_COMPLETE" +fi +TASK_UNDERSTANDING="${TASK_UNDERSTANDING:-0.0}" +SOLUTION_COMPLETENESS="${SOLUTION_COMPLETENESS:-0.0}" +RISK_COVERAGE="${RISK_COVERAGE:-0.0}" ``` **Pause branch** (Task understanding < 0.5): @@ -268,7 +273,7 @@ After Maker returns: After Maker completes, check `do-maker-files.txt` for test files: ```bash -TEST_FILES=$(grep -iE '(test|spec)' ".archeflow/artifacts/${RUN_ID}/do-maker-files.txt" || true) +TEST_FILES=$(grep -iE '([/_.-](test|spec)[/_.-]|\.(test|spec)\.|_(test|spec)\.|/tests?/|/__tests__/|/specs?/)' ".archeflow/artifacts/${RUN_ID}/do-maker-files.txt" || true) ``` If `TEST_FILES` is empty and domain is not `writing`: