Skip to content

fix: Claude runner — detect agent-made commits and add diagnostics#1643

Merged
stranske merged 2 commits intomainfrom
claude/fix-claude-runner-88W3o
Feb 23, 2026
Merged

fix: Claude runner — detect agent-made commits and add diagnostics#1643
stranske merged 2 commits intomainfrom
claude/fix-claude-runner-88W3o

Conversation

@stranske
Copy link
Copy Markdown
Owner

@stranske stranske commented Feb 23, 2026

Source: Issue #220

Automated Status Summary

Scope

  • Scope section missing from source issue.

Tasks

  • Tasks section missing from source issue.

Acceptance criteria

  • Acceptance criteria section missing from source issue.

  • Head SHA: 45051ac

  • Latest Runs: ⏳ queued — Gate

  • Required: gate: ⏳ queued

  • | Workflow / Job | Result | Logs |

  • |----------------|--------|------|

  • | Agents PR meta manager | ❔ in progress | View run |

  • | CI Autofix Loop | ✅ success | View run |

  • | Copilot code review | ❔ in progress | View run |

  • | Gate | ⏳ queued | View run |

  • | Health 40 Sweep | ❔ in progress | View run |

  • | Health 44 Gate Branch Protection | ❔ in progress | View run |

  • | Health 45 Agents Guard | ✅ success | View run |

  • | Health 50 Security Scan | ❔ in progress | View run |

  • | Maint 52 Validate Workflows | ✅ success | View run |

  • | PR 11 - Minimal invariant CI | ✅ success | View run |

  • | Selftest CI | ❔ in progress | View run |

Head SHA: fc7f38f
Latest Runs: ✅ success — Gate
Required: gate: ✅ success

Workflow / Job Result Logs
.github/workflows/autofix.yml ❌ failure View run
Agents PR meta manager ❔ in progress View run
Gate ✅ success View run
Health 40 Sweep ✅ success View run
Health 44 Gate Branch Protection ✅ success View run
Health 45 Agents Guard ✅ success View run
Health 50 Security Scan ✅ success View run
Health 73 Template Completeness ✅ success View run
Maint 52 Validate Workflows ✅ success View run
PR 11 - Minimal invariant CI ✅ success View run
Selftest CI ✅ success View run
Validate Sync Manifest ✅ success View run

… diagnostics

The Claude runner's commit step only checked git status for uncommitted
changes but never checked for unpushed commits.  Claude Code in agentic
mode (--dangerously-skip-permissions) can create its own git commits via
the Bash tool, so the working tree appears clean while commits are
sitting locally unpushed.

Changes:
- Add unpushed-commit detection to the commit step (mirrors Codex runner
  pattern at lines 1202-1243 of reusable-codex-run.yml)
- Add --output-format stream-json and --output-file flags to separate
  session JSONL from final response (matches Codex's --json +
  --output-last-message pattern)
- Add post-execution workspace diagnostics (git status + unpushed
  commits) for debugging zero-change iterations
- Remove the three-attempt fallback (unnecessary — -p IS the correct
  flag for non-interactive agentic mode)

https://claude.ai/code/session_012WnYCcttvFEY3FETnhVcNL
Copilot AI review requested due to automatic review settings February 23, 2026 16:30
@stranske stranske temporarily deployed to agent-high-privilege February 23, 2026 16:31 — with GitHub Actions Inactive
@stranske-keepalive
Copy link
Copy Markdown
Contributor

stranske-keepalive bot commented Feb 23, 2026

Automated Status Summary

Head SHA: 5fd795c
Latest Runs: ⏳ pending — Gate
Required contexts: Gate / gate, Health 45 Agents Guard / guard
Required: core tests (3.11): ⏳ pending, core tests (3.12): ⏳ pending, docker smoke: ⏳ pending, gate: ⏳ pending

Workflow / Job Result Logs
(no jobs reported) ⏳ pending

Coverage Overview

  • Coverage history entries: 1

Coverage Trend

Metric Value
Current 93.12%
Baseline 85.00%
Delta +8.12%
Minimum 70.00%
Status ✅ Pass

Top Coverage Hotspots (lowest coverage)

File Coverage Missing
src/cli_parser.py 81.8% 4
src/percentile_calculator.py 95.0% 1
src/aggregator.py 95.0% 2
src/__init__.py 100.0% 0
src/ndjson_parser.py 100.0% 0

