Skip to content

fix: align reaper scan with reap eligibility#3455

Open
Bella-Giraffety wants to merge 3 commits intogastownhall:mainfrom
Bella-Giraffety:polecat/mayor-gs-mn3
Open

fix: align reaper scan with reap eligibility#3455
Bella-Giraffety wants to merge 3 commits intogastownhall:mainfrom
Bella-Giraffety:polecat/mayor-gs-mn3

Conversation

@Bella-Giraffety
Copy link
Copy Markdown

Summary

  • make Scan() exclude agent wisps using the same stale-wisp eligibility that Reap() already uses
  • add focused regression coverage so the Scan() function body specifically must contain the agent-bead exclusion
  • keep the change scoped to scan/reap eligibility alignment only; purge and stale-issue behavior are unchanged

Related Issue

  • Fixes gs-mn3

Bug

A live reproduction on hq showed:

  • gt reaper scan --db hq --max-age=24h reported 4 reap candidates
  • gt reaper reap --db hq --max-age=24h closed 0

The root cause was a predicate mismatch:

  • Scan() counted all stale open wisps
  • Reap() explicitly excluded issue_type='agent'

So scan could report candidates that reap would never close, especially when the candidates were all agent wisps.

Why this fix

This is the smallest safe fix: keep the existing Reap() behavior and make Scan() use the same eligibility predicate. That makes the operator-facing scan count truthful without widening the change into purge or stale-issue logic.

Testing

Focused command run:

  • GOTOOLCHAIN=auto go test ./internal/reaper -run 'TestReap|TestScanExcludesAgentBeads'

Coverage:

  • TestScanExcludesAgentBeads now scopes its assertion to the Scan() function body specifically, so it cannot pass just because Reap() already had the agent exclusion.

Review process

This branch went through pre-implementation review and a second review wave against the implementation branch. Incorporated findings covered:

  • keeping the change limited to scan/reap eligibility alignment
  • ensuring the regression test actually targets Scan() instead of matching the broader file text
  • confirming operator-facing scan/reap counts now correspond for agent wisps

@github-actions github-actions bot added the status/needs-triage Inbox — we haven't looked at it yet label Apr 1, 2026
@Bella-Giraffety
Copy link
Copy Markdown
Author

Rebuilt this PR on a clean upstream main base and force-pushed it so it now contains only the scan/reap eligibility alignment fix and focused tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status/needs-triage Inbox — we haven't looked at it yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants