Skip to content

feat: add automated bug-fixing GitHub Actions workflow and non-interactive CLI support#29

Open
sasikumar161106 wants to merge 2 commits into
sreerevanth:mainfrom
sasikumar161106:fix-main-issues
Open

feat: add automated bug-fixing GitHub Actions workflow and non-interactive CLI support#29
sasikumar161106 wants to merge 2 commits into
sreerevanth:mainfrom
sasikumar161106:fix-main-issues

Conversation

@sasikumar161106

@sasikumar161106 sasikumar161106 commented Jul 1, 2026

Copy link
Copy Markdown

This PR adds a GitHub Actions workflow to automatically run the developer agent on issues labeled with \�gent-fix. It also updates the agent to support non-interactive executions via a new --yes\ flag and reports outcomes to $GITHUB_OUTPUT.

Summary by CodeRabbit

  • New Features
    • Added a new automated issue-fixing workflow that can run when an issue is opened or tagged, then create a pull request with the proposed changes.
    • Added non-interactive run support for automated environments, including optional auto-approval and environment-based task input.
    • Improved run reporting so results are posted back to the originating issue and exposed to workflow automation.

@ecc-tools

ecc-tools Bot commented Jul 1, 2026

Copy link
Copy Markdown

Analyzing 200 commits...

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a new GitHub Actions workflow that triggers an autonomous agent on agent-fix-labeled issues, checks out code, runs main.py, and posts a result comment. Updates main.py and modules/agent_loop.py to support non-interactive CI runs via a --yes flag, AGENT_TASK env variable, and structured GITHUB_OUTPUT writing.

Changes

Agent Auto-Fix Workflow and CI Support

Layer / File(s) Summary
Non-interactive agent config and confirmation bypass
modules/agent_loop.py
AgentConfig gains a yes: bool = False field, and the run loop skips ask_confirmation(...) when set, otherwise aborting as before.
CLI task input, auto-approve flag, and structured output
main.py
Imports are adjusted, --task becomes optional with AGENT_TASK fallback, a --yes/-y flag auto-enables in CI, and write_github_output() records outcome/run_id/branch/pr_url/final_message on success, abort, and error paths.
Agent Auto-Fix GitHub Actions workflow
.github/workflows/agent-fix.yml
New workflow runs on agent-fix-labeled issues, sets up Python, installs deps, runs main.py with an issue-derived AGENT_TASK, and posts a success/failure comment via actions/github-script.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related issues

Possibly related PRs

  • sreerevanth/repopilot#3: Both PRs modify AgentConfig and the confirmation/approval gate flow around ask_confirmation(...) in modules/agent_loop.py.

Poem

A rabbit hops through CI's gate, 🐇
No more waiting, no more late,
With --yes in paw and task in tow,
Issues fixed and PRs flow,
A comment posted, clean and bright—
Hop, hop, hooray, the fix takes flight!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes: an automated bug-fixing workflow and non-interactive CLI support.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ecc-tools

ecc-tools Bot commented Jul 1, 2026

Copy link
Copy Markdown

Analysis Complete

Generated ECC bundle from 2 commits | Confidence: 50%

View Pull Request #30

Repository Profile
Attribute Value
Language Python
Framework Not detected
Commit Convention mixed
Test Directory separate
Changed Files (3)
Metric Value
Files changed 3
Additions 153
Deletions 5

Top hotspots

Path Status +/-
.github/workflows/agent-fix.yml added +96 / -0
main.py modified +55 / -4
modules/agent_loop.py modified +2 / -1

Top directories

Directory Files Total changes
.github/workflows 1 96
. 1 59
modules 1 3
Analysis Depth Readiness (commit-history, 21%)

ECC Tools uses this to decide whether recommendations should stay at commit-history/setup guidance or expand into CI, security, harness, reference-set, AI-routing, and team backlog work.

