fix: expose active model in stable prompts - #3613
Conversation
dbce799 to
83e604a
Compare
Astro-Han
left a comment
There was a problem hiding this comment.
Review: NO-GO (1×P1)
The ordinary main/child composer path is sound: modelId is captured when the backend is built, a configuration transition disposes that backend before committing the new model, and the new line is therefore stable for the lifetime of each composer. Switching models does not create an additional useful-prefix-cache loss because the request is moving to a different model authority anyway. The transcript projection and session-change payload deletions are also behavior-preserving: hasConversation and ordinary-update connectionSlug/modelId had no consumers, while rebound events retain modelId.
P1 — the first-class headless/Eval prompt still omits the active model
createInteractiveRunComposer returns the tool-profile prompt at packages/runtime-host/src/server/interactive-run-composer.ts:219-228, before buildActiveModelPromptFragment(input.model) is reached at :255. Production still passes both toolProfile: 'headless-coding-v1' and the selected modelId through the same factory (:474-511), so every Maka Eval/hosted headless run receives the old four-line prompt with no model identity. This is a supported production surface, not a test-only branch: packages/eval/src/maka-subject.ts:56 publishes the configured tool profile and Maka Eval fixtures use headless-coding-v1.
I reproduced the exact branch on this head by constructing the composer with both toolProfile: 'headless-coding-v1' and model: 'fixture-model'; resolveSystemPrompt returned containsActiveModel: false. The existing freeze test at execution-model-composition.test.ts:2980-3025 also asserts the old exact prompt and never supplies a model, so CI cannot catch the omission. As written, the PR's unqualified contract—expose the active execution model once in the stable interactive prompt—does not hold for the product's hosted execution path.
Please compose the normalized model identity into the profiled stable prompt too, and add a regression that supplies model while using headless-coding-v1. Keep the profile's fixed tool ceiling and avoid reading Skills/Memory; only its stable prompt text needs the identity.
Validation: exact-head CI run 32642142585 and Windows package run 32642142543 are terminal success on 83e604a3ee188c94f2af99ab704313e842ddab29. Clean dependency-order Core → Runtime → Storage → Runtime Host builds passed locally; focused transcript tests passed 2/2 and prompt/profile tests passed 3/3. The initial Runtime Host-only build failure was stale local Storage declarations and disappeared after building Storage; it is not a PR finding.
83e604a to
fcb8917
Compare
Prepend the selected model at the Runtime Host execution boundary after final target resolution. This keeps interactive composers model-agnostic while ensuring main, child, and headless provider requests share one stable execution identity. Generated-by: Maka
Return the latest assistant model directly instead of maintaining an unused conversation-presence field and object wrapper. The renderer only needs the latest actual model for switch feedback. Generated-by: Maka
Session change events invalidate renderer projections and correlate turn lifecycle changes. Remove the unused connection slug field and stop attaching model details to ordinary model-update invalidations; modelId remains only for rebound feedback. Generated-by: Maka
fcb8917 to
e7eab01
Compare
jackwener
left a comment
There was a problem hiding this comment.
GO on exact head e7eab01.
The prior headless/Eval blocker is closed by the single outer injection point in createHostAiSdkBackend: every resolved system prompt now receives the normalized, already-authorized execution model. resolveExecutionTarget() rejects empty and unauthorized models before this path, and session model changes dispose the existing backend before committing the new header, so the identity is stable within one backend/prefix-cache lifetime.
The production hosted-execution wire test covers toolProfile: headless-coding-v1 plus an explicit model target, checks the active-model bytes and updated prompt hash, and passed locally. Removing the injection made that test fail at the active-model assertion. The transcript projection and session-change payload reductions are behavior-preserving and remove unused projections. No P0-P3 findings remain; exact-head hosted test and package are completed/success.
Execution provenance: acting under @WAWQAQ standing Maka review/action authorization; scope: technical review and APPROVE only; exact head: e7eab01. No merge performed.
Summary
The model identity is intentionally not persisted as a switch event: the Session header remains the current configuration authority, assistant messages record the model actually used by each completed step, and changing the model already disposes the backend before the next prompt is composed.
Verification
npm run buildnpm --workspace @maka/core run buildnode --test packages/core/dist/__tests__/model-switch-transcript.test.jsnpm --workspace @maka/runtime run buildnpm --workspace @maka/runtime-host run buildnode --test --test-name-pattern='child prompts identify the active model|backend composition survives a moved saved Git Bash executable while Bash fails closed' packages/runtime-host/dist/__tests__/execution-model-composition.test.jsnpx tsc -p apps/desktop/tsconfig.main.json --noEmitnpx tsc -p apps/desktop/tsconfig.preload.json --noEmitnpx tsc -p apps/desktop/tsconfig.renderer.json --noEmitgit diff --checkAI use
Tool(s) and scope: Maka diagnosed the prompt/event-log composition, authored the implementation and tests, and ran the focused validation. The human contributor will review the final diff and owns the merge decision.
Checklist
Does this PR entail a change in behavior?