Skip to content

fix: use last_edited_at instead of updated_at for post-merge edit detection#375

Open
ClawdiaHedgehog wants to merge 23 commits intoentrius:testfrom
ClawdiaHedgehog:fix/post-merge-edit-detection
Open

fix: use last_edited_at instead of updated_at for post-merge edit detection#375
ClawdiaHedgehog wants to merge 23 commits intoentrius:testfrom
ClawdiaHedgehog:fix/post-merge-edit-detection

Conversation

@ClawdiaHedgehog
Copy link
Copy Markdown

Summary

Fixed a bug where issue discovery was incorrectly penalizing legitimate solved issues.

Problem: The anti-gaming check used issue.updated_at > pr.merged_at to detect post-merge edits. But GitHub's updatedAt field reflects ANY activity on the issue — comments, label changes, and critically the closing event itself. This meant nearly all legitimately solved issues were being penalized.

Solution: Use last_edited_at (GitHub's lastEditedAt field) which specifically tracks body/title edits by the author, not automatic timestamps like closing.

Changes

  • gittensor/classes.py: Added last_edited_at field to Issue class
  • gittensor/utils/github_api_tools.py: Added lastEditedAt to GraphQL query, updated functions to return it
  • gittensor/utils/models.py: Added last_edited_at to PRInfo TypedDict
  • gittensor/validator/issue_discovery/repo_scan.py: Pass last_edited_at to Issue objects
  • gittensor/validator/issue_discovery/scoring.py: Updated anti-gaming check to use last_edited_at
  • tests/utils/test_github_api_tools.py: Updated test unpacking

Testing

All 272 tests pass.

Related Issues

Fixes #372
Fixes #373

anderdc and others added 23 commits March 20, 2026 14:34
Co-authored-by: Ander <61125407+anderdc@users.noreply.github.com>
Co-authored-by: Ander <61125407+anderdc@users.noreply.github.com>
Co-authored-by: Ander <61125407+anderdc@users.noreply.github.com>
Co-authored-by: Zanie Blue <contact@zanie.dev>
…ate scoring (entrius#314)

Co-authored-by: root <root@135-181-76-236.ptr>
Co-authored-by: Ander <61125407+anderdc@users.noreply.github.com>
Co-authored-by: Ander <61125407+anderdc@users.noreply.github.com>
Co-authored-by: anderdc <me@alexanderdc.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Ander <61125407+anderdc@users.noreply.github.com>
Co-authored-by: Ander <61125407+anderdc@users.noreply.github.com>
…res (entrius#346)

Co-authored-by: mkdev11 <MkDev11@users.noreply.github.com>
…ount (entrius#340)

Co-authored-by: Ander <61125407+anderdc@users.noreply.github.com>
…s#351)

Co-authored-by: Ander <61125407+anderdc@users.noreply.github.com>
Co-authored-by: anderdc <me@alexanderdc.com>
Document the new Issue Discovery feature:
- How it works (find issues, earn when solved)
- Credibility system (separate from PR credibility)
- Qualification gates (7 valid issues, 80% credibility)
- Scoring rules (base score = solving PR score, no double dipping)
- Emission split (30% for issue discovery)

Link to full specification in issue_discovery/issue-discovery-rewards.md

Part of SN74 Gittensor contribution work.
…ection

Bug: Issue discovery was penalizing nearly all legitimately solved issues
because GitHub's updatedAt field is updated by ANY issue activity (including
the closing event itself), not just body/title edits.

Fix:
- Added last_edited_at field to Issue class (populated from GitHub's lastEditedAt)
- Added lastEditedAt to _PR_TIMELINE_QUERY GraphQL query
- Updated _search_issue_referencing_prs_graphql to capture and return lastEditedAt
- Updated find_solver_from_cross_references to return last_edited_at as 3rd value
- Updated repo_scan.py to pass last_edited_at to Issue objects
- Updated scoring.py anti-gaming check to use last_edited_at (with updated_at fallback)

Now the anti-gaming check correctly identifies actual post-merge body/title
edits rather than conflating them with the issue closing event.

Fixes entrius#372
Fixes entrius#373
@anderdc
Copy link
Copy Markdown
Collaborator

anderdc commented Apr 12, 2026

please fix conflicts

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.

Bug: Post-merge edit detection uses updated_at instead of last_edited_at, penalizing most solved issues