fix(issueReporter): stabilize auto-issue dedup and cooldown logic#405
fix(issueReporter): stabilize auto-issue dedup and cooldown logic#405shaun0927 wants to merge 1 commit intoEvoMap:mainfrom
Conversation
…cooldown on skip, tighten existing-issue match Four interacting bugs in the auto-issue reporter combined to defeat its own purpose. Symptoms are already visible on this tracker: issues EvoMap#395, EvoMap#396, EvoMap#397, and EvoMap#404 carry identical auto-titles because the reporter cannot detect that it just filed the same thing. 1. computeErrorKey hashed the occurrence count. recurring_errsig(3x):… and recurring_errsig(4x):… produced different SHA-256 keys, so recentIssueKeys.includes() never matched and dedup was effectively off. The key is now normalized via the same regex already used in extractErrorSignature. 2. shouldReport bypassed the minStreak gate when the streak signal was absent. extractStreakCount returns 0 when no consecutive_failure_streak_N is present, and the old 'streakCount > 0 && streakCount < minStreak' guard did not fire. Callers who raised EVOLVER_ISSUE_MIN_STREAK still got early reports. The '> 0' precondition is removed. 3. maybeReportIssue rewrote lastReportedAt on the 'skip duplicate' branch even though no new issue was filed. This kept resetting the cooldown clock every cycle, so while the existing open issue stayed open, no re-report was ever possible. The skip branch now preserves the prior lastReportedAt and only updates lastSkippedAt. 4. findExistingIssue matched unrelated titles via a loose substring fallback (it.title.indexOf(titleSig) !== -1). It now requires the candidate title to begin with the known auto-issue prefix and start with the same signature. computeErrorKey, extractStreakCount, and extractErrorSignature are exported so the regressions can be covered by unit tests. Three new cases in test/issueReporter.test.js exercise the three behaviours. Verification: node test/issueReporter.test.js # before: TypeError: computeErrorKey is not a function # after: issueReporter.test.js: OK
|
Thank you for the contribution, @shaun0927. As noted in SECURITY.md and our previous triage on related PRs, This specific change has been recorded and will be hand-ported into the internal maintainer branch ahead of the next release, with credit to you. Closing this PR accordingly; the underlying issue will be closed or referenced when the port lands. If you have more suggestions we welcome them as issues (not PRs) so we can triage without creating merge-path confusion. |
|
Hi @shaun0927 — this has shipped in v1.69.10 (release, npm). Ported:
Same note on attribution: the public mirror is built from an internal maintainer branch, so the commit lands via our release pipeline rather than a direct merge. Credit is noted in the v1.69.10 release notes. Thank you. |
Problem
Four interacting bugs in
src/gep/issueReporter.jscombine to defeat themodule's own purpose. The symptoms are already visible on this tracker:
issues #395, #396, #397, and #404 are identical auto-filed duplicates
that the reporter was supposed to suppress.
computeErrorKeyhashes the occurrence count. It feeds signalslike
recurring_errsig(3x):timeout in API callandrecurring_errsig(4x):timeout in API callverbatim into SHA-256, sothe same underlying error produces a different key every emission.
recentIssueKeys.includes(errorKey)can never match.shouldReportbypasses theminStreakgate when the streaksignal is absent.
extractStreakCountreturns0when noconsecutive_failure_streak_Nsignal is present, and thestreakCount > 0 && streakCount < minStreakguard short-circuits.Users who raise
EVOLVER_ISSUE_MIN_STREAKstill get early reports.maybeReportIssueresetslastReportedAton the skip branch.When
findExistingIssuereturns an existing open issue, the codelogs "skipping duplicate" but still writes
lastReportedAt: new Date().toISOString(). The cooldown check thensees a freshly-bumped timestamp, so as long as the existing open
issue stays open, no re-report is ever possible.
findExistingIssuesubstring fallback matches unrelatedtitles. The fallback
it.title.indexOf(titleSig) !== -1matchesany title that merely contains the signature as a substring.
computeErrorKey,extractStreakCount, andextractErrorSignaturewere not exported, which is how all three bugs in category (1)–(3)
shipped without test coverage.
Fix
recurring_errsig(Nx):prefix insidecomputeErrorKey(uses the same regex that
extractErrorSignaturealready uses).> 0precondition from theminStreakgate.lastReportedAton the skip branch; onlylastSkippedAtandrecentIssueKeysare updated.both the auto-issue prefix and the same signature.
Testing
Against
mainwith the new test cases (added in this PR):With this PR applied:
The three new test cases cover:
computeErrorKeyis stable across(3x),(4x),(5x)prefixes.shouldReport(minStreak=5)returnsfalsewhen the streak signal ismissing, and
truewhen the streak meets the minimum.findExistingIssuedoes not match a title that contains the searchsignature as an unrelated substring.
Scope
src/gep/issueReporter.js— 4 focused edits, no behaviour changeoutside the bug paths; module exports gain three helpers (additive).
test/issueReporter.test.js— three new cases.No changes to obfuscated modules. No config changes. No new
dependencies.
Follow-ups (not in this PR)
DEFAULT_REPO = 'autogame-17/capability-evolver'legacy handle —separate issue.
sanitize.jspattern gaps (Slack, JWT, Azure, Discord) — separateissue.