Skip to content

feat(selfhost): allow per-repo AI CLI timeout overrides in review.ai_model (#8364)#8458

Merged
loopover-orb[bot] merged 5 commits into
JSONbored:mainfrom
andriypolanski:feat/8364-ai-cli-timeout-manifest-overrides-v2
Jul 24, 2026
Merged

feat(selfhost): allow per-repo AI CLI timeout overrides in review.ai_model (#8364)#8458
loopover-orb[bot] merged 5 commits into
JSONbored:mainfrom
andriypolanski:feat/8364-ai-cli-timeout-manifest-overrides-v2

Conversation

@andriypolanski

Copy link
Copy Markdown
Contributor

Summary

  • Closes AI CLI timeout knobs are env-var-only, unlike the sibling model/effort knobs (config-as-code gap) #8364
  • Adds optional .loopover.yml fields under review.ai_model: claude_timeout_ms, codex_timeout_ms, claude_first_output_timeout_ms, codex_first_output_timeout_ms (same section as claude_model / claude_effort).
  • Threads them through AiRunOptions / runLoopOverAiReview / the CLI providers; resolve*TimeoutMs prefer a positive per-repo override, else keep today’s env-var/effort resolution.
  • Bumps AI review cache fingerprint to ai-review-input:v6 so a timeout-only manifest change invalidates cached reviews.

Scope

  • The PR title follows type(scope): short summary Conventional Commit format, for example fix(api): restore profile access checks.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked a currently open issue this PR resolves (e.g. Closes #123) — a linked open issue is required for every contributor PR.

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • Targeted vitest: selfhost-ai timeout suites, focus-manifest review.ai_model, ai-review override forwarding, ai-review-cache-input
  • npm run test:coverage
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • npm audit --audit-level=moderate
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

If any required check was skipped, explain why:

  • config-lint.ts only validates top-level manifest keys (review is already recognized). Nested review.ai_model.* fields are recognized the same way claude_model already is — by parsing in focus-manifest.ts, not a nested allowlist in config-lint. Untouched CI surfaces left to CI.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests.
  • API/OpenAPI/MCP behavior is updated and tested where needed.
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks.
  • Visible UI changes include a UI Evidence section below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

andriy-polanski and others added 4 commits July 24, 2026 12:56
…model (JSONbored#8364)

Mirror the existing model/effort config-as-code path for the four CLI
timeout knobs so a shared self-host instance is not stuck on one global
env-var budget per repo.

Co-authored-by: Cursor <cursoragent@cursor.com>
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 24, 2026
@loopover-orb

loopover-orb Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-24 15:48:44 UTC

14 files · 1 AI reviewer · no blockers · readiness 93/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This PR threads four new per-repo timeout override fields (claude_timeout_ms, codex_timeout_ms, and their first-output counterparts) through the full stack: focus-manifest parsing with normalizeOptionalPositiveInteger validation, AiRunOptions/AiRunCorrelation in ai-review.ts, the CLI resolvers in selfhost/ai.ts, the orchestration wiring, and a cache-fingerprint version bump (v5→v6) to invalidate stale cached reviews. The override precedence (repo override > env var > effort-based default) is implemented consistently with the existing claudeModel/claudeEffort pattern, and the clamp/floor/ceiling behavior for each resolver is preserved and covered by new tests in selfhost-ai.test.ts. This closes #8364 and is narrowly scoped to the stated feature with no unrelated changes bundled in.

Nits — 3 non-blocking
  • The 'Magic numbers' flag on focus-manifest.ts:3418 for the literal `8364` is just an issue-number reference in a comment, not a real magic-number code smell — safe to ignore.
  • config-lint.ts intentionally isn't updated for these nested fields per the PR's own explanation (review.ai_model is already a recognized top-level key), which is consistent with how claude_model/claude_effort were handled previously — worth double-checking that convention still holds if config-lint ever adds nested validation.
  • Consider whether `normalizeOptionalPositiveInteger` also rejects non-integer values like `1.5` (the test at focus-manifest.test.ts asserts this) — confirm the warning message wording stays consistent with the other numeric-field validators in this file for grep-ability.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #8364
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 222 registered-repo PR(s), 135 merged, 22 issue(s).
Contributor context ✅ Confirmed Gittensor contributor andriypolanski; Gittensor profile; 222 PR(s), 22 issue(s).
Improvement ✅ Minor risk: clean · value: minor
Linked issue satisfaction

Addressed
The PR adds the four new fields to SelfHostAiModelConfig with parsing/overlay/JSON round-trip, threads them through AiRunOptions and the four resolver functions preferring a positive per-repo override over the env-var default, and includes unit tests covering both the override-present and override-absent branches as required. The one open point is config-lint.ts: no diff hunk touches it, but the P

Review context
  • Author: andriypolanski
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 222 PR(s), 22 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Triage stale or unlinked PRs.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@loopover-orb loopover-orb 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.

LoopOver approves — the gate is satisfied and CI is green.

@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.68%. Comparing base (c2190cd) to head (037c262).
⚠️ Report is 18 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8458      +/-   ##
==========================================
+ Coverage   92.50%   93.68%   +1.18%     
==========================================
  Files         791      694      -97     
  Lines       79328    56662   -22666     
  Branches    23959    20116    -3843     
==========================================
- Hits        73379    53083   -20296     
+ Misses       4810     2620    -2190     
+ Partials     1139      959     -180     
Flag Coverage Δ
control-plane ?
rees ?
shard-1 59.32% <88.23%> (+3.91%) ⬆️
shard-2 45.61% <38.23%> (-3.36%) ⬇️
shard-3 56.15% <50.00%> (-0.52%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/loopover-engine/src/focus-manifest.ts 98.75% <100.00%> (+<0.01%) ⬆️
src/queue/ai-review-orchestration.ts 100.00% <100.00%> (ø)
src/review/ai-review-cache-input.ts 100.00% <100.00%> (ø)
src/selfhost/ai.ts 98.19% <100.00%> (+0.01%) ⬆️
src/services/ai-review.ts 96.92% <100.00%> (+0.03%) ⬆️

... and 102 files with indirect coverage changes

@loopover-orb loopover-orb 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.

LoopOver approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit ac06b43 into JSONbored:main Jul 24, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AI CLI timeout knobs are env-var-only, unlike the sibling model/effort knobs (config-as-code gap)

2 participants