Skip to content

hotfix: run_claude diagnostics + empty-diff tracking (Claude CLI path) - #262

Merged
telleroutlook merged 1 commit into
mainfrom
hotfix/claude-run-diagnostics
Jul 2, 2026
Merged

hotfix: run_claude diagnostics + empty-diff tracking (Claude CLI path)#262
telleroutlook merged 1 commit into
mainfrom
hotfix/claude-run-diagnostics

Conversation

@telleroutlook

Copy link
Copy Markdown
Owner

Why

PR #260 added Codex-path diagnostics to run_codex_exec in worker.py. Production log 2026-07-02 13:42 shows the actual empty-diff cause is different:

INFO no diff (nothing changed)
INFO empty-diff counter for telleroutlook/claude-bot-go#8: 11
WARNING Claude exited with returncode=1
WARNING Job 264 blocked (empty_diff_detected): Empty diff after 11 attempt(s)

Claude CLI (not Codex) is the one returning exit=1 with no diff. That path lives in claude_ops.run_claude, which PR #260 didn't touch.

What this changes

Only run_claude in claude_ops.py. No control-flow changes. Pure observability.

  • Timing: runtime_secs per invocation
  • Result summary: cwd, model (Claude alias or Codex model), returncode, stdout_bytes, stderr_bytes
  • Suspicious-short-output warning (returncode==0 && stdout<50 chars)
  • Worktree diff probe: git status --porcelain + git diff --numstat HEAD
  • Per-worktree empty-diff streak counter (module-level dict), reset on real change
  • At streak >= 2, emit a claude-bot-go#23 pointer so the Go-side native implementation has a hook

What this does NOT do

  • Does not change return values or callers
  • Does not add auto-rebuild logic (that is claude-bot-go#23 in Go bot)
  • Does not touch token parsing, error handling, or timeout paths
  • Does not change any config

Verification

  • python3 -m py_compile claude_ops.py OK
  • Diff is +54 -0 additive, no behavioral changes

Follow-up (autonomous)

Refs: claude-bot-go#23, #260

…LI path too)

PR #260 only instrumented the Codex fallback path (run_codex_exec in
worker.py). Production log from 2026-07-02 13:42 shows job 264 hit
empty-diff count=11 while Claude CLI (not Codex) was returning exit=1
with no diff — my previous patch missed it because the Claude path
lives in claude_ops.run_claude.

This patch adds the same diagnostics to run_claude so both providers
are covered:

- runtime_secs, returncode, stdout_bytes, stderr_bytes, cwd, model
- Suspicious short-output warning (returncode==0 && stdout<50 chars)
- worktree diff probe (git status --porcelain + git diff --numstat)
- per-worktree empty-diff streak counter (reset on real change)
- streak >= 2 emits a claude-bot-go#23 pointer

Pure observability. Zero control-flow changes.

Refs: claude-bot-go#23
@telleroutlook
telleroutlook merged commit aa73567 into main Jul 2, 2026
1 check passed
@telleroutlook
telleroutlook deleted the hotfix/claude-run-diagnostics branch July 2, 2026 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant