fix: give QA fix agents full mock test output instead of 10-line snippets (#988)

Previously, Phase 3 fix agents only got the last 10 lines grepped from
the log file per failing script. This was often insufficient to diagnose
the root cause. Now runs `bash test/mock.sh {cloud}` per failing cloud
and feeds the complete output to the fix agent.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Ahmed Abushagur 2026-02-13 11:59:59 -08:00 committed by GitHub
parent fff84779dc
commit e720e15c9b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -546,6 +546,15 @@ else
FAILED_CLOUDS=$(grep ':fail$' "${RESULTS_PHASE2}" | sed 's/:fail$//' | cut -d/ -f1 | sort -u || true)
fi
# Capture full mock test output per-cloud for richer agent context
MOCK_OUTPUT_DIR="/tmp/spawn-qa-mock-output"
rm -rf "${MOCK_OUTPUT_DIR}"
mkdir -p "${MOCK_OUTPUT_DIR}"
for cloud in $FAILED_CLOUDS; do
log "Phase 3: Capturing full mock test output for ${cloud}..."
bash test/mock.sh "$cloud" > "${MOCK_OUTPUT_DIR}/${cloud}.log" 2>&1 || true
done
AGENT_PIDS=""
for cloud in $FAILED_CLOUDS; do
check_timeout || break
@ -554,25 +563,21 @@ else
cloud_failures=$(printf '%s\n' $FAILURES | grep "^${cloud}/" || true)
failing_scripts=""
failing_agents=""
error_context=""
for combo in $cloud_failures; do
agent=$(printf '%s' "$combo" | cut -d/ -f2)
script_path="${cloud}/${agent}.sh"
failing_scripts="${failing_scripts} ${script_path}"
failing_agents="${failing_agents} ${agent}"
if [[ -f "${LOG_FILE}" ]]; then
ctx=$(grep -A 10 "test ${script_path}" "${LOG_FILE}" | tail -10 || true)
if [[ -n "$ctx" ]]; then
error_context="${error_context}
--- ${script_path} ---
${ctx}
"
fi
fi
done
failing_scripts=$(printf '%s' "$failing_scripts" | sed 's/^ //')
failing_agents=$(printf '%s' "$failing_agents" | sed 's/^ //')
# Use full mock test output as error context (not just 10 lines from log)
error_context=""
if [[ -f "${MOCK_OUTPUT_DIR}/${cloud}.log" ]]; then
error_context=$(cat "${MOCK_OUTPUT_DIR}/${cloud}.log")
fi
fail_count=$(printf '%s\n' $cloud_failures | wc -l | tr -d ' ')
log "Phase 3: Spawning teammate to fix ${fail_count} failing script(s) in ${cloud}"
@ -680,6 +685,9 @@ FIXEOF
done
git worktree prune 2>/dev/null || true
# Clean up per-cloud mock output
rm -rf "${MOCK_OUTPUT_DIR}" 2>/dev/null || true
log "Phase 3: Fix teammates complete"
fi