feat(kap-server): accept secondary_model in the config API - #2228
Merged
Conversation
POST /api/v1/config now accepts secondary_model, persisted to the [secondary_model] config section via the generic per-domain dispatch. GET /config also hides the synthesized __secondary__ derived entry from the models view, matching the GET /models listing.
🦋 Changeset detectedLatest commit: cacecbe 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: |
Signed-off-by: 7Sageer <sag77r@hotmail.com>
5 tasks
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 linked issue — the problem is explained below.
Problem
The engine supports the documented
[secondary_model]configuration section, which lets newly spawned subagents bind to a separately configured model instead of inheriting the main agent's model. However, the server's configuration API (POST /api/v1/config) validates request bodies against a strict whitelist that does not includesecondary_model, so API clients (web UI, extensions, external integrations) silently drop the field and the only way to set it is editingconfig.tomlby hand.What changed
POST /api/v1/confignow acceptssecondary_model. The route's existing generic per-domain dispatch converts it to thesecondaryModelconfig domain and routes it through the standard section validation and persistence, so[secondary_model]lands inconfig.tomlandevent.config.changedfires as for any other domain.GET /api/v1/confignow hides the internal synthesized__secondary__derived entry from themodelsview (it appears in the effective config whenever the recipe carries patch fields), matching howGET /modelsalready filters it out of pickers. It can never persist — the config overlay strips it frommodelswrites.secondary_modeland the__secondary__filtering.secondary_modelrequest shapeFor API callers: the field is a model pointer plus a patch.
model— id of an entry in the configuredmodels; newly spawned subagents bind to it.[models.*.overrides]:default_effort,off_effort,support_efforts,max_context_size,max_input_size,max_output_size,capabilities,display_name,reasoning_key,adaptive_thinking.provider,api_key,base_url, …) do not belong here — they are inherited from the pointed entry. With no patch fields, subagents bind the pointed entry directly.{ "secondary_model": { "model": "k3", "default_effort": "high", "max_output_size": 8192 } }Responses echo the resolved recipe in camelCase (e.g.
defaultEffort). Field reference: config docs.Known limitation (pre-existing, unchanged): the session secondary-model warning is computed once when the main agent is created, so updating the section mid-session does not refresh
GET /sessions/{id}/warnings; spawn-time resolution remains the backstop.Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.