refactor(server): seal backend construction behind a plan - #691
Draft
Graffioh wants to merge 1 commit into
Draft
Conversation
Graffioh
force-pushed
the
codex/backend-plan-boundary
branch
5 times, most recently
from
September 2, 2026 07:54
fd5069f to
1208435
Compare
Graffioh
force-pushed
the
codex/backend-plan-boundary
branch
from
September 2, 2026 08:27
1208435 to
ab10aee
Compare
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
This is the first implementation slice of #688. It makes backend construction consume one model-aware, immutable configuration instead of pairing a mutable
BackendArgswith separately resolved facts.BackendArgsown operator input, including model and draft pathsBackendAdmissionContextcontaining only server-owned admission factsBackendPlancreate_backend(BackendPlan)the only construction API; the old convenience and(args, plan)overloads are deletedBackendRuntimebecause existing architecture configs retain path pointers after initializationServerConfigout of planning and construction; the HTTP layer projects only the admission facts the backend policy needsThe practical invariant is now enforced by the type boundary:
Why this slice
The current factory could validate one
BackendArgsvalue and construct from another mutable value. Model paths were also borrowed C strings, while several backend configs retain those pointers beyond initialization. This change removes both failure modes without introducing a config-file language or model-profile inheritance.SpecLA/DDTree selection and KVFlash fallback now happen during planning. Startup reporting and
/propsreceive the same normalized values used for construction.Tests
test_backend_plan: owned-path lifetime, construction API boundary, SpecLA normalization, KVFlash fallback, unsupported-model fallback, and missing-draft failuretest_feature_gate: existing compatibility and warning suite migrated to the narrower admission contextNext steps
This PR intentionally keeps the effective snapshot flat so the boundary can land as a reviewable unit. Follow-up work can:
BackendPlanfields by concern (placement,cache,speculation, andexecution) once the existing callers are fully behind the planServerConfiginto a dedicated read-only info snapshot for/propsSupersedes the docs-only proposal in #688 with executable types, enforcement, and tests.