Area Status Evidence / Next Step
Commit history Partial 2 commits sampled
CI/CD signals Ready .github/workflows/agent-fix.yml
Security evidence Missing Add AgentShield, audit, SARIF, SBOM, or security review evidence so recommendations can cover security posture.
Harness configuration Missing Add Claude, Codex, OpenCode, Zed, dmux, MCP, plugin, or cross-harness config evidence for harness-agnostic recommendations.
Reference/eval evidence Missing Add fixtures, golden traces, reference sets, or evaluator benchmarks so deeper recommendations have regression evidence.
AI routing and cost controls Missing Add model-routing, budget, usage, or cost-control files before relying on AI-heavy automation recommendations.
Team handoff and project tracking Missing Add roadmap, runbook, project, Linear, or follow-up tracking docs so generated work can land in a team queue.
Reference Set Readiness (0/7, 0%)
Area Status Evidence / Next Step
Deep analyzer corpus Missing Add analyzer fixture, golden, benchmark, or reference-set files that can catch analyzer regressions.
RAG/evaluator comparison Missing Add retrieval or evaluator reference-set comparison fixtures with expected ranking behavior.
PR salvage/review corpus Missing Add stale-PR, review-thread, reopen-flow, or salvage reference cases for queue cleanup automation.
Discussion triage corpus Missing Add public discussion triage fixtures, golden cases, or reference sets for informational, answered, and no-response classifications.
Harness compatibility Missing Add cross-harness, adapter-compliance, or harness-audit evidence for Claude, Codex, OpenCode, Zed, dmux, and agent surfaces.
Security evidence Missing Attach security evidence such as SBOMs, SARIF, audit reports, or AgentShield evidence packs.
CI failure-mode evidence Missing Add captured CI failure logs, dry-run fixtures, or troubleshooting docs for common workflow failure modes.
Likely Future Issues (3)
Severity Signal Why it may show up
HIGH Regression coverage may lag behind the diff 2 generic code paths changed; 0 test files changed
MEDIUM CI workflow changes may ship without failure-mode evidence 1 CI/test-runner paths changed; 0 CI failure-mode evidence artifacts changed
MEDIUM Dependency or CI drift could surface after merge CI/workflow files changed; no lockfile changes detected
  • Regression coverage may lag behind the diff: The PR changes multiple code paths but does not touch any obvious test files.
  • CI workflow changes may ship without failure-mode evidence: The PR changes CI workflows or test-runner entrypoints without touching CI failure fixtures, captured logs, troubleshooting notes, or regression evidence.
  • Dependency or CI drift could surface after merge: Package or workflow changes landed without an accompanying lockfile update, which often turns into CI or release noise later.
Suggested Follow-up Work (3)
Type Suggested title Targets
PR test: add regression coverage for main.py + modules/agent_loop.py main.py, modules/agent_loop.py
PR ci: add failure-mode evidence for .github/workflows/agent-fix.yml .github/workflows/agent-fix.yml
PR chore: refresh lockfile and validate CI after dependency updates .github/workflows/agent-fix.yml
  • test: add regression coverage for main.py + modules/agent_loop.py: Backfill regression coverage before another change set lands on the touched code paths.
  • ci: add failure-mode evidence for .github/workflows/agent-fix.yml: Backfill CI failure-mode evidence before another workflow or test-runner change lands on the touched surface.
  • chore: refresh lockfile and validate CI after dependency updates: Package or workflow changes without a lockfile refresh tend to turn into noisy follow-up fixes after merge.

Copy-ready bodies

test: add regression coverage for main.py + modules/agent_loop.py

## Summary
- Add regression coverage for the recently touched code paths before more changes stack on top.

## Why
- Backfill regression coverage before another change set lands on the touched code paths.

## Touched paths
- `main.py`
- `modules/agent_loop.py`

## Validation
- Add or extend focused tests that exercise the touched paths.
- Run the affected test suite and verify the new coverage closes the gap.

ci: add failure-mode evidence for .github/workflows/agent-fix.yml

## Summary
- Add CI failure-mode evidence for the recently changed workflow or test-runner surface.

## Why
- Backfill CI failure-mode evidence before another workflow or test-runner change lands on the touched surface.

## Touched paths
- `.github/workflows/agent-fix.yml`

## Validation
- Add or update a CI failure fixture, captured failing log, troubleshooting note, workflow dry-run evidence, or regression test for the changed CI/test-runner behavior.
- Run the affected workflow or test-runner entrypoint locally or in CI and record pass/fail evidence.

