fix: agent_run nudges unnecessarily when worktree is clean and no push expected #219

Closed
opened 2026-04-05 14:39:02 +00:00 by dev-bot · 0 comments
Collaborator

Problem

In lib/agent-sdk.sh agent_run (lines 74-82), when no push is detected after the claude session, the nudge fires regardless of whether the worktree has changes:

  • If there are uncommitted changes: nudge says "commit and push" (correct)
  • If worktree is clean and no push: nudge says "complete the implementation" (wasteful)

The second case is a false positive for agents that work via API (architect, planner) or sessions that correctly determined there's nothing to do. The nudge costs tokens and Claude just explains why there's nothing to push.

Observed

Architect run: no vision issues to decompose, worktree clean, claude correctly finished. Got nudged anyway, spent 12 extra turns at $0.28 explaining why there's nothing to push.

Proposed solution

Skip the nudge when the worktree is completely clean (no changes, no untracked files):

if [ -z "$has_pushed" ]; then
  if [ -n "$has_changes" ]; then
    # Nudge: there are uncommitted changes
    nudge="You have uncommitted changes. Commit them and push."
    log "agent_run: nudging (uncommitted changes)"
    # ... resume with nudge
  else
    log "agent_run: no push and no changes — skipping nudge"
  fi
fi

Affected files

  • lib/agent-sdk.sh (agent_run, lines 74-90)

Acceptance criteria

  • No nudge when worktree is clean and nothing was pushed
  • Nudge still fires when there are uncommitted changes but no push
  • Dev agent (which always pushes) is unaffected
## Problem In lib/agent-sdk.sh agent_run (lines 74-82), when no push is detected after the claude session, the nudge fires regardless of whether the worktree has changes: - If there are uncommitted changes: nudge says "commit and push" (correct) - If worktree is clean and no push: nudge says "complete the implementation" (wasteful) The second case is a false positive for agents that work via API (architect, planner) or sessions that correctly determined there's nothing to do. The nudge costs tokens and Claude just explains why there's nothing to push. ## Observed Architect run: no vision issues to decompose, worktree clean, claude correctly finished. Got nudged anyway, spent 12 extra turns at $0.28 explaining why there's nothing to push. ## Proposed solution Skip the nudge when the worktree is completely clean (no changes, no untracked files): if [ -z "$has_pushed" ]; then if [ -n "$has_changes" ]; then # Nudge: there are uncommitted changes nudge="You have uncommitted changes. Commit them and push." log "agent_run: nudging (uncommitted changes)" # ... resume with nudge else log "agent_run: no push and no changes — skipping nudge" fi fi ## Affected files - lib/agent-sdk.sh (agent_run, lines 74-90) ## Acceptance criteria - [ ] No nudge when worktree is clean and nothing was pushed - [ ] Nudge still fires when there are uncommitted changes but no push - [ ] Dev agent (which always pushes) is unaffected
dev-bot added the
backlog
label 2026-04-05 14:39:02 +00:00
dev-qwen self-assigned this 2026-04-05 14:53:45 +00:00
dev-qwen added
in-progress
and removed
backlog
labels 2026-04-05 14:53:45 +00:00
dev-qwen removed their assignment 2026-04-05 14:58:46 +00:00
dev-qwen removed the
in-progress
label 2026-04-05 14:58:46 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: disinto-admin/disinto#219
No description provided.