Skip to content

Add fix-ci mode: fix CI failures from PR check annotations#1

Merged
chanakyav merged 1 commit intomainfrom
fix-ci-mode
Mar 16, 2026
Merged

Add fix-ci mode: fix CI failures from PR check annotations#1
chanakyav merged 1 commit intomainfrom
fix-ci-mode

Conversation

@chanakyav
Copy link
Copy Markdown
Owner

New 'autopilot fix-ci --pr ' command that lists failed CI checks, lets the user select which to fix (interactive or --checks flag), fetches structured failure annotations via the GitHub check-runs API, and loops an agent to fix, push, poll CI until the selected checks pass.

Architecture:

  • BaseOrchestrator extracted with shared run(), _run_agent_with_retry(), _do_verify_push(). Existing Orchestrator inherits unchanged behavior.
  • New CIOrchestrator: FETCH_ANNOTATIONS, FIX_CI, VERIFY_PUSH, WAIT_CI.
  • Uses /check-runs/{id}/annotations API (compact, structured) instead of raw logs (huge, slow on large repos).
  • Deduplicates annotations across checks by (path, start_line).
  • Strips ANSI escape codes and filters generic noise.
  • Excludes *-results aggregation gate checks automatically.

New functions:

  • github_api: get_failed_checks, get_check_annotations, get_check_states
  • prompts: fix_ci_prompt, format_ci_annotations_for_prompt
  • persistence: task_mode + ci_check_names columns (schema v3 migration)
  • config: ci_check_names, ci_poll_interval_seconds, ci_poll_timeout_seconds
  • cli: fix-ci subcommand, _run dispatches by task_mode

New 'autopilot fix-ci --pr <N>' command that lists failed CI checks, lets
the user select which to fix (interactive or --checks flag), fetches
structured failure annotations via the GitHub check-runs API, and loops
an agent to fix, push, poll CI until the selected checks pass.

Architecture:
- BaseOrchestrator extracted with shared run(), _run_agent_with_retry(),
  _do_verify_push(). Existing Orchestrator inherits unchanged behavior.
- New CIOrchestrator: FETCH_ANNOTATIONS, FIX_CI, VERIFY_PUSH, WAIT_CI.
- Uses /check-runs/{id}/annotations API (compact, structured) instead of
  raw logs (huge, slow on large repos).
- Deduplicates annotations across checks by (path, start_line).
- Strips ANSI escape codes and filters generic noise.
- Excludes *-results aggregation gate checks automatically.

New functions:
- github_api: get_failed_checks, get_check_annotations, get_check_states
- prompts: fix_ci_prompt, format_ci_annotations_for_prompt
- persistence: task_mode + ci_check_names columns (schema v3 migration)
- config: ci_check_names, ci_poll_interval_seconds, ci_poll_timeout_seconds
- cli: fix-ci subcommand, _run dispatches by task_mode

18 new tests (83 total), all passing. Zero regressions.
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.

1 participant