-
Notifications
You must be signed in to change notification settings - Fork 3
Add Cursor agent CI fix workflow #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| name: Fix CI Failures | ||
|
|
||
| on: | ||
| workflow_run: | ||
| workflows: [Run tests for the CLI] | ||
| types: [completed] | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| actions: read | ||
|
|
||
| jobs: | ||
| attempt-fix: | ||
| if: >- | ||
| ${{ github.event.workflow_run.conclusion == 'failure' && | ||
| github.event.workflow_run.event == 'pull_request' && | ||
| github.event.workflow_run.name != 'Fix CI Failures' }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Install Cursor CLI | ||
| run: | | ||
| curl https://cursor.com/install -fsS | bash | ||
| echo "$HOME/.cursor/bin" >> $GITHUB_PATH | ||
|
|
||
| - name: Configure git identity | ||
| run: | | ||
| git config user.name "Cursor Agent" | ||
| git config user.email "cursor-agent@onkernel.com" | ||
|
|
||
| - name: Setup Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version-file: 'go.mod' | ||
|
|
||
| - name: Fix CI failure | ||
| env: | ||
| CURSOR_API_KEY: ${{ secrets.CURSOR_API_KEY }} | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| BRANCH_PREFIX: ci-fix | ||
| run: | | ||
| cursor-agent -p "You are operating in a GitHub Actions runner for the Kernel CLI repository. | ||
|
|
||
| The GitHub CLI is available as \`gh\` and authenticated via GH_TOKEN. Git is available. You have write access to repository contents and can comment on pull requests, but you must not create or edit PRs directly. | ||
|
|
||
| # Context | ||
| - Repo: ${{ github.repository }} | ||
| - Workflow Run ID: ${{ github.event.workflow_run.id }} | ||
| - Workflow Run URL: ${{ github.event.workflow_run.html_url }} | ||
| - Fix Branch Prefix: ci-fix | ||
|
|
||
| # Codebase Structure | ||
| - cmd/ - CLI commands (main command implementations) | ||
| - cmd/proxies/ - Proxy-related commands | ||
| - cmd/mcp/ - MCP server commands | ||
| - pkg/ - Supporting packages and templates | ||
| - Makefile - Build and test targets (\`make test\` runs \`go vet\` and \`go test\`) | ||
|
|
||
| # Goal | ||
| Implement an end-to-end CI fix flow: identify the failing PR, analyze the failure, make minimal targeted fixes, and propose changes back. | ||
|
|
||
| # Requirements | ||
| 1. Use \`gh run view ${{ github.event.workflow_run.id }} --log-failed\` to get failure logs | ||
| 2. Identify the PR associated with the failed workflow run | ||
| 3. Analyze the failure - common issues include: | ||
| - Go compilation errors | ||
| - Test failures (missing interface methods, type mismatches) | ||
| - Mock/fake implementations missing new interface methods | ||
| - Linting issues from \`go vet\` | ||
| 4. Make minimal, targeted edits consistent with the repo style | ||
| 5. Create/update a fix branch: ci-fix/<pr-head-branch> | ||
| 6. Push changes and post a PR comment with ONLY a compare link for quick PR creation | ||
| - Format: Describe the fix, then provide ONLY a single PR creation link | ||
| - Example format: | ||
| \"🔧 CI Fix Available | ||
| I've pushed a fix for the CI failure. | ||
|
|
||
| 👉 Click here to create a PR with the fix\" | ||
| - Do NOT include any git merge instructions or manual merge commands | ||
| - Only include the compare link (e.g., https://github.com/.../compare/...) | ||
|
|
||
| # Style Guidelines | ||
| - Go: Follow existing patterns, use testify for tests | ||
| - Comments: Keep simple, no extra formatting | ||
| - Interfaces: When adding methods to interfaces, update all implementations including test fakes | ||
|
|
||
| # Constraints | ||
| - Do NOT create PRs directly - only post comments with compare links | ||
| - Avoid duplicate comments - update existing bot comments | ||
| - If no actionable fix is possible, make no changes and post no comment | ||
| - PR comments must ONLY include the PR creation link, no manual merge instructions | ||
| " --model opus-4.5 --force --output-format=text | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checkout checks out wrong branch in workflow_run context
High Severity
The
actions/checkoutstep is missing arefparameter. In aworkflow_runcontext, checkout defaults to the repository's default branch (e.g.,main), not the PR branch that caused the CI failure. The cursor-agent will analyze and attempt to fix code on the wrong branch. To check out the PR branch, areflike${{ github.event.workflow_run.head_sha }}is needed.