feat(selfhost): local-inference binding for advisory-tier AI capabilities (AI_ADVISORY) - #4388
Merged
Merged
Conversation
…ties (AI_ADVISORY) Only the core PR review needs frontier-model accuracy -- it drives real gate blockers. Slop advisory, e2e test-gen, the issue planner, and AI summaries/rewrite are all advisory-only (never gate-blocking) and were sharing the same frontier claude-code/codex chain purely because no cheaper alternative existed, silently spending real subscription tokens on every PR regardless of the repo's review-effort setting (which only ever threaded through the core review path). Adds env.AI_ADVISORY, wired in src/server.ts mirroring AI_EMBED/AI_VISION's exact pattern (AI_ADVISORY_BASE_URL/_MODEL/_API_KEY, createOpenAiCompatibleAi, absent-binding fallback to env.AI). Routing is config-driven per capability via .gittensory.yml settings.advisoryAiRouting (global default + per-repo override, config-as-code only, mirrors unlinkedIssueGuardrail's shape) -- never hardcoded, and a capability only actually routes through the local binding when both the yml opt-in AND the binding itself are configured. Wired at all four real call sites via a shared withAdvisoryAiEnv helper (src/selfhost/ai.ts): runAiSlopForAdvisory, the e2e-test-gen delivery path, the issue-planner command handler, and the agent-run AI summary attachment. Zero risk to the core review's accuracy since that path is untouched.
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
gittensory-ui | a246484 | Commit Preview URL Branch Preview URL |
Jul 09 2026, 06:43 AM |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4388 +/- ##
=======================================
Coverage 93.95% 93.96%
=======================================
Files 400 402 +2
Lines 36820 36863 +43
Branches 13452 13475 +23
=======================================
+ Hits 34595 34638 +43
Misses 1569 1569
Partials 656 656
🚀 New features to boost your workflow:
|
This was referenced Jul 9, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
env.AI_ADVISORY, wired insrc/server.tsmirroringAI_EMBED/AI_VISION's exact pattern (AI_ADVISORY_BASE_URL/_MODEL/_API_KEY, absent-binding fallback toenv.AI)..gittensory.ymlsettings.advisoryAiRouting(global default + per-repo override, config-as-code only — no DB column, mirrorsunlinkedIssueGuardrail's shape). Never hardcoded which capability uses it.withAdvisoryAiEnvhelper (src/selfhost/ai.ts):runAiSlopForAdvisory, the e2e-test-gen delivery path, the issue-planner command handler, and the agent-run AI summary attachment.AI_VISION/AI_EMBED: absent binding ⇒ every capability falls back to the existing sharedenv.AIchain, byte-identical to today.Scope
env.AI_ADVISORYbinding +.env.exampledocumentationAdvisoryAiRoutingConfigtype + normalizer (bothsrc/andpackages/gittensory-engine/src/mirrors)resolveEffectiveSettingsoverlay.gittensory.yml.example+config/examples/gittensory.full.ymldocumentation (byte-synced)npm run selfhost:env-referenceregeneratedRepositorySettingsSchemaread-only field, matchescheck-openapi-settings-parity)Validation
npx tsc --noEmit -p .— cleannpm run ui:openapi:settings-parity— 101 fields, matchesnpm run manifest:drift-check/npm run db:migrations:check/npm run db:schema-drift:check— cleanwithAdvisoryAiEnv(3 branch cases), the yml normalizer (both mirrors, malformed/valid/omitted cases), theresolveEffectiveSettingssparse-overlay (parse + merge + malformed-field-drop), and an end-to-end call-site regression test onrunAiSlopForAdvisoryproving the actual provider swap (routes toAI_ADVISORYwhen opted in + configured, falls back toenv.AIotherwise, including when the binding itself is absent)test/unit/queue.test.ts(752 tests),agent-orchestrator.test.ts,ai-summaries.test.ts,selfhost-ai.test.ts,focus-manifest.test.ts,config-templates.test.ts— all passingSafety
env.AIverified for both "capability opted out" and "binding unconfigured" cases