Skip to content

fix(cron): sort find_latest_digest by filename not st_mtime (Closes #1767) - #1769

Merged
Lexus2016 merged 1 commit into
mainfrom
evolution/fix-flaky-find-latest-digest
Aug 7, 2026
Merged

fix(cron): sort find_latest_digest by filename not st_mtime (Closes #1767)#1769
Lexus2016 merged 1 commit into
mainfrom
evolution/fix-flaky-find-latest-digest

Conversation

@Lexus2016

Copy link
Copy Markdown
Owner

Summary

Fixes the flaky test_find_latest_digest test that was blocking PR #1748 CI (slice 8/8).

Root cause: find_latest_digest() sorted candidate files by st_mtime. The test created an old file and a new file, then called touch() 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 by p.name gives stable, correct chronological order regardless of filesystem mtime state.

Changes

  • cron/evolution_preflight.py: find_latest_digest() now sorts by p.name instead of p.stat().st_mtime (+ updated docstring)
  • tests/cron/test_evolution_preflight.py: added test_find_latest_digest_ignores_mtime regression test + clarifying comment in existing test

Validation

  • ✅ All 5 TestDigestFallback tests pass locally
  • ruff check clean
  • ✅ 30 changed lines (well under 200-line self-merge cap)

Impact

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

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>
@github-actions github-actions Bot added the fix Bug or fix label Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on 725714a

all good!

@Lexus2016
Lexus2016 merged commit e7ee12b into main Aug 7, 2026
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug or fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI failure on PR #1748: unknown [IMPROVEMENT] Active context-denoising to defeat contextual drag from failed attempts

1 participant