LEADER: Gemini-CLI Maximization — PRIMARY routing + real free-tier quotas (no soft room) - #273
Conversation
…otas (no soft room) Issue #272 - Invert model_router selection: Gemini PRIMARY for review/triage/invoke; Omni/OpenRouter secondary - Raise Gemini soft limits to real free-tier RPD (~1000–1400) — remove artificial soft room - gemini-quota-gate default raised 900 → 1450 (aligned to documented free RPD) - Update policy comments, workflow titles, and skip messages to reflect PRIMARY role - Context-relationship skill already installed from Google Drive Full maximization of Official Agent Account quota for its best roles.
|
Mention Blocks like a regular teammate with your question or request: @blocks review this pull request Run |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Approval pendingCodeRabbit has no unresolved comments, but it could not review the latest commit because the review limit was reached. Follow the review guidance in this comment to continue. 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. Comment |
|
cycle_id: pr-273-345b1bf77961 Agent peer response gateProvider state:
Pending: Authorized interactive controls:
A provider-owned checkbox/button requires an authorized Operator Action Executor. The second-pass reviewer remains blocked until matching provider completion evidence is ingested for this SHA. |
|
cycle_id: pr-273-345b1bf77961 @coderabbitai full review Requested by the OPERATOR automation after CodeRabbit exposed an interactive review control. This requests a complete provider pass; await substantive provider output and do not treat the request as completed review. |
|
context_key: pr-273-leadergemini-maximization-p0 Feedback excerptInstructions
|
|
|
PR Summary by QodoMake Gemini PRIMARY in model routing and align quotas to real free-tier RPD
AI Description
Diagram
High-Level Assessment
Files changed (4)
|
|
context_key: pr-273-leadergemini-maximization-p0 Feedback excerptHigh-Level Assessment
|
Code Review by Qodo
1. Invoke missing Gemini fallback
|
| LEADER POLICY (2026-08-20, issue #272): | ||
| Gemini is PRIMARY for its best roles (review / triage / invoke). | ||
| OmniRoute and OpenRouter are secondary free-tier peers. | ||
| Selection = model desired + real free-tier headroom (no soft room). | ||
| Jules remains async Cloud VM builder. |
There was a problem hiding this comment.
1. Gemini primary policy undocumented 📘 Rule violation ⚙ Maintainability
This PR introduces a non-trivial routing/quota policy shift (Gemini is PRIMARY, no soft-room ceilings) but does not record the decision and rationale in a MANIFEST Review log or DEBATE.md as required. Lacking an in-repo decision record increases future audit/review risk and makes reversals or follow-up work harder to justify and coordinate.
Agent Prompt
## Issue description
The PR changes routing/quota policy (Gemini becomes PRIMARY; quotas set to real free-tier ceilings) but does not record the design debate/decision in a MANIFEST Review log or DEBATE.md.
## Issue Context
Compliance requires that non-trivial design decisions referenced by the PR be documented in-repo (not only in chat/PR description). The repo already uses proposal MANIFESTs with a Review log section.
## Fix Focus Areas
- docs/proposals/active/rate-limit-rotation/MANIFEST.md[19-33]
- .github/actions/model-router/action.yml[5-9]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| if has_gemini: | ||
| gemini_candidates = [] | ||
| for model in role_residuals.get(role, []): | ||
| model_entry = success_matrix.get("models", {}).get(model, {}) |
There was a problem hiding this comment.
2. Invoke missing gemini fallback 🐞 Bug ≡ Correctness
After this PR makes Gemini the PRIMARY selection path, the invoke role’s Gemini candidate list still omits the documented fallback model gemini-2.5-flash-lite, so the router will fall through to secondary peers (or skip) even while Gemini capacity remains.
Agent Prompt
### Issue description
Gemini is now selected as PRIMARY before peers, but `role_residuals['invoke']` (which now effectively defines Gemini PRIMARY candidates for invoke) does not include `gemini-2.5-flash-lite`. This reduces available Gemini capacity for invoke and contradicts the documented rotation schema.
### Issue Context
- The router’s new Gemini-primary block iterates `role_residuals.get(role, [])` to choose a Gemini model.
- `gemini-2.5-flash-lite` is already present in the router’s `limits` dict, and the model-rotation schema explicitly lists it as an `invoke` fallback.
### Fix Focus Areas
- scripts/model_router.py[260-264]
- docs/schemas/model-rotation.yaml[65-74]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| description: 'Max Gemini free-tier requests per day (real free-tier RPD ceiling; default 1450 — no soft room)' | ||
| required: false | ||
| default: '900' | ||
| default: '1450' |
There was a problem hiding this comment.
3. Quota docs now incorrect 🐞 Bug ⚙ Maintainability
The PR raises the gemini-quota-gate default daily limit to 1450 but leaves multiple documentation/SSOT references stating the default is 900 and showing older Gemini soft limits, which will mislead operators and future quota tuning.
Agent Prompt
### Issue description
The default daily-limit in `.github/actions/gemini-quota-gate/action.yml` was changed from 900 to 1450, but docs that describe the gate and/or list soft limits still reference the old default and old Gemini limits. This creates conflicting “source of truth” guidance.
### Issue Context
`docs/schemas/agent-roster.yaml` and `docs/ops/LANE_CONSOLIDATION_SSOT.md` are explicitly positioned as SSOT references for routing/quota behavior.
### Fix Focus Areas
- .github/actions/gemini-quota-gate/action.yml[12-16]
- docs/schemas/agent-roster.yaml[126-136]
- docs/ops/LANE_CONSOLIDATION_SSOT.md[25-44]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
|
context_key: pr-273-leadergemini-maximization-p0 Feedback excerptInstructions
|
|
context_key: pr-273-leadergemini-maximization-p0 Feedback excerptIssue descriptionGemini is now selected as PRIMARY before peers, but Issue Context
Fix Focus Areas
|
|
context_key: pr-273-leadergemini-maximization-p0 Feedback excerptIssue descriptionThe default daily-limit in Issue Context
Fix Focus Areas
Instructions
|
|
context_key: pr-273-leadergemini-maximization-p0 Feedback excerptIssue descriptionThe router policy changed (Gemini PRIMARY), but multiple workflow names/step titles and skip-comment strings still describe Gemini as residual. This makes logs/comments inaccurate and undermines the purpose of the router’s Issue ContextThis PR already updates the composite action step label to “Gemini PRIMARY”, but the consuming workflows still use the old naming. Fix Focus Areas
|
|
context_key: pr-273-leadergemini-maximization-p0 Feedback excerpt(see review threads — prefer disposition over probe scripts) Instructions
|
|
context_key: pr-273-leadergemini-maximization-p0 Feedback excerptIssue descriptionThe PR changes routing/quota policy (Gemini becomes PRIMARY; quotas set to real free-tier ceilings) but does not record the design debate/decision in a MANIFEST Review log or DEBATE.md. Issue ContextCompliance requires that non-trivial design decisions referenced by the PR be documented in-repo (not only in chat/PR description). The repo already uses proposal MANIFESTs with a Review log section. Fix Focus Areas
|
|
cycle_id: pr-273-ab97d49d2d76 Agent peer response gateProvider state:
Pending: Authorized interactive controls:
A provider-owned checkbox/button requires an authorized Operator Action Executor. The second-pass reviewer remains blocked until matching provider completion evidence is ingested for this SHA. |
|
cycle_id: pr-273-ab97d49d2d76 @coderabbitai full review Requested by the OPERATOR automation after CodeRabbit exposed an interactive review control. This requests a complete provider pass; await substantive provider output and do not treat the request as completed review. |
|
cycle_id: pr-273-b784fd7ffe52 Agent peer response gateProvider state:
Pending: Authorized interactive controls:
A provider-owned checkbox/button requires an authorized Operator Action Executor. The second-pass reviewer remains blocked until matching provider completion evidence is ingested for this SHA. |
|
cycle_id: pr-273-b784fd7ffe52 @coderabbitai full review Requested by the OPERATOR automation after CodeRabbit exposed an interactive review control. This requests a complete provider pass; await substantive provider output and do not treat the request as completed review. |
|
|
|
cycle_id: pr-273-299ea9217f39 Agent peer response gateProvider state:
Pending: Authorized interactive controls:
A provider-owned checkbox/button requires an authorized Operator Action Executor. The second-pass reviewer remains blocked until matching provider completion evidence is ingested for this SHA. |
|
context_key: pr-273-leadergemini-maximization-p0 Feedback excerptInstructions
|
Stacked updates (still one PR)Per #175 + operator directive: minimal PRs to maximize quotas. Additional commits on this branch:
Still optional on this same branch (not a new PR):
Functional routing is already live on this branch via Please run gate checks; merge when green. |
|
cycle_id: pr-273-8043c8900ee0 Agent peer response gateProvider state:
Pending: Authorized interactive controls:
A provider-owned checkbox/button requires an authorized Operator Action Executor. The second-pass reviewer remains blocked until matching provider completion evidence is ingested for this SHA. |
|
cycle_id: pr-273-8043c8900ee0 @coderabbitai full review Requested by the OPERATOR automation after CodeRabbit exposed an interactive review control. This requests a complete provider pass; await substantive provider output and do not treat the request as completed review. |
|
context_key: pr-273-leadergemini-maximization-p0 Feedback excerptInstructions
|
|
cycle_id: pr-273-378d354d4489 Agent peer response gateProvider state:
Pending: Authorized interactive controls:
A provider-owned checkbox/button requires an authorized Operator Action Executor. The second-pass reviewer remains blocked until matching provider completion evidence is ingested for this SHA. |
|
cycle_id: pr-273-378d354d4489 @coderabbitai full review Requested by the OPERATOR automation after CodeRabbit exposed an interactive review control. This requests a complete provider pass; await substantive provider output and do not treat the request as completed review. |
|
context_key: pr-273-leadergemini-maximization-p0 Feedback excerptInstructions
|
🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '== PR metadata =='
gh pr view 273 --repo timerloggedout-spec/termux-monorepo --json number,title,baseRefName,headRefName,headRefOid,files --jq '{number,title,base:.baseRefName,head:.headRefName,sha:.headRefOid,files:[.files[].path]}'
echo '== Changed files and status =='
git diff --name-status 'origin/main...HEAD' 2>/dev/null || git diff --name-status HEAD~1..HEAD
echo '== PR diff =='
git diff --find-renames --find-copies 'origin/main...HEAD' 2>/dev/null || git diff --find-renames --find-copies HEAD~1..HEAD
echo '== Candidate source/config files =='
fd -HI -t f '(^model_router\.py$|^action\.yml$|^llm-peers\.ya?ml$|^gemini-.*\.ya?ml$)' . \
-E .git -E node_modules -E dist -E build | sortLength of output: 3742 🏁 Script executed: #!/bin/bash
set -euo pipefail
repo="timerloggedout-spec/termux-monorepo"
pr="273"
echo '== Complete PR file patches from GitHub =='
gh api --paginate "repos/${repo}/pulls/${pr}/files?per_page=100" \
--jq '.[] | "===== \(.filename) =====\n\(.patch // "[No textual patch available]")"'
echo '== Python router outline =='
ast-grep outline scripts/model_router.py --items all || true
echo '== Current implementation and configuration =='
for file in \
scripts/model_router.py \
.github/actions/model-router/action.yml \
.github/actions/gemini-quota-gate/action.yml \
.github/connectors/llm-peers.yaml \
.github/workflows/gemini-invoke.yml \
.github/workflows/gemini-review.yml \
.github/workflows/gemini-triage.yml
do
echo "===== ${file} ====="
cat -n "$file"
done
echo '== Router references in all current workflow/action YAML files =='
rg -n -C 4 --glob '*.yml' --glob '*.yaml' \
'(model-router|model_router|gemini-quota-gate|ROUTER_|provider.*gemini|provider == .gemini.)' \
.githubLength of output: 93456 🏁 Script executed: #!/bin/bash
set -euo pipefail
repo="timerloggedout-spec/termux-monorepo"
pr="273"
echo '== Local and GitHub PR revision =='
printf 'local HEAD: '
git rev-parse HEAD
gh pr view "$pr" --repo "$repo" --json headRefOid,updatedAt --jq '{headRefOid,updatedAt}'
git status --short
echo '== All quota-gate references =='
rg -n -C 5 --hidden -g '!**/.git/**' \
'(gemini-quota-gate|daily-limit|use_backup_key|GEMINI_API_KEY_BACKUP)' .
echo '== All model-router call sites =='
rg -n -C 8 --hidden -g '!**/.git/**' \
'uses:\s+\./\.github/actions/model-router|scripts/model_router\.py' .
echo '== Second-pass workflow router and Gemini steps =='
cat -n .github/workflows/gemini-after-peers.yml | sed -n '90,235p'
echo '== Router-related tests and validation assets =='
fd -HI -t f . \
-E .git -E node_modules -E dist -E build \
| rg '(^|/)(test|tests|spec|scripts|\.github)/|model[_-]router|gemini.*(test|spec)' \
| sort
echo '== GitHub check status for current PR head =='
gh pr checks "$pr" --repo "$repo" --json name,state,link,workflow --jq '.[] | {name,state,workflow,link}' || trueLength of output: 201586 🏁 Script executed: #!/bin/bash
set -euo pipefail
repo="timerloggedout-spec/termux-monorepo"
pr="273"
head_sha="$(gh pr view "$pr" --repo "$repo" --json headRefOid --jq .headRefOid)"
echo "== GitHub current head: ${head_sha} =="
echo '== Current PR-head policy text in workflow files =='
for path in \
.github/workflows/gemini-triage.yml \
.github/workflows/gemini-after-peers.yml \
.github/connectors/README.md \
docs/ops/LANE_CONSOLIDATION_SSOT.md
do
echo "----- ${path} -----"
gh api "repos/${repo}/contents/${path}?ref=${head_sha}" --jq '.content' \
| tr -d '\n' | base64 --decode \
| rg -n -C 2 '(PRIMARY|primary|residual|Residual|gemini-quota-gate|soft.limit|Soft.limit)' || true
done
echo '== Direct quota-gate invocation search, excluding generated/workspace trees =='
rg -n -C 4 \
-g '!workspace/**' -g '!**/node_modules/**' -g '!**/dist/**' -g '!**/build/**' \
'(uses:\s+\./\.github/actions/gemini-quota-gate|gemini-quota-gate)' \
.github scripts tests docs || true
echo '== Router tests =='
cat -n tests/test_model_router.py
echo '== Quota / soft-skip tests =='
cat -n tests/test_ci_soft_skip.py
echo '== Workflow policy tests that inspect Gemini workflows =='
rg -n -C 3 \
-g '!workspace/**' \
'(gemini-(invoke|review|triage|after-peers)|model-router|gemini-quota-gate)' \
tests .github/workflows/workflow-surface-policy.yml || true
echo '== Finished GitHub checks =='
gh pr checks "$pr" --repo "$repo" --json name,state,workflow \
--jq '.[] | select(.state != "IN_PROGRESS" and .state != "QUEUED" and .state != "PENDING") | {name,state,workflow}'Length of output: 20514
Finding — P1
Follow-up items
The repo gate and Termux smoke checks passed. CodeQL, actionlint, workflow policy verification, workflow evidence, and Vercel were still pending when checked. Do not merge until the required checks finish successfully.
|
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '=== PR metadata ==='
gh pr view 273 --json number,title,baseRefName,headRefName,headRefOid,changedFiles,additions,deletions,mergeable,statusCheckRollup
echo '=== Changed files ==='
git diff --name-status "$(git merge-base HEAD "origin/$(gh pr view 273 --json baseRefName --jq .baseRefName)")" HEAD
echo '=== Diff ==='
git diff --find-renames --find-copies "$(git merge-base HEAD "origin/$(gh pr view 273 --json baseRefName --jq .baseRefName)")" HEAD
echo '=== Candidate source/config outlines ==='
fd -HI -t f '^(model_router\.py|action\.yml|.*gemini.*\.(yml|yaml)|llm-peers\.yaml)$' . \
-E .git -E node_modules -E dist -E build \
| sort \
| while IFS= read -r f; do
echo "--- $f"
case "$f" in
*.py) ast-grep outline "$f" --items all || true ;;
*) sed -n '1,260p' "$f" ;;
esac
doneLength of output: 95406 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '=== Gemini quota-gate references ==='
rg -n -C 4 --hidden -g '!**/.git/**' \
'gemini-quota-gate|daily-limit:|use_backup_key|steps\.[A-Za-z0-9_-]+\.outputs\.remaining' .
echo '=== Model-router and catalog references ==='
rg -n -C 3 --hidden -g '!**/.git/**' \
'model-router|llm-peers\.yaml|residual_only|COUNTER_DIR|increment_usage|fetch_openrouter_free_models_cached' \
.github scripts
echo '=== Router implementation ==='
sed -n '1,390p' scripts/model_router.py
echo '=== Workflow concurrency and router call sites ==='
rg -n -C 8 --hidden -g '!**/.git/**' \
'concurrency:|uses: \./\.github/actions/model-router|uses: \./\.github/actions/gemini-quota-gate|has-gemini:' \
.github/workflows
echo '=== Changed-file validation status ==='
gh pr checks 273 --watch=false || trueLength of output: 187883
P1 — The 1450-request ceiling is not enforced
This makes the changed “ceiling” documentation inaccurate. It also prevents the intended graceful skip when the account-level quota is exhausted. Use one shared Gemini key/account counter in the active router, or invoke Checks observed:
I found no other blocking issue in the changed files. You are interacting with an AI system. |
|
context_key: pr-273-leadergemini-maximization-p0
Feedback excerptLength of output: 95406 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '=== Gemini quota-gate refInstructions
|
|
context_key: pr-273-leadergemini-maximization-p0 Feedback excerptInstructions
|
|
context_key: pr-273-leadergemini-maximization-p0 Feedback excerptInstructions
|
Summary
Implements P0 from issue #272.
Changes
residual_only: false, Gemini soft_limits aligned to real free-tier RPD.Intent
Full maximization of the Official Agent Account (
@gemini-cli) free-tier quota for its best roles. No soft room. Acute awareness of remaining capacity.Follow-ups (P1+)
Closes the core routing defect described in #272.
— Leader