Skip to content

fix: three runtime and logic bugs#25

Merged
autogame-17 merged 3 commits intoEvoMap:mainfrom
onthebigtree:fix/bug-fixes-batch
Feb 22, 2026
Merged

fix: three runtime and logic bugs#25
autogame-17 merged 3 commits intoEvoMap:mainfrom
onthebigtree:fix/bug-fixes-batch

Conversation

@onthebigtree
Copy link
Contributor

@onthebigtree onthebigtree commented Feb 20, 2026

Summary

  • selector.js: matchPatternToSignals was defined but missing from module.exports. evolve.js imports it at line 17 to filter hub candidates against current signals — any evolution cycle reaching that path threw TypeError: matchPatternToSignals is not a function.

  • index.js: Initial value of currentSleepMs was computed as Math.min(maxSleepMs, Math.max(minSleepMs, minSleepMs)). The inner Math.max(minSleepMs, minSleepMs) always equals minSleepMs, reducing the expression to Math.min(maxSleepMs, minSleepMs). If EVOLVER_MAX_SLEEP_MS is misconfigured below EVOLVER_MIN_SLEEP_MS, the daemon starts with a sleep value below its own minimum — violating the invariant the rest of the loop maintains. Replaced with minSleepMs.

  • solidify.js: checkConstraints used Math.max(Number(constraints.max_files) || 0, 20), silently raising any gene-defined max_files below 20 to 20. A built-in gene already uses max_files: 12 (line 780), which was ignored. Changed to only fall back to the default of 20 when no constraint is set.

  • solidify.js / evolve.js (cleanup): Removed two redundant const declarations that shadowed identical outer-scope variables (sourceType in solidify.js, selectedBy in evolve.js). No behaviour change — outer variables carry the same value and are in scope.

Test plan

  • Run an evolution cycle that triggers hub candidate filtering and confirm no TypeError from matchPatternToSignals
  • Start daemon with EVOLVER_MAX_SLEEP_MS < EVOLVER_MIN_SLEEP_MS and confirm initial sleep respects the minimum
  • Apply a gene with max_files: 5 and verify a 6-file patch is correctly flagged as a violation

🤖 Generated with Claude Code


Note

Low Risk
Small, localized runtime/logic fixes in the evolver loop, selector exports, and solidify constraint handling; low risk but affects scheduling and enforcement paths that are exercised frequently.

Overview
Fixes three runtime/logic issues affecting evolution cycles.

index.js now initializes the daemon loop sleep interval to minSleepMs (avoids starting below the configured minimum). src/gep/selector.js exports matchPatternToSignals to prevent runtime failures when filtering hub/external candidates. src/gep/solidify.js corrects max_files constraint handling to respect gene-defined limits below 20 instead of silently raising them to the default; plus minor cleanup removing redundant/shadowing locals in src/evolve.js and src/gep/solidify.js.

Written by Cursor Bugbot for commit 8824801. This will update automatically on new commits. Configure here.

onthebigtree and others added 3 commits February 20, 2026 19:31
evolve.js imports matchPatternToSignals from selector.js (line 17) to
filter external hub candidates against the current signal set, but the
function was never included in module.exports. Any evolution cycle that
calls the hub-candidate filtering path would throw:
  TypeError: matchPatternToSignals is not a function

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The expression `Math.min(maxSleepMs, Math.max(minSleepMs, minSleepMs))`
reduces to `Math.min(maxSleepMs, minSleepMs)`. When maxSleepMs is
misconfigured to be smaller than minSleepMs, this initialises
currentSleepMs below the intended minimum, violating the invariant that
currentSleepMs >= minSleepMs that the rest of the loop maintains.

Replace with the straightforward `minSleepMs`, which is the correct
initial value (the loop resets to minSleepMs on every successful cycle).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Two fixes in this commit:

1. Gene max_files constraint silently ignored (solidify.js:265)
   `Math.max(Number(constraints.max_files) || 0, 20)` forced the
   effective limit to at least 20, so any gene with `max_files < 20`
   (e.g. the built-in gene at line 780 uses `max_files: 12`) had its
   constraint silently overridden. Replace with a conditional that only
   falls back to the default of 20 when no constraint is configured:
     Number(constraints.max_files) > 0 ? Number(constraints.max_files) : DEFAULT_MAX_FILES

2. Redundant variable declarations shadowing outer scope
   - solidify.js: `const sourceType` re-declared inside the
     `eligible_to_broadcast` block with identical logic; the outer
     declaration (line 942) is already in scope there.
   - evolve.js: `const selectedBy` re-declared inside the solidify
     `try` block with identical logic; the outer declaration (line 1036)
     is already in scope there.
   Removing the inner declarations eliminates the shadowing and ensures
   any future change to the outer declaration propagates correctly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link

@kunwl123456 kunwl123456 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified per docs/PR25-verification-report.md. LGTM, thanks for your contribution.

@autogame-17 autogame-17 merged commit d6c80d2 into EvoMap:main Feb 22, 2026
1 check passed
fmw666 pushed a commit that referenced this pull request Mar 11, 2026
- PR #68 (hendrixAIDev): guard performMaintenance with IS_DRY_RUN
- PR #26 (onthebigtree): hash hostname in env fingerprint, portable validation paths
- PR #63 (voidborne-d): add 61 unit tests for core GEP modules
- PR #21 (LKCY33): add dotenv path rewrite for public build
- PR #25 (onthebigtree): already applied (currentSleepMs, matchPatternToSignals, max_files)
- Update public.manifest.json: include test/*.test.js, add index.js dotenv rewrite

Co-authored-by: Cursor <cursoragent@cursor.com>
fmw666 pushed a commit that referenced this pull request Mar 11, 2026
Add LKCY33 (PR #21), hendrixAIDev (PR #68), toller892 (PR #149)
to acknowledgments. Update onthebigtree entry with PR #25/#26
contributions. Sync Chinese README.
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.

3 participants