fix: agent_run swallows all Claude failures silently via || true #277

Closed
opened 2026-04-06 09:21:31 +00:00 by dev-bot · 1 comment
Collaborator

Problem

lib/agent-sdk.sh line 53:

output=$(cd "$run_dir" && flock -w 600 "$lock_file" timeout ... claude ... 2>>"$LOGFILE") || true

The || true means timeout, API auth failure, OOM kill, and signal termination all produce exit code 0. The calling scripts check nothing after agent_run. If Claude fails, output is empty, session_id is empty, and the nudge logic runs with an empty session ID then also fails silently.

This caused the cascading empty-output failures we observed on issues #239, #266, #267, #268.

Fix

Capture the exit code and log it. Distinguish between expected outcomes and failures:

output=$(cd "$run_dir" && flock ... timeout ... claude ... 2>>"$LOGFILE")
local rc=$?
if [ $rc -eq 124 ]; then
  log "agent_run: timeout after ${CLAUDE_TIMEOUT:-7200}s"
elif [ $rc -ne 0 ]; then
  log "agent_run: claude exited with code $rc"
fi

Skip the nudge when output is empty (Claude crashed, nothing to nudge).

Affected files

  • lib/agent-sdk.sh (lines 53 and 81)

Acceptance criteria

  • Non-zero exit codes from claude are logged with the actual code
  • Timeout (exit 124) is logged distinctly
  • Nudge is skipped when output is empty
  • Empty output produces a clear log message instead of silent failure
## Problem lib/agent-sdk.sh line 53: output=$(cd "$run_dir" && flock -w 600 "$lock_file" timeout ... claude ... 2>>"$LOGFILE") || true The `|| true` means timeout, API auth failure, OOM kill, and signal termination all produce exit code 0. The calling scripts check nothing after agent_run. If Claude fails, output is empty, session_id is empty, and the nudge logic runs with an empty session ID then also fails silently. This caused the cascading empty-output failures we observed on issues #239, #266, #267, #268. ## Fix Capture the exit code and log it. Distinguish between expected outcomes and failures: output=$(cd "$run_dir" && flock ... timeout ... claude ... 2>>"$LOGFILE") local rc=$? if [ $rc -eq 124 ]; then log "agent_run: timeout after ${CLAUDE_TIMEOUT:-7200}s" elif [ $rc -ne 0 ]; then log "agent_run: claude exited with code $rc" fi Skip the nudge when output is empty (Claude crashed, nothing to nudge). ## Affected files - lib/agent-sdk.sh (lines 53 and 81) ## Acceptance criteria - [ ] Non-zero exit codes from claude are logged with the actual code - [ ] Timeout (exit 124) is logged distinctly - [ ] Nudge is skipped when output is empty - [ ] Empty output produces a clear log message instead of silent failure
dev-bot added the
backlog
label 2026-04-06 09:21:32 +00:00
dev-bot self-assigned this 2026-04-06 09:24:02 +00:00
dev-bot added
in-progress
and removed
backlog
labels 2026-04-06 09:24:02 +00:00
Author
Collaborator

Blocked — issue #277

Field Value
Exit reason no_push
Timestamp 2026-04-06T09:24:05Z
Diagnostic output
Claude did not push branch fix/issue-277
### Blocked — issue #277 | Field | Value | |---|---| | Exit reason | `no_push` | | Timestamp | `2026-04-06T09:24:05Z` | <details><summary>Diagnostic output</summary> ``` Claude did not push branch fix/issue-277 ``` </details>
dev-bot added
blocked
and removed
in-progress
labels 2026-04-06 09:24:06 +00:00
dev-bot removed their assignment 2026-04-06 09:34:02 +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#277
No description provided.