fix: Claude runner — detect agent-made commits and add diagnostics#1643
fix: Claude runner — detect agent-made commits and add diagnostics#1643
Conversation
… 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
Automated Status SummaryHead SHA: 5fd795c
Coverage Overview
Coverage Trend
Top Coverage Hotspots (lowest coverage)
Updated automatically; will refresh on subsequent CI/Docker completions. Keepalive checklistScope
Tasks
Acceptance criteria
|
🤖 Keepalive Loop StatusPR #1643 | Agent: Codex | Iteration 0/5 Current State
🔍 Failure Classification| Error type | infrastructure | |
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
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-jsonand--output-filefor better debugging - Added post-execution diagnostics logging git status and unpushed commits
- Removed unnecessary three-attempt fallback (simplified invocation)
- Refactored to set
REMOTE_URLandtarget_branchat 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
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
…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
Automated Status Summary
Scope
Tasks
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