fix(loop): repair review-diff/verdict-parsing bugs, deduplicate session lookups
Applies the P0-P3 fixes from the multi-agent-mux-loop audit (.mam/jobs/ab686e47/claude-reports/report-final.md): - P0-1: capture BASE_COMMIT before Phase 2 and diff against it, so reviewer diffs stay non-empty and cumulative even after the Creator commits per the documented DoD (bare `git diff` alone showed nothing once committed). - P0-2: has_verdict now matches only the report's last non-blank line, so a stray [VERDICT: ...] token quoted mid-report as a formatting example can no longer flip the outcome. - P1-1: replace the English-only refactor/complex/design/architect keyword sniff (dead code against Korean-language reviewer reports) with an explicit [ESCALATE: PLANNER] tag the reviewer prompt now asks for. - P1-2: resolve_all_reviewers/resolve_agent_type/resolve_planner_session now read through lib.sh's load_state_json single source of truth instead of each hand-rolling its own SQLite+YAML lookup; resolve_agent_type's name fallback matches exact hyphen segments instead of a substring `in` check. - P2-1: warn when --all-reviewer and --reviewer are both given, since the latter is silently discarded. - P2-2: correct the SKILL.md CLI-mapping table row that overstated an automated lint gate and an unconditional Planner feedback loop. - P3: fix lib.sh shellcheck SC2164 (unguarded cd in start_watchdog) and annotate the intentional SC2317 dual source/exec guard. Verified: shellcheck clean on both scripts, bash -n syntax OK, and the rewritten has_verdict/resolve_* functions were unit-tested against this repo's live .mam/agent-sessions state. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -16,6 +16,9 @@
|
||||
|
||||
if [ -z "${BASH_VERSION:-}" ]; then
|
||||
echo "ERROR: lib.sh must be executed/sourced from bash (foreign shell detected)" >&2
|
||||
# Reachable when this file is executed directly rather than sourced;
|
||||
# `return` only fails (falling through to `exit`) in that path.
|
||||
# shellcheck disable=SC2317
|
||||
return 1 2>/dev/null || exit 1
|
||||
fi
|
||||
SKILL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
@@ -1018,10 +1021,10 @@ start_watchdog() {
|
||||
# Start the wildcard monitor subscriber daemon with --idle-timeout 0 (never idle out)
|
||||
# and ensure it runs with $workdir as cwd to anchor relative log paths.
|
||||
local orig_pwd="$PWD"
|
||||
cd "$workdir"
|
||||
cd "$workdir" || return 1
|
||||
nohup bash "$monitor_script" --subscribe --idle-timeout 0 >> "$log_file" 2>&1 &
|
||||
pid=$!
|
||||
cd "$orig_pwd"
|
||||
cd "$orig_pwd" || return 1
|
||||
fi
|
||||
|
||||
echo "$pid"
|
||||
|
||||
Reference in New Issue
Block a user