fix(agent-core-v2): support services.moonshot_search config for WebSearch#1613
Merged
Conversation
…arch The v2 engine only resolved the WebSearch backend from the managed Kimi OAuth provider, so an environment that configures web search purely via [services.moonshot_search] (api key, no login) got no provider and the WebSearch tool stayed hidden. Register the services config section and resolve the provider config-first, mirroring v1 precedence.
🦋 Changeset detectedLatest commit: c947a67 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
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.
Related Issue
No prior issue — this came out of running the release-e2e suite against the experimental agent-core-v2 engine (
KIMI_CODE_EXPERIMENTAL_FLAG=1), where thetool-skill-web-searchscenario failed.Problem
In v1, the
WebSearchtool's backend has two sources, and the authoritative one is the[services.moonshot_search]config section (anapi_keyand/or anoauthref) — it works without any OAuth login. The v2 rewrite only wired the OAuth-derived path:WebSearchProviderServiceresolves a provider solely from the managedmanaged:kimi-codeprovider'soauthref (i.e. only after a successful Kimi login).Consequence: any environment that configures web search purely through
services.moonshot_search(api key, no login) gets no provider, the self-registeringWebSearchtool stays hidden, and model tool calls returnTool "WebSearch" not found. This is exactly what the release-e2e home does, so the scenario failed under v2.What changed
src/app/auth/configSection.ts— registers theservicesconfig section: the zod schema plus the snake_case↔camelCase TOML transforms (including nestedoauthandcustom_headersnormalization, and preserving unknown top-level services verbatim), mirroring v1'sServicesConfigSchema.moonshot_fetchis included in the schema as a placeholder for thewebdomain but is not wired yet. It lives in theauthdomain because that domain's login/logout flows provision/clear the section and itsWebSearchProviderServiceconsumesmoonshot_search; it self-registers viaregisterConfigSectionso theconfigdomain never imports this domain.webSearchService.ts— injectsIConfigServiceand resolves the provider asfromServicesConfig() ?? fromManagedOAuth(), keeping v1's precedence (explicit config wins over the OAuth-derived provider). The config path requiresbaseUrl, accepts anoauthref (resolved viaIOAuthService.resolveTokenProvider) and/or anapiKey(blank strings treated as absent), and attaches the host Kimi identity headers pluscustomHeaders.index.ts— exports the new module.test/app/auth/auth.test.tscovering config-only, oauth-ref resolution, config-over-OAuth precedence, blankapiKey, and TOML round-trip.Verified:
agent-core-v2typecheck +lint:domain+ full test suite (236 files / 3177 tests) green; staged diff audited for internal identifiers (clean).Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.