Skip to content

feat: implement issue #195 — bug(dev-lead): engine.sh defines multi-tier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6) - #556

Merged
don-petry merged 6 commits into
mainfrom
dev-lead/issue-195-20260610-2113
Jun 11, 2026
Merged

feat: implement issue #195 — bug(dev-lead): engine.sh defines multi-tier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6)#556
don-petry merged 6 commits into
mainfrom
dev-lead/issue-195-20260610-2113

Conversation

@don-petry

Copy link
Copy Markdown
Collaborator

Closes #195

Implemented by dev-lead agent. Please review.

…ier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6)
@don-petry
don-petry requested a review from a team as a code owner June 10, 2026 21:24
Copilot AI review requested due to automatic review settings June 10, 2026 21:24
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@don-petry, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 35 minutes and 39 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 33954dcf-bbca-4698-b3cd-20416b52ac36

📥 Commits

Reviewing files that changed from the base of the PR and between 28c0731 and 631695e.

📒 Files selected for processing (6)
  • scripts/dev-lead-fix-ci.sh
  • scripts/dev-lead-fix-issue.sh
  • scripts/dev-lead-fix-reviews.sh
  • scripts/engine.sh
  • tests/dev-lead/unit/test_model_dispatch.bats
  • tests/dev-lead/unit/test_provider_headroom.bats
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev-lead/issue-195-20260610-2113

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.

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces intent-based model dispatching and provider headroom checks to optimize engine selection and prevent rate-limiting issues. It adds helper functions model_for_intent and check_provider_headroom in scripts/engine.sh, updates the dev-lead scripts to pass intent types, and includes comprehensive unit tests. The review feedback highlights several robustness improvements in scripts/engine.sh, including validating that rate-limit values are numeric to prevent crashes under set -eu, avoiding the curl -sI -X POST anti-pattern, and parsing HTTP headers more reliably by handling potential whitespace variations.

Comment thread scripts/engine.sh Outdated
Comment thread scripts/engine.sh Outdated
Comment thread scripts/engine.sh Outdated
Comment thread scripts/engine.sh Outdated
Comment thread scripts/engine.sh Outdated
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — review-changes (applied)

Changes committed and pushed.

@don-petry
don-petry enabled auto-merge (squash) June 10, 2026 21:28
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 10, 2026
@don-petry
don-petry disabled auto-merge June 10, 2026 21:29

Copilot AI 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.

Pull request overview

This PR addresses issue #195 by making the dev-lead “writer” path actually use the multi-tier model configuration in engine.sh, and by improving provider fallback behavior with a proactive headroom check before invoking an engine.

Changes:

  • Add intent-based model selection (model_for_intent) and plumb intent through run_writer_with_fallback, so different dev-lead tasks can use different tier models.
  • Add check_provider_headroom and integrate it into the fallback loop to proactively skip engines near quota exhaustion.
  • Add new Bats unit tests covering model dispatch and provider headroom behavior.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
scripts/engine.sh Adds intent→model mapping and provider headroom probing; updates run_writer_with_fallback to select tier model per intent and engine.
scripts/dev-lead-fix-reviews.sh Passes INTENT_TYPE into run_writer_with_fallback so model selection matches the invoked intent.
scripts/dev-lead-fix-issue.sh Passes explicit fix-issue intent into run_writer_with_fallback.
scripts/dev-lead-fix-ci.sh Passes explicit fix-ci intent into run_writer_with_fallback.
tests/dev-lead/unit/test_provider_headroom.bats Adds unit tests for check_provider_headroom and for headroom-driven fallback skipping.
tests/dev-lead/unit/test_model_dispatch.bats Adds unit tests for model_for_intent and intent-based model selection through run_writer_with_fallback.

Comment thread scripts/engine.sh
Comment thread scripts/engine.sh
@don-petry
don-petry enabled auto-merge (squash) June 10, 2026 21:33
@don-petry
don-petry disabled auto-merge June 10, 2026 22:49
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — review-changes (applied)

Changes committed and pushed.

@don-petry
don-petry enabled auto-merge (squash) June 10, 2026 22:52
@don-petry
don-petry disabled auto-merge June 10, 2026 22:58
@don-petry
don-petry enabled auto-merge (squash) June 10, 2026 23:00
@don-petry
don-petry disabled auto-merge June 10, 2026 23:04
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — waiting on PR blockers (intent: fix-reviews)

PR: #556
No changes were committed, but the PR still has blocking checks or reviews (failing or cancelled checks, or changes-requested reviews). The retry cron will re-attempt automatically. Next attempt after: 2026-06-10T23:40:47Z

