Skip to content

fix(draft): tell the drafter which commits on the base branch already mention the issue (AGT-4674) - #814

Merged
unohee merged 1 commit into
mainfrom
fix/agt-4674-base-commits
Oct 3, 2026
Merged

unohee merged 1 commit into
mainfrom
fix/agt-4674-base-commits

Conversation

@unohee

@unohee unohee commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator

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 main is rebuilt from scratch, and the run is then reported complete.

Evidence (cgf-portal, 2026-10-03)

  • AX-1828 ran 7 times from 16:22 and was published as PR build(deps): bump @vitest/mocker from 4.1.8 to 5.0.2 in the npm_and_yarn group across 1 directory #797. main already had 4b874c2f3 (pins the 44-row shape in test_b1_store_names.py and _db.py), 0c8b0e800 and bba3be446 (month cell on one line). The PR's two test files are the same ones main changed, so it conflicts in both, and it is 22 commits behind main.
  • After attempt 7 the ledger applied tracker.complete and Linear moved AX-1828 to In Review, on a duplicate PR.
  • Nothing under src/ consults git log --grep for an issue identifier.

Change

  • New baseBranchCommits.ts: findBaseCommitsForIssue(projectPath, identifier) runs one bounded git log <base> --fixed-strings --grep=<id> (base = first of origin/HEAD, origin/main, origin/master, main, master that resolves), keeps records that name the identifier on a boundary (AX-18281 is not AX-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

  • Real temporary git repositories: subject and body matches, newest first, identifier boundary, the 8 cap, no match / bad identifier / not a repository.
  • Prompt capture through runDraftAnalysis: the section appears after ## Task when the base has commits, and the prompt is unchanged when it has none.
  • Dropping the boundary check fails the boundary test; not passing the list to the prompt fails the integration test.
  • vitest draft 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 main logs [Draft] N commit(s) on the base branch already mention this issue.

… 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.
@unohee
unohee merged commit 36f7f5b into main Oct 3, 2026
7 checks passed
@unohee
unohee deleted the fix/agt-4674-base-commits branch October 3, 2026 11:38
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.

1 participant