Skip to content

Comments

fix(ai-contracts-test): add no-changes tracking to prevent ranker loops#18601

Merged
smartcontracts merged 6 commits intodevelopfrom
ari/ai-test-no-change-fix
Dec 12, 2025
Merged

fix(ai-contracts-test): add no-changes tracking to prevent ranker loops#18601
smartcontracts merged 6 commits intodevelopfrom
ari/ai-test-no-change-fix

Conversation

@aliersh
Copy link
Contributor

@aliersh aliersh commented Dec 12, 2025

This PR adds TOML-based tracking for tests with comprehensive coverage to prevent the ranker from repeatedly selecting the same files when no improvements are needed.

Reason

The system had no mechanism to track when Devin analyzed a test and determined no changes were needed. This caused a loop where the ranker would repeatedly select the same test file on subsequent runs, wasting resources and time. Without persistent tracking, tests with already-comprehensive coverage would be re-analyzed indefinitely. This PR implements TOML-based tracking with automatic reintegration when contracts change, breaking the loop and allowing the system to progress through the test suite efficiently.

Changes

  • Add no-need-changes.toml tracking system to exclude tests with comprehensive coverage from ranking
  • Implement automatic reintegration when tracked contract hash changes (stale entry detection)
  • Fix race condition in status detection by checking structured_output.changes_needed before logging outcome
  • Add 5-minute timeout when waiting for structured_output to populate in Devin blocked state
  • Add retry logic with exponential backoff for session creation API calls
  • Update Slack notification to differentiate between "finished" (test improvements) and "no_changes_needed" (comprehensive coverage) statuses
  • Include PR URL in log.json for both outcome types
  • Add two initial entries to no-changes tracking (ReinitializableBase.t.sol, SafeSend.t.sol)
  • Update documentation to explain no-changes tracking workflow and stale entry handling

- add no-need-changes.toml file for tracking tests with comprehensive coverage
- modify ranker to detect stale entries by comparing contract git hashes
- output stale_toml_entries array in ranking JSON
- inject formatted stale entry list into rendered prompt via placeholder
- remove ReinitializableBase.t.sol file from the exclusion file
- add retry loop with exponential backoff for session creation
- track blocked state duration and exit after 5-minute timeout
- parse nested structured_output for no-changes detection
- change status value from finished_no_changes to no_changes_needed
- replace prepare_notification.sh with build_notification.sh
- add notification for TOML tracking PRs when no changes needed
- create build-slack-notification just command wrapping the script
- update CircleCI to call new just command
- bump VERSION to 1.4.0 for TOML tracking feature
- remove ReinitializableBase.t.sol from exclusion list
- update runbook with TOML tracking system documentation
- document stale entry detection and automatic reintegration
- check structured_output for changes_needed field when Devin blocks
- add PR URL logging for both "finished" and "no_changes_needed" statuses
- wait up to 5 minutes for structured_output to populate after blocked state
- prioritize structured_output check before falling back to PR-only detection
- add ReinitializableBase.t.sol entry to no-need-changes.toml
- add SafeSend.t.sol entry to no-need-changes.toml
@aliersh aliersh requested a review from a team as a code owner December 12, 2025 20:28
@aliersh aliersh requested a review from bitwiseguy December 12, 2025 20:28
@codecov
Copy link

codecov bot commented Dec 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.48%. Comparing base (b6f4ad7) to head (48cd123).
⚠️ Report is 8 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #18601      +/-   ##
===========================================
- Coverage    75.78%   75.48%   -0.30%     
===========================================
  Files          189      189              
  Lines        11239    11239              
===========================================
- Hits          8517     8484      -33     
- Misses        2576     2611      +35     
+ Partials       146      144       -2     
Flag Coverage Δ
cannon-go-tests-64 66.58% <ø> (-0.82%) ⬇️
contracts-bedrock-tests 80.46% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@smartcontracts smartcontracts added this pull request to the merge queue Dec 12, 2025
Merged via the queue into develop with commit 4570daa Dec 12, 2025
90 checks passed
@smartcontracts smartcontracts deleted the ari/ai-test-no-change-fix branch December 12, 2025 21:11
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.

2 participants