Skip to content

feat(issues): respect declined contributor-issue drafts - #518

Merged
JSONbored merged 6 commits into
JSONbored:mainfrom
galuis116:feat/respect-declined-issue-drafts
Jun 11, 2026
Merged

feat(issues): respect declined contributor-issue drafts#518
JSONbored merged 6 commits into
JSONbored:mainfrom
galuis116:feat/respect-declined-issue-drafts

Conversation

@galuis116

Copy link
Copy Markdown
Contributor

Closes #517.

generateContributorIssueDrafts (#462) deduped only against open issues (findDuplicateContributorDraft skips state !== "open"; loadContributorIssueDraftContext loads listOpenIssues). So a maintainer who closed a generated draft saw it re-proposed — and in create mode re-created — on every run while the originating warning persisted (fingerprints are stable for policy:* / upstream:registry_drift topics). That eroded trust in the automation by re-filing declined work.

Changes

  • db/repositories.ts: add listClosedContributorDraftIssues(env, repo, markerPrefix, limit=200) — bounded, recent-first, filters closed issues whose payloadJson carries a contributor-draft marker.
  • contributor-issue-draft.ts:
    • add findDeclinedContributorDraft(closedIssues, draft, { now?, cooldownMs? }) — matches by the stable marker fingerprint; a wontfix-style label (wontfix/invalid/duplicate/not-planned) suppresses re-proposal indefinitely, otherwise the closure is honored within a 30-day cooldown so a genuine later regression can resurface.
    • new skipped_declined status + declinedBy provenance + skippedDeclined result counter; load declinedIssues in the context and short-circuit after the open-duplicate check.
  • Backward compatible: with no closed marked issues, output is unchanged. The tested open-only semantics of findDuplicateContributorDraft are preserved (closed-issue handling is a separate, additive check).

Verification

  • New unit tests: findDeclinedContributorDraft (marker / wontfix / cooldown boundary / open / no-marker / other-fingerprint) and a generation test (closed marked issue -> skipped_declined, created: 0, no GitHub POST).
  • tsc --noEmit clean; full unit suite green (1330 passed).

generateContributorIssueDrafts re-proposed (and in create mode re-created) drafts a maintainer had already closed, since dedup only considered open issues. Add a bounded closed-marked-issue lister and findDeclinedContributorDraft: a closed issue carrying a draft's stable marker suppresses re-proposal (skipped_declined) -- indefinitely for wontfix-style labels, otherwise within a 30-day cooldown so genuine regressions can resurface.
@ghost

ghost commented Jun 10, 2026

Copy link
Copy Markdown

Note

Gittensory Gate skipped

PR closed before full evaluation. No late first comment was created.

Signal Result Evidence Action
Gate result ⚠️ Skipped #518 is no longer open. No action.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

@ghost ghost added the gittensory:reviewed label Jun 10, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

… gate

Mark the defensive declinedIssues [] fallback (unreachable via loadContributorIssueDraftContext) with v8 ignore, and add a findDeclinedContributorDraft case for a missing close timestamp, restoring branch coverage above the 97% gate.
@JSONbored JSONbored added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jun 10, 2026
After merging main, the self-repo (JSONbored/gittensory) now carries a bundled focus manifest (#389), changing its generated draft, so the declined-draft generation test no longer matched its hardcoded policy fingerprint. Use a non-self repo (other-owner/other-repo) -- as the sibling duplicate-draft test does -- so the focus_policy_missing candidate is deterministic.

@JSONbored JSONbored left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. This correctly closes the trust-eroding re-proposal loop from #517 and is well-tested.

Root cause is accurate: generateContributorIssueDrafts deduped only against open issues (findDuplicateContributorDraft skips non-open; loadContributorIssueDraftContext loaded only listOpenIssues), so a maintainer who closed a generated draft saw it re-proposed — and in create mode re-created — on every run, since policy:* / upstream:registry_drift fingerprints are stable.

The change is clean and additive:

  • listClosedContributorDraftIssues is bounded (limit 200), recent-first, and filtered by the draft marker in payloadJson.
  • findDeclinedContributorDraft matches by the stable marker fingerprint; a wontfix-style label suppresses indefinitely, otherwise a 30-day cooldown is honored so a genuine later regression can resurface. The closed-issue check is layered after the open-duplicate check, preserving the existing open-only semantics.
  • New skipped_declined status + declinedBy provenance + counter are threaded through consistently.

Tests cover the marker / wontfix / cooldown-boundary / open / no-marker / other-fingerprint matrix plus an end-to-end generation test asserting skipped_declined, created: 0, and no GitHub POST. Backward compatible (no closed marked issues -> unchanged output). CI green.

Minor note (non-blocking): findDeclinedContributorDraft keys the cooldown off updatedAt as a proxy for closed-at; if an issue is closed and later edited, updatedAt moves forward and could extend the cooldown. Acceptable for this use, but a closedAt field would be more precise if one is available later.

@dosubot dosubot Bot added the lgtm label Jun 11, 2026
@ghost ghost mentioned this pull request Jun 11, 2026
@ghost

ghost commented Jun 11, 2026

Copy link
Copy Markdown

reviewbot · verdict: comment

Reviewed 3 changed file(s) — two independent AI reviewers:

Reviewer A · llama-3.3-70b-instruct-fp8-fast
This PR introduces a new function to list closed contributor draft issues, allowing the system to respect declined contributor-issue drafts. The code is clean and well-structured. Overall quality is high.

Suggestions

  • Consider adding input validation for the markerPrefix parameter to prevent potential SQL injection attacks
  • Add documentation for the new function in the repository's README or API documentation

Worth double-checking

  • Double-check the performance impact of the new query, especially with large issue datasets
  • Verify that the markerPrefix parameter is properly sanitized to prevent SQL injection

Reviewer B · mistral-small-3.1-24b-instruct
This PR adds functionality to respect declined contributor-issue drafts by listing closed issues with a specific marker. The implementation is clean and follows existing patterns.

Suggestions

  • Consider adding a comment explaining the purpose of the markerPrefix parameter in the listClosedContributorDraftIssues function.
  • Ensure that the limit parameter has a reasonable default and is well-documented.

Worth double-checking

  • Verify that the SQL query correctly handles edge cases, such as issues with very long payloads or special characters in the marker.
  • Check that the new function is thoroughly tested, especially for performance with large datasets.

@JSONbored
JSONbored merged commit 5226847 into JSONbored:main Jun 11, 2026
7 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

feat(issues): respect declined (closed) contributor-issue drafts to stop re-proposal churn

2 participants