fix: surface merge conflicts before invoking Codex#812
Conversation
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
🤖 Keepalive Loop StatusPR #812 | Agent: Codex | Iteration 0/5 Current State
Last Codex Run
🔍 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: 6b9061517e
ℹ️ 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 fixes a critical issue in the conflict resolution workflow where Codex was checking git status before attempting a merge, seeing a clean state, and incorrectly reporting no conflicts. The fix adds a pre-processing step that surfaces merge conflicts in the workspace before invoking Codex.
Changes:
- Adds a new "Surface merge conflicts" workflow step that runs before Codex invocation
- Conditionally executes only when the conflict resolution prompt is being used
- Attempts
git merge --no-commit --no-ff origin/mainto surface conflicts in the working tree
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…tection 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
|
Status | ✅ no new diagnostics |
🤖 Bot Comment Handler
The agent has been assigned to this PR to address the bot review comments. Instructions for agent
The bot comment handler workflow has prepared context in the artifacts. |
Automated Status Summary
Scope
After merging PR #103 (multi-agent routing infrastructure), we need to:
Context for Agent
Design Decisions & Constraints
<!-- keepalive-loop-summary -->| github-actions[bot] | NEW: CLI agent iteration tracking | ✅ Keep for CLI agents |<!-- keepalive-state:v1 -->| agents-workflows-bot[bot] | State tracking |<!-- keepalive-round: N -->| stranske | OLD: Instruction comment | ❌ CLI agents dont need this |agent:*label), we should have exactly one updating comment (<!-- keepalive-loop-summary -->) instead of accumulating 10+ comments per PR.Related Issues/PRs
References
Blockers & Dependencies
Tasks
GITHUB_STEP_SUMMARYoutput so iteration results are visible in the Actions UIAcceptance criteria