@don-petry
don-petry enabled auto-merge (squash) June 10, 2026 23:10
@don-petry
don-petry disabled auto-merge June 11, 2026 00:59
@sonarqubecloud

Copy link
Copy Markdown

@donpetry-bot donpetry-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.

Automated review — APPROVED ✓

Risk: LOW
Reviewed commit: 631695e20026a56d48c8e22f0223fc7c179f4538
Review mode: triage-approved (single reviewer)

Summary

Implements issue #195 (multi-tier model dispatch + proactive provider headroom checks). The dev-lead writer pipeline now actually uses the tiered model definitions in engine.sh — human-pr/fix-bot-comment route to haiku, fix-reviews/fix-ci/rebase to sonnet (action), fix-issue/human to deep — and a fail-open check_provider_headroom skips engines at/above 75% usage (configurable via DEV_LEAD_USAGE_THRESHOLD). The three dead-code-in-dev-lead-context functions (run_triage, run_agentic, run_duck) are now documented as review-one-pr.sh-only rather than removed, which is a reasonable scope choice. +571/-8 across 6 files, including 463 lines of new bats coverage.

Linked issue analysis

Closes #195. All acceptance criteria addressed:

  • Model dispatch: model_for_intent matches the issue's spec exactly; all three caller scripts (dev-lead-fix-ci.sh, dev-lead-fix-issue.sh, dev-lead-fix-reviews.sh) pass an intent string through.
  • Failover (bugs 1 & 2): Already resolved upstream in the existing run_writer (output is captured via tee and is_rate_limited_files; copilot path uses copilot_chat ... --yolo directly rather than falling back to claude).
  • Proactive usage monitoring (bug 3): check_provider_headroom probes Anthropic and GitHub Models rate-limit headers, fail-opens on probe failure, and is wired in ahead of each engine attempt in the fallback loop.
  • Dead code: run_triage/run_agentic/run_duck annotated as review-one-pr.sh-only (documented rather than removed — acceptable).

Findings

No blocking issues.

Minor observations (non-blocking):

  • The claude headroom probe sends a real POST /v1/messages with max_tokens:1, so each writer invocation burns ~1 token even on the happy path. This is consistent with the issue spec's intent ("barely consumes quota") and is bounded.
  • Copilot probe correctly guards against unset/placeholder tokens before making a network call — good defensive choice.
  • bats coverage is thorough (16 dispatch tests + 13 headroom tests including threshold-edge and fail-open cases).

CI status

All required checks green: Lint, ShellCheck, bats, validate-fixtures, validate-agent-profiles, unit-tests, Compile agentic workflows, Agent Security Scan, CodeQL (actions + python), Secret scan (gitleaks), SonarCloud (Quality Gate passed), AgentShield, dev-lead dispatch. coderabbitai approved; gemini-code-assist and copilot-pull-request-reviewer commented without blocking. Skipped checks (dependabot, language-specific dependency audits) are expected — not applicable to this PR.


Reviewed automatically by the PR-review agent (single-reviewer mode: opus 4.7). Reply if you need a human review.

