fix: bug: architect-run.sh empty pitch — pitch_output=$(agent_run …) captures stdout but new agent_run writes to side-channels (#716)
Three fixes: 1. architect-run.sh:722 — extract `.result` not `.content` from claude JSON output. All other callers (dev-agent, formula-session) use `.result`; this was the direct cause of every pitch being empty. 2. lib/agent-sdk.sh — reset `_AGENT_LAST_OUTPUT=""` at the top of each `agent_run` call so stale data from a prior invocation can't bleed into the next caller when claude crashes or returns empty. 3. lib/agent-sdk.sh — scope the diagnostics file by `$LOG_AGENT` instead of hardcoding `dev/`. Concurrent agents (architect, gardener, planner, predictor) no longer clobber each other's diag output. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
a1da3d5c52
commit
cb9381f1e4
2 changed files with 6 additions and 2 deletions
|
|
@ -719,7 +719,7 @@ ${pitch_context}
|
|||
|
||||
# Extract pitch content from JSON response
|
||||
local pitch
|
||||
pitch=$(printf '%s' "$_AGENT_LAST_OUTPUT" | jq -r '.content // empty' 2>/dev/null) || pitch=""
|
||||
pitch=$(printf '%s' "$_AGENT_LAST_OUTPUT" | jq -r '.result // empty' 2>/dev/null) || pitch=""
|
||||
|
||||
if [ -z "$pitch" ]; then
|
||||
log "WARNING: empty pitch generated for vision issue #${issue_num}"
|
||||
|
|
|
|||
|
|
@ -131,6 +131,8 @@ agent_run() {
|
|||
done
|
||||
local prompt="${1:-}"
|
||||
|
||||
_AGENT_LAST_OUTPUT=""
|
||||
|
||||
local -a args=(-p "$prompt" --output-format json --dangerously-skip-permissions --max-turns 200)
|
||||
[ -n "$resume_id" ] && args+=(--resume "$resume_id")
|
||||
[ -n "${CLAUDE_MODEL:-}" ] && args+=(--model "$CLAUDE_MODEL")
|
||||
|
|
@ -171,7 +173,9 @@ agent_run() {
|
|||
|
||||
# Save output for diagnostics (no_push, crashes)
|
||||
_AGENT_LAST_OUTPUT="$output"
|
||||
local diag_file="${DISINTO_LOG_DIR:-/tmp}/dev/agent-run-last.json"
|
||||
local diag_dir="${DISINTO_LOG_DIR:-/tmp}/${LOG_AGENT:-dev}"
|
||||
mkdir -p "$diag_dir" 2>/dev/null || true
|
||||
local diag_file="${diag_dir}/agent-run-last.json"
|
||||
printf '%s' "$output" > "$diag_file" 2>/dev/null || true
|
||||
|
||||
# Nudge: if the model stopped without pushing, resume with encouragement.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue