ECC/tests
zucchini a3d8d8ab92
fix(observer): auto-scale max_turns by analysis batch size (#2062)
* fix(observer): auto-scale max_turns by analysis batch size (#2035)

The hardcoded default of MAX_TURNS=20 is insufficient when
MAX_ANALYSIS_LINES=500 (also the default). Claude exhausts its turn
budget before it can write all discovered instinct files, producing:

  Error: Reached max turns (20)

Fix: when ECC_OBSERVER_MAX_TURNS is not explicitly set, compute
max_turns proportionally to the actual analysis batch size:
  max_turns = clamp(analysis_count / 10, 20, 100)

This gives:
  - 20–199 lines → 20 turns  (existing floor, unchanged)
  - 500 lines    → 50 turns  (resolves the reported failure)
  - 1000 lines   → 100 turns (cap)

Explicitly setting ECC_OBSERVER_MAX_TURNS still overrides the
auto-scaled value, preserving the existing escape hatch.

* test(observer): update max_turns test for auto-scaling; document validation

The max-turns budget test in tests/hooks/hooks.test.js still asserted the removed literal max_turns="${ECC_OBSERVER_MAX_TURNS:-20}", which would fail against the new auto-scaling logic. Assert the auto-scale formula and the 20/100 clamp bounds instead.

Also add the explanatory comment CodeRabbit requested above the max_turns sanitization block, clarifying it guards the explicit ECC_OBSERVER_MAX_TURNS override path.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-07 13:25:29 +08:00
..
ci feat: add dynamic workflow team orchestration surface 2026-06-04 21:45:13 +08:00
commands fix: accept crlf command frontmatter 2026-04-30 03:41:18 -04:00
docs docs: define ECC platform value loop (#2119) 2026-06-02 19:51:02 +08:00
hooks fix(observer): auto-scale max_turns by analysis batch size (#2062) 2026-06-07 13:25:29 +08:00
integration fix(hooks): avoid escaped quotes in plugin bootstrap 2026-05-19 05:15:42 -04:00
lib feat: worktree-lifecycle service (deterministic conflict prediction + safe GC) (#2164) 2026-06-07 13:00:08 +08:00
scripts feat: add dynamic workflow team orchestration surface 2026-06-04 21:45:13 +08:00
__init__.py Small changes 2026-04-12 12:34:45 +05:30
codex-config.test.js fix(codex): broaden context7 config checks 2026-03-29 00:26:16 -04:00
conftest.py docs: salvage focused stale PR contributions 2026-05-11 05:31:12 -04:00
opencode-config.test.js fix: namespace opencode command agents 2026-04-05 14:21:57 -07:00
opencode-plugin-hooks.test.js fix: harden opencode project file probes 2026-05-11 22:40:19 -04:00
plugin-manifest.test.js docs: record rc1 live package readbacks (#2117) 2026-06-02 19:32:59 +08:00
run-all.js feat: worktree-lifecycle service (deterministic conflict prediction + safe GC) (#2164) 2026-06-07 13:00:08 +08:00
test_astraflow_provider.py feat: add Astraflow provider support 2026-05-11 23:21:46 -04:00
test_builder.py docs: salvage focused stale PR contributions 2026-05-11 05:31:12 -04:00
test_claude_provider.py docs: salvage focused stale PR contributions 2026-05-11 05:31:12 -04:00
test_executor.py Small changes 2026-04-12 12:34:45 +05:30
test_provider_tools.py fix: harden openai-compatible provider responses 2026-05-18 01:04:28 -04:00
test_resolver.py feat: add Astraflow provider support 2026-05-11 23:21:46 -04:00
test_templates.py docs: salvage focused stale PR contributions 2026-05-11 05:31:12 -04:00
test_types.py feat: add Astraflow provider support 2026-05-11 23:21:46 -04:00