Repository navigation
refactor: separate loader defaults, bootstrap runtime opts, narrow chatserver contract - #4533
Merged
Merged
Conversation
Signed-off-by: David Gageot <david.gageot@docker.com>
Signed-off-by: David Gageot <david.gageot@docker.com>
Signed-off-by: David Gageot <david.gageot@docker.com>
gtardif
approved these changes
Oct 7, 2026
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.
teamloader/defaults.Optsalways registered global runtime factories (jscommands.Register(),runtime.RegisterHarness) as a side effect of asking for loader defaults, which made it impossible to build a loader's options without also mutating process-wide runtime state. The model-switcher and budget wiring that turns ateamloader.LoadResultinto runtime options was also duplicated between the CLI's initial run and its spawned sub-runtimes, andchatserverdepended on the fullruntime.Runtimeinterface even though it only ever drives three methods of it.This splits
defaults.Opts()into a registration-freedefaults.LoaderOpts()plus the existingOpts(), which now just callsLoaderOpts()after doing its registration as before — so nothing changes for existing callers. It adds apkg/bootstrappackage whoseRuntimeOpts(loadResult, runConfig)assembles theModelSwitcherConfig, shared models.dev store, and budget options from aLoadResult;cmd/root/run.gonow calls it from both the initial and spawned runtime paths instead of duplicating the assembly. Finally,chatserverdefines a privateruntimeRunnerinterface with justRunStream,Resume, andResumeElicitation, and the agent loop, server handlers, and runtime pool are narrowed to that contract instead of the fullruntime.Runtime.Public interfaces, HTTP schemas, and serving budget behavior are unchanged; this is a pure internal reshuffle with new regression tests for
bootstrap,defaults.LoaderOpts, and the narrowed chatserver contract (including a minimal fake runtime). Docs (docs/guides/go-sdk/index.md) and the dependency guard test (e2e/dependencies_test.go) were updated to reflect the newpkg/bootstrappackage; nogo.mod/go.sumchanges were needed.