@don-petry
don-petry merged commit 803e63f into main Jun 11, 2026
35 checks passed
@don-petry
don-petry deleted the dev-lead/issue-195-20260610-2113 branch June 11, 2026 01:07
don-petry added a commit that referenced this pull request Jun 12, 2026
…ier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6) (#556)

* feat: implement issue #195 — bug(dev-lead): engine.sh defines multi-tier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6)

* chore: apply manual instructions [skip ci-relay]

* chore: apply manual instructions [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Jun 13, 2026
…ier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6) (#556)

* feat: implement issue #195 — bug(dev-lead): engine.sh defines multi-tier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6)

* chore: apply manual instructions [skip ci-relay]

* chore: apply manual instructions [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Jun 13, 2026
…ier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6) (#556)

* feat: implement issue #195 — bug(dev-lead): engine.sh defines multi-tier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6)

* chore: apply manual instructions [skip ci-relay]

* chore: apply manual instructions [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Jun 14, 2026
…ier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6) (#556)

* feat: implement issue #195 — bug(dev-lead): engine.sh defines multi-tier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6)

* chore: apply manual instructions [skip ci-relay]

* chore: apply manual instructions [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Jun 15, 2026
…ier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6) (#556)

* feat: implement issue #195 — bug(dev-lead): engine.sh defines multi-tier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6)

* chore: apply manual instructions [skip ci-relay]

* chore: apply manual instructions [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Jun 18, 2026
…ier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6) (#556)

* feat: implement issue #195 — bug(dev-lead): engine.sh defines multi-tier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6)

* chore: apply manual instructions [skip ci-relay]

* chore: apply manual instructions [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Jun 21, 2026
…ier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6) (#556)

* feat: implement issue #195 — bug(dev-lead): engine.sh defines multi-tier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6)

* chore: apply manual instructions [skip ci-relay]

* chore: apply manual instructions [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Jun 23, 2026
…ier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6) (#556)

* feat: implement issue #195 — bug(dev-lead): engine.sh defines multi-tier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6)

* chore: apply manual instructions [skip ci-relay]

* chore: apply manual instructions [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Jun 23, 2026
…ier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6) (#556)

* feat: implement issue #195 — bug(dev-lead): engine.sh defines multi-tier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6)

* chore: apply manual instructions [skip ci-relay]

* chore: apply manual instructions [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Jun 23, 2026
…ier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6) (#556)

* feat: implement issue #195 — bug(dev-lead): engine.sh defines multi-tier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6)

* chore: apply manual instructions [skip ci-relay]

* chore: apply manual instructions [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Jun 25, 2026
…ier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6) (#556)

* feat: implement issue #195 — bug(dev-lead): engine.sh defines multi-tier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6)

* chore: apply manual instructions [skip ci-relay]

* chore: apply manual instructions [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Jun 25, 2026
…ier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6) (#556)

* feat: implement issue #195 — bug(dev-lead): engine.sh defines multi-tier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6)

* chore: apply manual instructions [skip ci-relay]

* chore: apply manual instructions [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Jun 25, 2026
…ier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6) (#556)

* feat: implement issue #195 — bug(dev-lead): engine.sh defines multi-tier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6)

* chore: apply manual instructions [skip ci-relay]

* chore: apply manual instructions [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Aug 2, 2026
…ier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6) (#556)

* feat: implement issue #195 — bug(dev-lead): engine.sh defines multi-tier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6)

* chore: apply manual instructions [skip ci-relay]

* chore: apply manual instructions [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Aug 3, 2026
…ier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6) (#556)

* feat: implement issue #195 — bug(dev-lead): engine.sh defines multi-tier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6)

* chore: apply manual instructions [skip ci-relay]

* chore: apply manual instructions [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Aug 3, 2026
…ier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6) (#556)

* feat: implement issue #195 — bug(dev-lead): engine.sh defines multi-tier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6)

* chore: apply manual instructions [skip ci-relay]

* chore: apply manual instructions [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Aug 7, 2026
…ier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6) (#556)

* feat: implement issue #195 — bug(dev-lead): engine.sh defines multi-tier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6)

* chore: apply manual instructions [skip ci-relay]

* chore: apply manual instructions [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Aug 7, 2026
…ier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6) (#556)

* feat: implement issue #195 — bug(dev-lead): engine.sh defines multi-tier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6)

* chore: apply manual instructions [skip ci-relay]

* chore: apply manual instructions [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Aug 7, 2026
…ier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6) (#556)

* feat: implement issue #195 — bug(dev-lead): engine.sh defines multi-tier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6)

* chore: apply manual instructions [skip ci-relay]

* chore: apply manual instructions [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Aug 7, 2026
…ier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6) (#556)

* feat: implement issue #195 — bug(dev-lead): engine.sh defines multi-tier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6)

* chore: apply manual instructions [skip ci-relay]

* chore: apply manual instructions [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Aug 7, 2026
…ier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6) (#556)

* feat: implement issue #195 — bug(dev-lead): engine.sh defines multi-tier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6)

* chore: apply manual instructions [skip ci-relay]

* chore: apply manual instructions [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Aug 8, 2026
…ier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6) (#556)

* feat: implement issue #195 — bug(dev-lead): engine.sh defines multi-tier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6)

* chore: apply manual instructions [skip ci-relay]

* chore: apply manual instructions [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Aug 8, 2026
…ier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6) (#556)

* feat: implement issue #195 — bug(dev-lead): engine.sh defines multi-tier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6)

* chore: apply manual instructions [skip ci-relay]

* chore: apply manual instructions [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Aug 8, 2026
…ier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6) (#556)

* feat: implement issue #195 — bug(dev-lead): engine.sh defines multi-tier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6)

* chore: apply manual instructions [skip ci-relay]

* chore: apply manual instructions [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
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.

bug(dev-lead): engine.sh defines multi-tier model pipeline but all tasks always invoke ENGINE_ACTION_MODEL (sonnet-4-6)

3 participants