fix(services): set finalAttempt in the e2e-test-gen and linked-issue-satisfaction retry loops - #8704
Conversation
…satisfaction retry loops selfhost/ai.ts logs a failed ai.run() at error (Sentry-visible) unless the caller passes finalAttempt:false, reserving the loud path for genuinely single-shot callers. ai-slop/ai-review/issue-plan-draft all compute finalAttempt = last-attempt && last-model on their retry loops, but ai-e2e-test-gen.ts and linked-issue-satisfaction-run.ts (identical 2-model x 3-attempt shape) never set it -- so every transient failure that later succeeds still logged a loud error for each retried attempt, inflating Sentry noise for those two features. Compute finalAttempt the same way in both loops (last attempt of the last model). Behavior-neutral for the retry/fallback logic; only the log level of retried attempts changes. Adds warn-on-retry / error-on-final tests per function, mirroring ai-slop's convention.
|
🚨 Contributor flagged. Click here for more info: Superagent Dashboard |
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8704 +/- ##
==========================================
+ Coverage 90.56% 90.61% +0.05%
==========================================
Files 96 98 +2
Lines 22490 22622 +132
Branches 3884 3946 +62
==========================================
+ Hits 20367 20499 +132
Misses 1945 1945
Partials 178 178
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Warning ⏸️ LoopOver review result - manual review recommendedReview updated: 2026-07-26 00:02:35 UTC
Review summary Nits — 4 non-blocking
Flagged checks (non-blocking)
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
What & why
Closes #8673.
selfhost/ai.tslogs a failedai.run()at error (Sentry-visible) unless the caller passesfinalAttempt: false— reserving the loud path for genuinely single-shot callers; a retried attempt should log at quiet warn.ai-slop.ts,ai-review.ts, andissue-plan-draft.tsall correctly computefinalAttempt = last-attempt && last-modelon their multi-attempt loops.ai-e2e-test-gen.tsandlinked-issue-satisfaction-run.tsrun the identical 2-model × 3-attempt retry loop but never setfinalAttempt. Per the contract, an unset value means single-shot → always loud. So every transient failure that eventually succeeds on a later retry still logged a Sentry-visibleerrorfor each earlier attempt in these two features — an observability/noise bug (inflated Sentry error volume), not a functional one.The fix
Compute
finalAttempt: attempt === ATTEMPTS_PER_MODEL - 1 && modelIndex === MODELS.length - 1on bothai.run()calls (using.entries()to get the model index), matching the sibling files. Behavior-neutral for retry/fallback; only the log level of retried attempts changes (error → warn).Tests (per function, mirroring ai-slop's convention)
finalAttempt: false.finalAttempt: true([false,false,false,false,false,true]).Verified bug-catching: removing either
finalAttemptline fails that file's tests.Validation
ai-e2e-test-gen.test.ts+linked-issue-satisfaction-run.test.ts: 111 tests pass; typecheck clean; 100% of changed lines/branches covered.main, mergeable-clean.