fix: ensure comment replies push changes to connected PRs#10
Merged
Conversation
Previously, comment reply agents would make code changes (e.g. fixing CI failures or merge conflicts) but those changes often never reached the PR: - _commit_reply_changes only checked `git status --porcelain` for uncommitted files — if the Cursor agent committed changes itself during its session, the working tree looked clean and the function bailed without pushing. - The comment reply prompt had no PR context, so the agent didn't know a PR existed or what CI status to check. - Reused worktrees were never updated from the remote, so the agent worked on stale code if the PR branch had advanced. Changes: - Detect unpushed commits via `git log origin/<branch>..HEAD` in addition to uncommitted changes, so agent-committed work always gets pushed. - Pull latest (`git pull --rebase --autostash`) when reusing an existing worktree and before pushing, to handle diverged branches. - Inject Connected PR section into the comment reply prompt when a PR URL exists on the task record. - Save session ID after comment replies so subsequent replies resume the same agent session with full context. - Add poll_ci_status() in pr.py — polls CI with a shorter timeout (180s) and returns a markdown summary. After pushing, the CI result is saved as a "CI Status" section on the task record, visible in the UI. Made-with: Cursor
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
_commit_reply_changesnow checksgit log origin/<branch>..HEADfor unpushed commits — not justgit status --porcelain. When the Cursor agent commits changes itself during a session but doesn't push, those commits are now reliably pushed to the PR.## Connected PRsection with the PR URL when one exists, and instructs the agent that changes will be auto-pushed. This gives the agent awareness of the PR for fixing CI failures, merge conflicts, etc.git pull --rebase --autostashbefore the agent runs, and again before pushing, preventing stale-code edits and push rejections from diverged branches.poll_ci_status()inpr.pypolls CI with a shorter timeout (180s, configurable viaREPLY_CI_TIMEOUT) and saves the result as a## CI Statussection on the task — visible in the UI and available as context for future agent interactions.Test plan
Made with Cursor