Skip to content

fix: prevent dual-agent conflict for codex by skipping post_agent_comment#705

Merged
stranske merged 1 commit intomainfrom
fix/dual-agent-conflict-clean
Jan 9, 2026
Merged

fix: prevent dual-agent conflict for codex by skipping post_agent_comment#705
stranske merged 1 commit intomainfrom
fix/dual-agent-conflict-clean

Conversation

@stranske
Copy link
Copy Markdown
Owner

@stranske stranske commented Jan 9, 2026

Source: Issue #701

Automated Status Summary

Scope

See docs/keepalive/Agents.md for the CLI vs UI agent architecture:

Context for Agent

Design Decisions & Constraints

    1. PR has agent:codex label → triggers CLI keepalive loop
  • This change forces post_agent_comment to 'true' for all non-workflow_dispatch runs... causing the UI agent to run alongside the CLI keepalive loop and potentially conflict.

  • Skip post_agent_comment for agent:codex (CLI keepalive handles it)
  • Keep post_agent_comment for other agents like agent:claude
  • See docs/keepalive/Agents.md for the CLI vs UI agent architecture:
  • CLI Agent: Triggered by workflows (keepalive loop), does NOT need @codex comments
  • For codex, the CLI keepalive loop is the primary mechanism - posting comments would duplicate/conflict.
  • Adjusted the consumer issue-intake workflow to keep manual-dispatch auto-comments enabled for non-codex agents while only honoring post_codex_comment for codex selections, preventing unintended codex UI triggers on manual dispatch runs. templates/consumer-repo/.github/workflows/agents-issue-intake.ymlL170-L189
  • Rate limit handling changes superseded by #702
    1. Rate limit retry logic issue - Superseded by #702 (bypass instead of defer/retry)

Related Issues/PRs

References

  • # Agent bridge mode: Call the Workflows repo reusable issue bridge
    bridge:
    needs: [route, check_labels]
    if: |
    needs.route.outputs.should_run_bridge == 'true' &&
    needs.check_labels.outputs.should_run == 'true'
    uses: stranske/Workflows/.github/workflows/reusable-agents-issue-bridge.yml@main
    with:
    agent: ${{ needs.check_labels.outputs.agent }}
    issue_number: ${{ needs.check_labels.outputs.issue_number }}
    mode: "create"
    # Skip post_agent_comment for codex - CLI keepalive loop handles it,
    # posting @codex would trigger UI agent alongside CLI causing conflicts
    post_agent_comment: >-
    ${{ github.event_name == 'workflow_dispatch'
    && (inputs.post_codex_comment && 'true' || 'false')
    || (needs.check_labels.outputs.agent != 'codex' && 'true' || 'false') }}
    agent_pr_draft: ${{ inputs.bridge_draft_pr && 'true' || 'false' }}
    secrets:
    service_bot_pat: ${{ secrets.SERVICE_BOT_PAT }}
  • https://chatgpt.com/s/cd_696124c30fb48191b152fc2f71f14393

Tasks

  • - CLI Agent: Triggered by workflows (keepalive loop), does NOT need @codex comments
  • - UI Agent: Triggered by @codex comments (backup/manual mode)

Acceptance criteria

  • - Use CLI-only automation for agent:codex labels
  • - Use comment-based triggering for other agents
  • - Allow manual override via workflow_dispatch

Head SHA: 495545c
Latest Runs: ✅ success — Gate
Required: gate: ✅ success

Workflow / Job Result Logs
Agents PR meta manager ❔ in progress View run
Auto-label Dependabot PRs ⏭️ skipped View run
CI Autofix Loop ✅ success View run
Copilot code review ✅ success 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
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

…ment

When PRs are created from issues labeled with agent:codex, the template
was posting @codex start comments which triggered the UI agent. However,
the CLI keepalive loop already handles codex PRs through the workflow
system. Having both agents run simultaneously causes conflicts.

This fix:
- Skips post_agent_comment for agent:codex (CLI keepalive handles it)
- Keeps post_agent_comment for other agents like agent:claude
- Preserves workflow_dispatch behavior for manual overrides

Supersedes PR #701 (which had unrelated commits mixed in)
Addresses P2 issue raised in PR #700 review comment.
See docs/keepalive/Agents.md for CLI vs UI agent distinction.
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 dual-agent conflict issue where PRs created from agent:codex labeled issues would trigger both the UI agent (via @codex start comments) and the CLI keepalive loop simultaneously, causing conflicts. The fix skips automatic agent comment posting for codex agents while preserving manual override capabilities.

Key Changes

  • Modified post_agent_comment logic to skip posting for codex agents in automatic workflows
  • Preserved workflow_dispatch manual override functionality
  • Added clear documentation explaining the conflict prevention

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@chatgpt-codex-connector
Copy link
Copy Markdown

Summary

Testing

  • Not run (no changes).

View task →

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 9, 2026

Automated Status Summary

Head SHA: 65f004b
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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 9, 2026

🤖 Keepalive Loop Status

PR #705 | 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/5 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). |

@stranske stranske merged commit 3671c9b into main Jan 9, 2026
345 checks passed
@stranske stranske deleted the fix/dual-agent-conflict-clean branch January 9, 2026 17:42
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