fix: Allow Codex worker to run for conflict action#773
Conversation
The keepalive loop was correctly detecting merge conflicts and setting action='conflict', but the preflight, mark-running, and run-codex jobs were only configured to run for action='run' or action='fix'. This meant conflicts were detected but never resolved because the Codex worker was skipped. Add 'conflict' to the action checks in all three jobs to allow the conflict resolution flow to complete.
Automated Status SummaryHead SHA: 5a1ce8a
Coverage Overview
Coverage Trend
Top Coverage Hotspots (lowest coverage)
Updated automatically; will refresh on subsequent CI/Docker completions. Keepalive checklistScopeNo scope information available Tasks
Acceptance criteria
|
🤖 Keepalive Loop StatusPR #773 | Agent: Codex | Iteration 0/5 Current State
🔍 Failure Classification| Error type | infrastructure | |
There was a problem hiding this comment.
Pull request overview
This PR fixes a keepalive deadlock where merge conflicts were detected but never resolved by enabling the Codex worker to run when conflicts are detected. The changes add the 'conflict' action value to the conditional checks in three workflow jobs.
Changes:
- Extended preflight, mark-running, and run-codex jobs to execute for the 'conflict' action
- Maintains consistency with existing 'run' and 'fix' action handling
- Completes the conflict resolution flow that was partially implemented in the keepalive_loop.js script
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| name: Verify secrets available | ||
| needs: evaluate | ||
| if: needs.evaluate.outputs.action == 'run' || needs.evaluate.outputs.action == 'fix' | ||
| if: needs.evaluate.outputs.action == 'run' || needs.evaluate.outputs.action == 'fix' || needs.evaluate.outputs.action == 'conflict' |
There was a problem hiding this comment.
The workflow changes enable the 'conflict' action to trigger the Codex worker, but the required prompt file '.github/codex/prompts/fix_merge_conflicts.md' is missing from the repository. The keepalive_loop.js script references this file in the PROMPT_ROUTES object (line 23), and the sync manifest expects it (line 120), but it doesn't exist in .github/codex/prompts/. This will cause the workflow to fail when conflicts are detected. The prompt file needs to be created before these workflow changes can be effective.
| if: needs.evaluate.outputs.action == 'run' || needs.evaluate.outputs.action == 'fix' || needs.evaluate.outputs.action == 'conflict' | |
| if: needs.evaluate.outputs.action == 'run' || needs.evaluate.outputs.action == 'fix' |
The keepalive loop detects conflicts and routes to fix_merge_conflicts.md, but Codex was checking git status and reporting 'no conflicts' because the merge hadn't been attempted yet. The prompt instructs 'Do NOT check git status first, run git merge', but Codex checks git status anyway and exits early. Solution: Add workflow step that runs git merge BEFORE invoking Codex. This surfaces conflicts in the workspace so they're visible when Codex checks git status, regardless of whether Codex follows the prompt order. Fixes conflict resolution flow end-to-end: 1. Keepalive detects conflicts (✓ already working) 2. Workflow allows Codex to run for action='conflict' (✓ PR #773) 3. Workflow surfaces conflicts in workspace (✓ this fix) 4. Codex sees conflicts and resolves them (✓ with this fix) Ref: Trend_Model_Project PR #4339
* fix: surface merge conflicts before invoking Codex The keepalive loop detects conflicts and routes to fix_merge_conflicts.md, but Codex was checking git status and reporting 'no conflicts' because the merge hadn't been attempted yet. The prompt instructs 'Do NOT check git status first, run git merge', but Codex checks git status anyway and exits early. Solution: Add workflow step that runs git merge BEFORE invoking Codex. This surfaces conflicts in the workspace so they're visible when Codex checks git status, regardless of whether Codex follows the prompt order. Fixes conflict resolution flow end-to-end: 1. Keepalive detects conflicts (✓ already working) 2. Workflow allows Codex to run for action='conflict' (✓ PR #773) 3. Workflow surfaces conflicts in workspace (✓ this fix) 4. Codex sees conflicts and resolves them (✓ with this fix) Ref: Trend_Model_Project PR #4339 * chore(codex-keepalive): apply updates (PR #812) * fix: address bot review feedback - move merge step and make branch detection dynamic Addresses three critical review comments: 1. **Codex P1 (CRITICAL)**: Move merge step AFTER dependency installation - Problem: If conflicts touch requirements*.txt or pyproject.toml, pip install fails when trying to parse files with conflict markers - Solution: Moved 'Surface merge conflicts' step from before Python setup (line 236) to just before 'Run Codex' (line 485) - This ensures dependencies are installed cleanly before conflicts are surfaced 2. **Copilot**: Dynamic base branch detection instead of hardcoded 'origin/main' - Added logic to detect base branch from GITHUB_BASE_REF, workflow input, origin/HEAD, or fallback to 'main' - Makes workflow portable across repos with different default branches 3. **Copilot**: Simplified error handling - Removed unnecessary set +e / set -e toggling - Use 'merge_exit=0; git merge ... || merge_exit=$?' pattern - Maintains set -euo pipefail throughout for consistency --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Fixes the keepalive deadlock where merge conflicts were detected but never resolved.
The keepalive loop was correctly detecting merge conflicts and setting action='conflict', but the preflight, mark-running, and run-codex jobs were only configured to run for action='run' or action='fix'.
This meant conflicts were detected but never resolved because the Codex worker was skipped.
Changes:
This completes the conflict resolution flow by allowing Codex to run when conflicts are detected.