Skip to content

bug: carryForwardComment drops GitHubID — causes duplicate PR comments after round-complete #314

@tomasz-tomczyk

Description

@tomasz-tomczyk

Summary

carryForwardComment() in watch.go:280 copies all Comment fields except GitHubID. When a comment pulled from GitHub (via crit pull) is carried forward during a round-complete, its GitHubID is lost.

Impact

After a multi-round review cycle using crit pull + crit push:

  1. crit pull fetches PR comments, setting GitHubID on each
  2. Agent makes edits, triggers round-complete
  3. carryForwardComment creates new comment copies without GitHubID
  4. crit push sees GitHubID == 0 and treats them as new local comments
  5. Duplicate comments posted to the GitHub PR

Reproduction

  1. crit pull on a PR with existing review comments
  2. Trigger round-complete (agent calls POST /api/round-complete)
  3. crit push --dry-run — observe that pulled comments now appear as "new" comments to push

Fix

Add GitHubID: old.GitHubID to the return struct in carryForwardComment() at watch.go:281.

Also copy GitHubID for replies — while Replies: old.Replies copies the slice, each reply's GitHubID is preserved since they're value types. But it's worth verifying this explicitly in a test.

Found by

Release audit of v0.9.2..HEAD — pre-existing issue, not introduced in this cycle.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions