Skip to content

fix: raise observer analysis turn budget#387

Merged
affaan-m merged 1 commit into
mainfrom
codex/fix-386-observer-max-turns
Mar 11, 2026
Merged

fix: raise observer analysis turn budget#387
affaan-m merged 1 commit into
mainfrom
codex/fix-386-observer-max-turns

Conversation

@affaan-m

@affaan-m affaan-m commented Mar 11, 2026

Copy link
Copy Markdown
Owner

Summary

  • raise the observer Claude turn budget from a hardcoded 3-turn ceiling to a configurable max-turn budget with a safe default of 10
  • add validation so invalid or undersized values fall back to the safe default
  • add hook-suite coverage for the observer loop max-turn contract

Testing

  • node tests/hooks/hooks.test.js

Closes #386


Summary by cubic

Switch the observer analysis loop to a configurable ECC_OBSERVER_MAX_TURNS (default 10) instead of the hardcoded 3. Invalid or undersized values fall back to 10, with new tests to enforce the contract, addressing #386.

Written for commit 16bc743. Summary will update on new commits.

Summary by CodeRabbit

  • New Features

    • Made observer loop execution configurable with a maximum turns parameter, controlled via environment variable (default: 10 turns).
    • Added validation to ensure configured values meet minimum requirements.
  • Tests

    • Added validation tests for observer loop configuration.

@coderabbitai

coderabbitai Bot commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR makes the Claude CLI's --max-turns parameter configurable in observer-loop.sh, replacing a hardcoded value of 3 with an environment-controlled default of 10, adding numeric validation and a minimum threshold check of 4.

Changes

Cohort / File(s) Summary
Observer Loop Configuration
skills/continuous-learning-v2/agents/observer-loop.sh
Replaces hardcoded --max-turns 3 with configurable max_turns variable sourced from ECC_OBSERVER_MAX_TURNS environment variable (default 10). Adds validation to ensure the value is numeric and enforces a minimum threshold of 4 turns.
Test Validation
tests/hooks/hooks.test.js
Adds test assertions to validate observer-loop.sh configuration: verifies presence of ECC_OBSERVER_MAX_TURNS variable, confirms default value of 10, and ensures hardcoded --max-turns 3 is absent. Note: test appears to be duplicated in diff.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 The observer watched with clearer sight,
Max turns increased from three to might,
Configurable now, validated right,
More instincts born in morning light! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: raising the observer analysis turn budget from a fixed 3 to a configurable maximum with a default of 10.
Linked Issues check ✅ Passed The pull request fully addresses the requirements in issue #386 by implementing configurable max-turns with validation, defaults to 10, and removes the hardcoded 3-turn limit.
Out of Scope Changes check ✅ Passed All changes are directly related to the stated objective: modifying observer-loop.sh to use configurable max-turns and adding test coverage, with no unrelated modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/fix-386-observer-max-turns

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 2 files

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 16bc7436c5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

;;
esac

if [ "$max_turns" -lt 4 ]; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Guard max-turn parsing against integer overflow

The new max-turn validation treats any digit-only string as valid, but the subsequent check if [ "$max_turns" -lt 4 ] can throw integer expression expected for oversized numeric inputs; when that happens, the fallback path is skipped and the huge value is still passed to claude --max-turns. In environments where ECC_OBSERVER_MAX_TURNS is set to an out-of-range number (for example by typo or inherited env), this bypasses the intended safe default of 10 and can cause noisy runtime errors or failed analysis runs.

Useful? React with 👍 / 👎.

@affaan-m affaan-m merged commit 0326442 into main Mar 11, 2026
38 of 39 checks passed
@affaan-m affaan-m deleted the codex/fix-386-observer-max-turns branch March 11, 2026 03:57
FrancescoRosciano pushed a commit to FRosciano-Mambo/everything-claude-code that referenced this pull request Jun 1, 2026
…max-turns

fix: raise observer analysis turn budget
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.

observer-loop.sh --max-turns 3 causes 100% analysis failure — zero instincts ever generated

1 participant