Merge pull request 'fix: fix: agent_run nudges unnecessarily when worktree is clean and no push expected (#219)' (#223) from fix/issue-219 into main
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
This commit is contained in:
commit
f425bfa72e
1 changed files with 12 additions and 12 deletions
|
|
@ -72,21 +72,21 @@ agent_run() {
|
|||
local has_pushed
|
||||
has_pushed=$(cd "$run_dir" && git log --oneline "${FORGE_REMOTE:-origin}/${PRIMARY_BRANCH:-main}..HEAD" 2>/dev/null | head -1) || true
|
||||
if [ -z "$has_pushed" ]; then
|
||||
local nudge="You stopped but did not push any code. "
|
||||
if [ -n "$has_changes" ]; then
|
||||
nudge+="You have uncommitted changes. Commit them and push."
|
||||
# Nudge: there are uncommitted changes
|
||||
local nudge="You stopped but did not push any code. You have uncommitted changes. Commit them and push."
|
||||
log "agent_run: nudging (uncommitted changes)"
|
||||
output=$(cd "$run_dir" && timeout "${CLAUDE_TIMEOUT:-7200}" claude -p "$nudge" --resume "$_AGENT_SESSION_ID" --output-format json --dangerously-skip-permissions --max-turns 50 ${CLAUDE_MODEL:+--model "$CLAUDE_MODEL"} 2>>"$LOGFILE") || true
|
||||
new_sid=$(printf '%s' "$output" | jq -r '.session_id // empty' 2>/dev/null) || true
|
||||
if [ -n "$new_sid" ]; then
|
||||
_AGENT_SESSION_ID="$new_sid"
|
||||
printf '%s' "$new_sid" > "$SID_FILE"
|
||||
fi
|
||||
printf '%s' "$output" > "$diag_file" 2>/dev/null || true
|
||||
_AGENT_LAST_OUTPUT="$output"
|
||||
else
|
||||
nudge+="Complete the implementation, commit, and push your branch."
|
||||
log "agent_run: no push and no changes — skipping nudge"
|
||||
fi
|
||||
log "agent_run: nudging (no push detected)"
|
||||
output=$(cd "$run_dir" && timeout "${CLAUDE_TIMEOUT:-7200}" claude -p "$nudge" --resume "$_AGENT_SESSION_ID" --output-format json --dangerously-skip-permissions --max-turns 50 ${CLAUDE_MODEL:+--model "$CLAUDE_MODEL"} 2>>"$LOGFILE") || true
|
||||
new_sid=$(printf '%s' "$output" | jq -r '.session_id // empty' 2>/dev/null) || true
|
||||
if [ -n "$new_sid" ]; then
|
||||
_AGENT_SESSION_ID="$new_sid"
|
||||
printf '%s' "$new_sid" > "$SID_FILE"
|
||||
fi
|
||||
printf '%s' "$output" > "$diag_file" 2>/dev/null || true
|
||||
_AGENT_LAST_OUTPUT="$output"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue