Skip to content

fix: Allow Codex worker to run for conflict action#773

Merged
stranske merged 1 commit intomainfrom
fix/conflict-action-workflow
Jan 11, 2026
Merged

fix: Allow Codex worker to run for conflict action#773
stranske merged 1 commit intomainfrom
fix/conflict-action-workflow

Conversation

@stranske
Copy link
Copy Markdown
Owner

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:

  • Add 'conflict' to action checks in preflight job
  • Add 'conflict' to action checks in mark-running job
  • Add 'conflict' to skip condition in run-codex job

This completes the conflict resolution flow by allowing Codex to run when conflicts are detected.

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.
Copilot AI review requested due to automatic review settings January 11, 2026 01:00
@stranske stranske enabled auto-merge (squash) January 11, 2026 01:00
@agents-workflows-bot
Copy link
Copy Markdown
Contributor

⚠️ Action Required: Unable to determine source issue for PR #773. The PR title, branch name, or body must contain the issue number (e.g. #123, branch: issue-123, or the hidden marker ).

@github-actions
Copy link
Copy Markdown
Contributor

Automated Status Summary

Head SHA: 5a1ce8a
Latest Runs: ⏳ pending — Gate
Required contexts: Gate / gate, Health 45 Agents Guard / Enforce agents workflow protections
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 92.21%
Baseline 85.00%
Delta +7.21%
Minimum 70.00%
Status ✅ Pass

Top Coverage Hotspots (lowest coverage)

File Coverage Missing
scripts/workflow_health_check.py 62.6% 28
scripts/classify_test_failures.py 62.9% 37
scripts/ledger_validate.py 65.3% 63
scripts/mypy_return_autofix.py 82.6% 11
scripts/ledger_migrate_base.py 85.5% 13
scripts/fix_cosmetic_aggregate.py 92.3% 1
scripts/coverage_history_append.py 92.8% 2
scripts/workflow_validator.py 93.3% 4
scripts/update_autofix_expectations.py 93.9% 1
scripts/pr_metrics_tracker.py 95.7% 3
scripts/generate_residual_trend.py 96.6% 1
scripts/build_autofix_pr_comment.py 97.0% 2
scripts/aggregate_agent_metrics.py 97.2% 0
scripts/fix_numpy_asserts.py 98.1% 0
scripts/sync_test_dependencies.py 98.3% 1

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


Keepalive checklist

Scope

No scope information available

Tasks

  • No tasks defined

Acceptance criteria

  • No acceptance criteria defined

@stranske stranske merged commit 6eabe2c into main Jan 11, 2026
42 checks passed
@stranske stranske deleted the fix/conflict-action-workflow branch January 11, 2026 01:02
@github-actions
Copy link
Copy Markdown
Contributor

🤖 Keepalive Loop Status

PR #773 | 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/3 complete
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
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 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'
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
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'

Copilot uses AI. Check for mistakes.
stranske added a commit that referenced this pull request Jan 12, 2026
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
stranske added a commit that referenced this pull request Jan 12, 2026
* 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>
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.

2 participants