fix(draft): tell the drafter which commits on the base branch already mention the issue (AGT-4674) - #814
Merged
Conversation
… mention the issue (AGT-4674) While an issue stays open, a fix that already landed on main is rebuilt from scratch: AX-1828 ran seven times and was published as PR #797 over two test files and a month-column fix that main already carried (4b874c2f3, 0c8b0e800, bba3be446), and the run was then reported complete. The brief never looked at the base branch's history for the issue. Look up the newest commits whose message names the issue (one bounded git log, substring matches filtered by identifier boundary) and add an 'Already on the base branch for this issue' section to the task-specific part of the prompt, asking the worker to compare them with the checklist and build only what is missing. Any git failure leaves the prompt as before.
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.
TL;DR
The draft analyzer builds the worker's brief from the registry, the knowledge graph and peer issues, but never looks at the base branch's history for the issue itself. While an issue stays open, a fix that already landed on
mainis rebuilt from scratch, and the run is then reported complete.Evidence (cgf-portal, 2026-10-03)
mainalready had4b874c2f3(pins the 44-row shape intest_b1_store_names.pyand_db.py),0c8b0e800andbba3be446(month cell on one line). The PR's two test files are the same onesmainchanged, so it conflicts in both, and it is 22 commits behindmain.tracker.completeand Linear moved AX-1828 to In Review, on a duplicate PR.src/consultsgit log --grepfor an issue identifier.Change
baseBranchCommits.ts:findBaseCommitsForIssue(projectPath, identifier)runs one boundedgit log <base> --fixed-strings --grep=<id>(base = first oforigin/HEAD,origin/main,origin/master,main,masterthat resolves), keeps records that name the identifier on a boundary (AX-18281is notAX-1828), lists at most 8. Only tracker-shaped identifiers are looked up; a missing ref, a non-repository, a timeout or a bad identifier gives an empty list.draftAnalyzer.ts: the list goes into the task-specific part of the prompt as## Already on the base branch for this issue, asking the worker to compare the commits with the checklist and build only what is missing, or say that it is all there. The project-stable prefix is untouched.Tests
runDraftAnalysis: the section appears after## Taskwhen the base has commits, and the prompt is unchanged when it has none.vitestdraft analyzer and runner suites: 9 files, 180 tests pass.Not in this PR
Closing PR #797 (needs the operator) and parking an issue automatically when the base already has commits for it.
After deploy
A brief for an issue with commits on
mainlogs[Draft] N commit(s) on the base branch already mention this issue.