chore: refresh lockfile and validate CI after dependency updates

## Summary
- Refresh the lockfile and rerun CI after the dependency or workflow changes in this PR.

## Why
- Package or workflow changes without a lockfile refresh tend to turn into noisy follow-up fixes after merge.

## Touched paths
- `.github/workflows/agent-fix.yml`

## Validation
- Refresh the lockfile in the same package manager used by the repo.
- Run the repo typecheck / test / CI entrypoints that depend on the updated package graph.
Generated Instincts (15)
Domain Count
git 3
code-style 9
testing 2
workflow 1

After merging, import with:

/instinct-import .claude/homunculus/instincts/inherited/repopilot-instincts.yaml

Files

  • .claude/ecc-tools.json
  • .claude/skills/repopilot/SKILL.md
  • .agents/skills/repopilot/SKILL.md
  • .agents/skills/repopilot/agents/openai.yaml
  • .claude/identity.json
  • .codex/config.toml
  • .codex/AGENTS.md
  • .codex/agents/explorer.toml
  • .codex/agents/reviewer.toml
  • .codex/agents/docs-researcher.toml
  • .claude/homunculus/instincts/inherited/repopilot-instincts.yaml

ECC Tools | Everything Claude Code

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/agent-fix.yml:
- Around line 70-79: The success comment in the workflow still claims a Pull
Request was created even when prUrl is empty. Update the success branch in
agent-fix.yml so the message that includes the Pull Request link only runs when
both outcome === "success" and prUrl is present; otherwise fall back to a
message that does not mention a PR. Use the existing outcome, prUrl,
commentBody, and runId variables to locate and gate the logic.
- Around line 71-88: The multi-line template literals assigned to commentBody
inside the workflow’s script block are not indented correctly for YAML, causing
the block scalar to break. Update the strings in the agent-fix workflow so the
lines within each backtick template remain consistently indented under script:
|, and verify both the success and failure branches in the commentBody
assignment preserve valid YAML parsing.
- Around line 63-66: The github-script interpolation in the agent-fix workflow
is using raw step outputs, which can break the script or become unsafe when the
output contains quotes/newlines. Update the script block that reads the
run-agent outputs (outcome, pr_url, run_id, final_message) to serialize each
value with toJSON() before assigning to variables, and ensure the existing
github-script snippet still uses those symbols safely.

In `@main.py`:
- Around line 124-133: The pre-run validation exits in main() currently call
sys.exit(1) before the try block, so GitHub Actions never receives failure
outputs. Update the repo_root and task validation paths in main.py to write the
expected GitHub outputs before exiting, using the same output-writing mechanism
already used for run-agent outcomes so CI consumers see an error state instead
of empty steps.run-agent.outputs.* values.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 92358971-4254-4da6-b521-428653f0c1da

📥 Commits

Reviewing files that changed from the base of the PR and between 2b93f9a and c77500b.

📒 Files selected for processing (3)
  • .github/workflows/agent-fix.yml
  • main.py
  • modules/agent_loop.py

Comment on lines +63 to +66
const outcome = "${{ steps.run-agent.outputs.outcome }}";
const prUrl = "${{ steps.run-agent.outputs.pr_url }}";
const runId = "${{ steps.run-agent.outputs.run_id }}";
const message = "${{ steps.run-agent.outputs.final_message }}";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
rg -n '\$\{\{\s*steps\.run-agent\.outputs\.' .github/workflows/agent-fix.yml

Repository: sreerevanth/repopilot

Length of output: 451


🏁 Script executed:

#!/bin/bash
sed -n '1,220p' .github/workflows/agent-fix.yml

Repository: sreerevanth/repopilot

Length of output: 3135


🏁 Script executed:

#!/bin/bash
rg -n "final_message|pr_url|run_id|outcome" -S .

Repository: sreerevanth/repopilot

Length of output: 7332


🏁 Script executed:

#!/bin/bash
sed -n '150,230p' main.py

Repository: sreerevanth/repopilot

Length of output: 2220


🏁 Script executed:

#!/bin/bash
rg -n "def write_github_output|write_github_output\(" -S .

Repository: sreerevanth/repopilot

Length of output: 355


