fix(cron): sort find_latest_digest by filename not st_mtime (Closes #1767) - #1769
Merged
Merged
Conversation
Digest filenames are date-encoded (YYYY-MM-DD) so lexicographic sort gives correct chronological order without relying on st_mtime, which becomes ambiguous when files are touched/copied after creation. This flaky test blocked PR #1748 CI (slice 8/8) despite the test failure being pre-existing and unrelated to the PR's changes. Closes #1767 Co-Authored-By: Hermes Evolution <evolution@hermes.ai>
Contributor
૮ >ﻌ< ა ci reviewran on 725714a all good! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the flaky
test_find_latest_digesttest that was blocking PR #1748 CI (slice 8/8).Root cause:
find_latest_digest()sorted candidate files byst_mtime. The test created an old file and a new file, then calledtouch()on both — resetting both mtimes to ~now and making mtime-based sorting ambiguous/flaky.Fix: Digest filenames follow a sortable date-encoded convention (
YYYY-MM-DD.json/.md, optionally with-pass<N>/-tick<N>suffixes). Sorting byp.namegives stable, correct chronological order regardless of filesystem mtime state.Changes
cron/evolution_preflight.py:find_latest_digest()now sorts byp.nameinstead ofp.stat().st_mtime(+ updated docstring)tests/cron/test_evolution_preflight.py: addedtest_find_latest_digest_ignores_mtimeregression test + clarifying comment in existing testValidation
TestDigestFallbacktests pass locallyruff checkcleanImpact
Unblocks PR #1748 (
feat: active context-denoising for failed-attempt tool results, Closes #1580) whose CI was red solely due to this pre-existing flaky test — the PR's actual changes (agent/context_compressor.py, agent/failed_attempt_marker.py) are unrelated to the failure.Closes #1767