Updated automatically; will refresh on subsequent CI/Docker completions.


Keepalive checklist

Scope

  • Scope section missing from source issue.

Tasks

  • Tasks section missing from source issue.

Acceptance criteria

  • Acceptance criteria section missing from source issue.

  • [ ]

@agents-workflows-bot
Copy link
Copy Markdown
Contributor

agents-workflows-bot bot commented Feb 23, 2026

🤖 Keepalive Loop Status

PR #1643 | Agent: Codex | Iteration 0/5

Current State

Metric Value
Iteration progress [----------] 0/5
Action wait (missing-agent-label)
Disposition skipped (transient)
Gate success
Tasks 0/18 complete
Timeout 45 min (default)
Timeout usage 3m elapsed (8%, 42m remaining)
Keepalive ❌ disabled
Autofix ❌ disabled

🔍 Failure Classification

| Error type | infrastructure |
| Error category | resource |
| Suggested recovery | Confirm the referenced resource exists (repo, PR, branch, workflow, or file). |

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 367f9d064c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a critical bug in the Claude keepalive runner where agent-made commits were being silently discarded. When Claude Code runs in agentic mode with --dangerously-skip-permissions, it can create its own git commits via the Bash tool. The existing workflow only checked git status --porcelain for uncommitted changes, missing these already-committed changes.

The PR mirrors the Codex runner's pattern by checking for unpushed commits using git rev-list FETCH_HEAD..HEAD --count when the working tree is clean. It also improves debugging by adding structured JSONL session logging and post-execution diagnostics.

Changes:

  • Added unpushed commit detection at two bailout points: when there are zero uncommitted changes and when artifact filtering leaves nothing to commit
  • Enhanced Claude invocation with --output-format stream-json and --output-file for better debugging
  • Added post-execution diagnostics logging git status and unpushed commits
  • Removed unnecessary three-attempt fallback (simplified invocation)
  • Refactored to set REMOTE_URL and target_branch at the start of the commit step

- Set files-changed output when pushing agent-made unpushed commits so
  keepalive_loop.js does not miscount as zero-activity (Codex bot P1)
- Add git fetch before FETCH_HEAD in post-filter unpushed commit path
  to ensure FETCH_HEAD is current (Copilot review)
- Strip refs/heads/ prefix from PR_REF in diagnostic git log (Copilot)

https://claude.ai/code/session_012WnYCcttvFEY3FETnhVcNL
@stranske stranske temporarily deployed to agent-high-privilege February 23, 2026 18:11 — with GitHub Actions Inactive
@stranske stranske merged commit 46359d3 into main Feb 23, 2026
297 of 300 checks passed
@stranske stranske deleted the claude/fix-claude-runner-88W3o branch February 23, 2026 18:30
stranske pushed a commit that referenced this pull request Feb 23, 2026
The diagnostic block added in PR #1643 references PR_REF to show
unpushed commits, but PR_REF is only in the commit step's env block,
not the run step's.  Under set -euo pipefail the unbound variable
crashes the entire step, preventing Claude's output from being
captured and the commit step from running.  This is why PR #220's
Claude runs produced zero output despite the runner fixes being
present.

Fix: use ${PR_REF:-} to safely handle the missing variable.

Also add artifact upload step (mirrors reusable-codex-run.yml) so
Claude's session JSONL, output, and analysis files are preserved
for debugging even when the run fails.

https://claude.ai/code/session_012WnYCcttvFEY3FETnhVcNL
stranske pushed a commit that referenced this pull request Feb 24, 2026
…odex

The --output-file flag does not exist in the Claude CLI, causing it to
exit immediately with code 1 (unknown option). This was introduced in
PR #1643 and is the root cause of Claude runs failing on PR #220.

Changes to reusable-claude-run.yml:
- Remove invalid --output-file and --output-format stream-json flags
- Use shell redirect with tee for session logging + output capture
- Use PIPESTATUS[0] to capture Claude exit code through the pipe
- Rename session files from .jsonl to .log (Claude text != JSONL)
- Add agents/*.md bootstrap file exclusion (matches Codex pattern)
- Add cross-agent artifact exclusion (codex-session/analysis files)

Changes to reusable-codex-run.yml:
- Add cross-agent artifact exclusion for claude-* files so shared
  workspace artifacts don't leak into Codex commits

https://claude.ai/code/session_012WnYCcttvFEY3FETnhVcNL
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.

3 participants