Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions skills/continuous-learning-v2/agents/observer-loop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -205,17 +205,20 @@ PROMPT
fi

timeout_seconds="${ECC_OBSERVER_TIMEOUT_SECONDS:-120}"
max_turns="${ECC_OBSERVER_MAX_TURNS:-20}"
# 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=20
max_turns=50
;;
esac

if [ "$max_turns" -lt 4 ]; then
max_turns=20
max_turns=50
fi

# Ensure CWD is PROJECT_DIR so the relative analysis_relpath resolves correctly
Expand Down
2 changes: 1 addition & 1 deletion tests/hooks/hooks.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3137,7 +3137,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:-20}"'), 'observer-loop should default to 20 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');
Expand Down