🏁 Script executed:

#!/bin/bash
sed -n '90,120p' main.py

Repository: sreerevanth/repopilot

Length of output: 1216


🏁 Script executed:

#!/bin/bash
sed -n '396,414p' modules/agent_loop.py

Repository: sreerevanth/repopilot

Length of output: 1096


Quote the step outputs before interpolating them into github-script. Raw substitution is evaluated as JS here; final_message can carry arbitrary text on the error path, so quotes/newlines can break the script and turn into code execution. Use toJSON() for all four outputs.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/agent-fix.yml around lines 63 - 66, The github-script
interpolation in the agent-fix workflow is using raw step outputs, which can
break the script or become unsafe when the output contains quotes/newlines.
Update the script block that reads the run-agent outputs (outcome, pr_url,
run_id, final_message) to serialize each value with toJSON() before assigning to
variables, and ensure the existing github-script snippet still uses those
symbols safely.

Comment on lines +70 to +79
if (outcome === "success") {
commentBody = `Hello @${issuee},

I have successfully fixed the issue! 🎉

A Pull Request has been created with the changes:
🔗 **[Pull Request](${prUrl})**

**Run ID:** \`${runId}\`
**Message:** ${message}`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Do not claim a PR was created when pr_url is empty.

outcome === "success" only means the agent completed/tests passed; pr_url can still be empty if push or PR creation fails. Gate this branch on prUrl too.

Proposed fix
-            if (outcome === "success") {
+            if (outcome === "success" && prUrl) {
               commentBody = `Hello @${issuee},
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (outcome === "success") {
commentBody = `Hello @${issuee},
I have successfully fixed the issue! 🎉
A Pull Request has been created with the changes:
🔗 **[Pull Request](${prUrl})**
**Run ID:** \`${runId}\`
**Message:** ${message}`;
if (outcome === "success" && prUrl) {
commentBody = `Hello @${issuee},
I have successfully fixed the issue! 🎉
A Pull Request has been created with the changes:
🔗 **[Pull Request](${prUrl})**
**Run ID:** \`${runId}\`
**Message:** ${message}`;
🧰 Tools
🪛 actionlint (1.7.12)

[error] 73-73: could not parse as YAML: could not find expected ':'

(syntax-check)

🪛 YAMLlint (1.37.1)

[error] 75-75: syntax error: could not find expected ':'

(syntax)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/agent-fix.yml around lines 70 - 79, The success comment in
the workflow still claims a Pull Request was created even when prUrl is empty.
Update the success branch in agent-fix.yml so the message that includes the Pull
Request link only runs when both outcome === "success" and prUrl is present;
otherwise fall back to a message that does not mention a PR. Use the existing
outcome, prUrl, commentBody, and runId variables to locate and gate the logic.

Comment on lines +71 to +88
commentBody = `Hello @${issuee},

I have successfully fixed the issue! 🎉

A Pull Request has been created with the changes:
🔗 **[Pull Request](${prUrl})**

**Run ID:** \`${runId}\`
**Message:** ${message}`;
} else {
commentBody = `Hello @${issuee},

I attempted to fix this issue automatically but encountered a problem.

**Outcome:** \`${outcome || 'unknown/failed'}\`
**Message:** ${message || 'No additional message was provided.'}

Please check the GitHub Actions workflow logs for more details.`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
if command -v actionlint >/dev/null; then
  actionlint .github/workflows/agent-fix.yml
fi
if command -v yamllint >/dev/null; then
  yamllint .github/workflows/agent-fix.yml
fi

Repository: sreerevanth/repopilot

Length of output: 854


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Show the relevant workflow section with line numbers.
sed -n '55,100p' .github/workflows/agent-fix.yml | cat -n

# Also show the surrounding job/step structure to confirm the YAML nesting.
python3 - <<'PY'
from pathlib import Path
p = Path('.github/workflows/agent-fix.yml')
for i, line in enumerate(p.read_text().splitlines(), 1):
    if 50 <= i <= 105:
        print(f"{i:4}: {line}")
PY

Repository: sreerevanth/repopilot

Length of output: 3701


Indent the template literal body inside script: |
The unindented lines in both multi-line strings break the YAML block and prevent the workflow from parsing.

🧰 Tools
🪛 actionlint (1.7.12)

[error] 73-73: could not parse as YAML: could not find expected ':'

(syntax-check)

🪛 YAMLlint (1.37.1)

[error] 75-75: syntax error: could not find expected ':'

(syntax)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/agent-fix.yml around lines 71 - 88, The multi-line
template literals assigned to commentBody inside the workflow’s script block are
not indented correctly for YAML, causing the block scalar to break. Update the
strings in the agent-fix workflow so the lines within each backtick template
remain consistently indented under script: |, and verify both the success and
failure branches in the commentBody assignment preserve valid YAML parsing.

Source: Linters/SAST tools

Comment thread main.py
Comment on lines 124 to +133
if not os.path.isdir(repo_root):
print(f"ERROR: Repository path does not exist: {repo_root}", file=sys.stderr)
sys.exit(1)

yes_flag = args.yes or os.environ.get("CI") == "true"

task = args.task or os.environ.get("AGENT_TASK")
if not task:
print("ERROR: Task description is required. Provide --task or set the AGENT_TASK environment variable.", file=sys.stderr)
sys.exit(1)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Write GitHub outputs for pre-run validation failures.

These sys.exit(1) paths run before the try block, so CI consumers get empty steps.run-agent.outputs.* instead of outcome=error.

Proposed fix
     if not os.path.isdir(repo_root):
-        print(f"ERROR: Repository path does not exist: {repo_root}", file=sys.stderr)
+        message = f"Repository path does not exist: {repo_root}"
+        print(f"ERROR: {message}", file=sys.stderr)
+        write_github_output({
+            "outcome": "error",
+            "run_id": "",
+            "iterations": "0",
+            "branch_name": "",
+            "pr_url": "",
+            "final_message": message,
+        })
         sys.exit(1)
 
     yes_flag = args.yes or os.environ.get("CI") == "true"
 
     task = args.task or os.environ.get("AGENT_TASK")
     if not task:
-        print("ERROR: Task description is required. Provide --task or set the AGENT_TASK environment variable.", file=sys.stderr)
+        message = "Task description is required. Provide --task or set the AGENT_TASK environment variable."
+        print(f"ERROR: {message}", file=sys.stderr)
+        write_github_output({
+            "outcome": "error",
+            "run_id": "",
+            "iterations": "0",
+            "branch_name": "",
+            "pr_url": "",
+            "final_message": message,
+        })
         sys.exit(1)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if not os.path.isdir(repo_root):
print(f"ERROR: Repository path does not exist: {repo_root}", file=sys.stderr)
sys.exit(1)
yes_flag = args.yes or os.environ.get("CI") == "true"
task = args.task or os.environ.get("AGENT_TASK")
if not task:
print("ERROR: Task description is required. Provide --task or set the AGENT_TASK environment variable.", file=sys.stderr)
sys.exit(1)
if not os.path.isdir(repo_root):
message = f"Repository path does not exist: {repo_root}"
print(f"ERROR: {message}", file=sys.stderr)
write_github_output({
"outcome": "error",
"run_id": "",
"iterations": "0",
"branch_name": "",
"pr_url": "",
"final_message": message,
})
sys.exit(1)
yes_flag = args.yes or os.environ.get("CI") == "true"
task = args.task or os.environ.get("AGENT_TASK")
if not task:
message = "Task description is required. Provide --task or set the AGENT_TASK environment variable."
print(f"ERROR: {message}", file=sys.stderr)
write_github_output({
"outcome": "error",
"run_id": "",
"iterations": "0",
"branch_name": "",
"pr_url": "",
"final_message": message,
})
sys.exit(1)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@main.py` around lines 124 - 133, The pre-run validation exits in main()
currently call sys.exit(1) before the try block, so GitHub Actions never
receives failure outputs. Update the repo_root and task validation paths in
main.py to write the expected GitHub outputs before exiting, using the same
output-writing mechanism already used for run-agent outcomes so CI consumers see
an error state instead of empty steps.run-agent.outputs.* values.

@sreerevanth

Copy link
Copy Markdown
Owner

@sasikumar161106 please check the merge conflicts

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