From 3c32a017a2786d3ca41dafe9f0f44f2539f62919 Mon Sep 17 00:00:00 2001 From: Tommy Tyrnov-Tuchin Date: Mon, 25 May 2026 22:06:07 +0300 Subject: [PATCH] fix(continuous-learning): bump observer MAX_TURNS default to 50 (#2035) The observer's MAX_TURNS default of 20 was systematically insufficient for the MAX_ANALYSIS_LINES default of 500. First-cycle analysis on a fresh project consistently failed with "Reached max turns (20)", forcing users to either raise ECC_OBSERVER_MAX_TURNS or lower ECC_OBSERVER_MAX_ANALYSIS_LINES before the observer became useful. Pair the defaults so the out-of-the-box experience succeeds: bump MAX_TURNS to 50 (the value the reporter empirically settled on for the 500-line default). The safety floor (turns < 4 falls back to default) is preserved. Test asserting the default constant is updated alongside the source. --- skills/continuous-learning-v2/agents/observer-loop.sh | 9 ++++++--- tests/hooks/hooks.test.js | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/skills/continuous-learning-v2/agents/observer-loop.sh b/skills/continuous-learning-v2/agents/observer-loop.sh index e2045d66..601e9c7a 100755 --- a/skills/continuous-learning-v2/agents/observer-loop.sh +++ b/skills/continuous-learning-v2/agents/observer-loop.sh @@ -170,17 +170,20 @@ Rules: PROMPT timeout_seconds="${ECC_OBSERVER_TIMEOUT_SECONDS:-120}" - max_turns="${ECC_OBSERVER_MAX_TURNS:-10}" + # Default MAX_TURNS=50 to pair with the MAX_ANALYSIS_LINES=500 default (#2035). + # A 500-observation batch consistently exhausted the previous 20-turn budget, + # forcing every first-cycle analysis to fail with "Reached max turns". + max_turns="${ECC_OBSERVER_MAX_TURNS:-50}" exit_code=0 case "$max_turns" in ''|*[!0-9]*) - max_turns=10 + max_turns=50 ;; esac if [ "$max_turns" -lt 4 ]; then - max_turns=10 + max_turns=50 fi # Ensure CWD is PROJECT_DIR so the relative analysis_relpath resolves correctly diff --git a/tests/hooks/hooks.test.js b/tests/hooks/hooks.test.js index 9fa28def..65f2c989 100644 --- a/tests/hooks/hooks.test.js +++ b/tests/hooks/hooks.test.js @@ -2461,7 +2461,7 @@ async function runTests() { const observerLoopSource = fs.readFileSync(path.join(__dirname, '..', '..', 'skills', 'continuous-learning-v2', 'agents', 'observer-loop.sh'), 'utf8'); assert.ok(observerLoopSource.includes('ECC_OBSERVER_MAX_TURNS'), 'observer-loop should allow max-turn overrides'); - assert.ok(observerLoopSource.includes('max_turns="${ECC_OBSERVER_MAX_TURNS:-10}"'), 'observer-loop should default to 10 turns'); + assert.ok(observerLoopSource.includes('max_turns="${ECC_OBSERVER_MAX_TURNS:-50}"'), 'observer-loop should default to 50 turns to pair with MAX_ANALYSIS_LINES=500 (#2035)'); assert.ok(!observerLoopSource.includes('--max-turns 3'), 'observer-loop should not hardcode a 3-turn limit'); assert.ok(observerLoopSource.includes('ECC_SKIP_OBSERVE=1'), 'observer-loop should suppress observe.sh for automated sessions'); assert.ok(observerLoopSource.includes('ECC_HOOK_PROFILE=minimal'), 'observer-loop should run automated analysis with the minimal hook profile');