wads.agents.ci_debug_agent

CI Debugging Agent for Wads

This agent analyzes failed CI runs, diagnoses issues, and proposes fixes. It can:

  • Fetch GitHub Actions logs via API

  • Parse test failures and error messages

  • Analyze code context

  • Diagnose root causes (missing deps, config issues, code bugs)

  • Propose fixes (install commands, code changes, config updates)

Usage:

python -m wads.ci_debug_agent <repo> [--run-id RUN_ID] [--fix]

Functions

diagnose_ci_failure(repo[, run_id])

Diagnose a CI failure.

diagnose_missing_python_deps(failures)

Identify missing Python dependencies from import errors.

diagnose_missing_system_deps(failures, logs)

Identify missing system dependencies from error messages.

fetch_workflow_logs(repo, run_id)

Fetch logs for a specific workflow run.

fetch_workflow_runs(repo[, limit])

Fetch recent workflow runs for a repository.

generate_fix_instructions(diagnosis, repo_path)

Generate detailed fix instructions.

get_github_token()

Get GitHub token from environment.

main()

CLI entry point for wads CI debug agent.

parse_ci_warnings(logs)

Parse CI warnings from logs that may indicate issues.

parse_pytest_failures(logs)

Parse pytest failures and collection errors from CI logs.

print_diagnosis(diagnosis)

Print formatted diagnosis report.

Classes

CIDiagnosis(failures, missing_system_deps, ...)

Result of CI failure diagnosis.

TestFailure(test_name, error_type, ...[, ...])

Represents a single test failure.

class wads.agents.ci_debug_agent.CIDiagnosis(failures, missing_system_deps, missing_python_deps, config_issues, proposed_fixes, confidence, warnings=None)[source]

Bases: object

Result of CI failure diagnosis.

class wads.agents.ci_debug_agent.TestFailure(test_name, error_type, error_message, traceback, file_path=None, line_number=None)[source]

Bases: object

Represents a single test failure.

wads.agents.ci_debug_agent.diagnose_ci_failure(repo, run_id=None)[source]

Diagnose a CI failure.

Parameters:
  • repo (str) – Repository in format ‘owner/name’

  • run_id (Optional[int]) – Specific run ID, or None for latest failed run

Return type:

CIDiagnosis

Returns:

CIDiagnosis with analysis results

wads.agents.ci_debug_agent.diagnose_missing_python_deps(failures)[source]

Identify missing Python dependencies from import errors.

Parameters:

failures (List[TestFailure]) – List of test failures

Return type:

List[str]

Returns:

List of likely missing Python packages

wads.agents.ci_debug_agent.diagnose_missing_system_deps(failures, logs)[source]

Identify missing system dependencies from error messages.

Parameters:
Return type:

List[str]

Returns:

List of likely missing system dependencies

wads.agents.ci_debug_agent.fetch_workflow_logs(repo, run_id)[source]

Fetch logs for a specific workflow run.

Parameters:
  • repo (str) – Repository in format ‘owner/name’

  • run_id (int) – Workflow run ID

Return type:

str

Returns:

Log content as string

wads.agents.ci_debug_agent.fetch_workflow_runs(repo, limit=5)[source]

Fetch recent workflow runs for a repository.

Parameters:
  • repo (str) – Repository in format ‘owner/name’

  • limit (int) – Number of runs to fetch

Return type:

List[Dict]

Returns:

List of workflow run dictionaries

wads.agents.ci_debug_agent.generate_fix_instructions(diagnosis, repo_path)[source]

Generate detailed fix instructions.

Parameters:
  • diagnosis (CIDiagnosis) – CIDiagnosis result

  • repo_path (Path) – Local path to repository

Return type:

str

Returns:

Formatted fix instructions

wads.agents.ci_debug_agent.get_github_token()[source]

Get GitHub token from environment.

Return type:

Optional[str]

wads.agents.ci_debug_agent.main()[source]

CLI entry point for wads CI debug agent.

wads.agents.ci_debug_agent.parse_ci_warnings(logs)[source]

Parse CI warnings from logs that may indicate issues.

Parameters:

logs (str) – Full CI logs

Return type:

List[str]

Returns:

List of warning messages

wads.agents.ci_debug_agent.parse_pytest_failures(logs)[source]

Parse pytest failures and collection errors from CI logs.

Parameters:

logs (str) – CI log content

Return type:

List[TestFailure]

Returns:

List of TestFailure objects

wads.agents.ci_debug_agent.print_diagnosis(diagnosis)[source]

Print formatted diagnosis report.