You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by as...@apache.org on 2026/08/23 14:53:33 UTC

(maka) 01/03: fix: expose active model in stable prompts

This is an automated email from the ASF dual-hosted git repository.

Astro-Han pushed a commit to branch fix/session-model-context
in repository https://gitbox.apache.org/repos/asf/maka.git

commit 50e9b17ff73267f0457e3f6a2bc57722cc052a18
Author: AstroHan <le...@outlook.com>
AuthorDate: Sun Aug 23 20:47:18 2026 +0800

    fix: expose active model in stable prompts
    
    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
---
 .../__tests__/execution-model-composition.test.ts    | 20 ++++++++++----------
 .../src/server/execution-model-composition.ts        |  7 ++++++-
 2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/packages/runtime-host/src/__tests__/execution-model-composition.test.ts b/packages/runtime-host/src/__tests__/execution-model-composition.test.ts
index af100b503..38ede3a6f 100644
--- a/packages/runtime-host/src/__tests__/execution-model-composition.test.ts
+++ b/packages/runtime-host/src/__tests__/execution-model-composition.test.ts
@@ -134,7 +134,7 @@ const MIN_IMPLEMENTATION_CHILD_REQUESTS = 6;
 const MAX_IMPLEMENTATION_CHILD_REQUESTS =
   MIN_IMPLEMENTATION_CHILD_REQUESTS + MAX_IMPLEMENTATION_CHILD_PTY_READS - 1;
 const HEADLESS_CODING_V1_PROMPT_HASH =
-  'sha256:0e3389e330b8b8f0db1c7a8b8e2126325fe4c672d6eff279afcd3f9412e52271';
+  'sha256:b2773282ac4755dc8d8a663eafdec68c3fa6f5680ec8557d261b5f723672b467';
 const HEADLESS_CODING_V1_TOOLS_HASH =
   'sha256:c062194603f93b568da5ca59b865b316156b5f218ba854c291aa9582859b3de4';
 const execFileAsync = promisify(execFile);
@@ -920,6 +920,7 @@ test('hosted execution freezes the headless coding provider wire contract', asyn
     const instructions = responsesDeveloperPrompt(request?.body);
     const tools = request?.body.tools;
     assert.equal(typeof instructions, 'string', JSON.stringify(request?.body));
+    assert.match(instructions ?? '', /^Active model: deepseek-v4-flash$/mu);
     assert.ok(Array.isArray(tools));
     assert.equal(stableHash(instructions), HEADLESS_CODING_V1_PROMPT_HASH);
     assert.equal(stableHash(tools), HEADLESS_CODING_V1_TOOLS_HASH);
@@ -2831,15 +2832,14 @@ test('backend composition survives a moved saved Git Bash executable while Bash
   const capturedBash = childComposer.tools.find((tool) => tool.name === 'Bash');
   assert.match(capturedBash?.description ?? '', /captured child shell/);
   assert.doesNotMatch(capturedBash?.description ?? '', /unavailable this turn/);
-  assert.match(
-    await childComposer.turnTailPrompt({
-      sessionId: 'session',
-      turnId: 'turn-child',
-      cwd: '/workspace',
-      workspaceRoot: '/workspace',
-    }),
-    /captured child shell/,
-  );
+  const childContext = {
+    sessionId: 'session',
+    turnId: 'turn-child',
+    cwd: '/workspace',
+    workspaceRoot: '/workspace',
+  } as const;
+  const childTail = await childComposer.turnTailPrompt(childContext);
+  assert.match(childTail, /captured child shell/);
 });
 
 test('child execution Bash carries the configured shell guidance and spawn plan', async () => {
diff --git a/packages/runtime-host/src/server/execution-model-composition.ts b/packages/runtime-host/src/server/execution-model-composition.ts
index 015e9b644..a18e6f293 100644
--- a/packages/runtime-host/src/server/execution-model-composition.ts
+++ b/packages/runtime-host/src/server/execution-model-composition.ts
@@ -288,7 +288,7 @@ export async function createHostAiSdkBackend(input: HostAiSdkBackendInput): Prom
     readonly runId?: string;
     readonly emitSkillCatalogTrace?: (message: string, data?: Record<string, unknown>) => void;
   }) => {
-    return await modelComposition.resolveSystemPrompt({
+    const resolved = await modelComposition.resolveSystemPrompt({
       sessionId: input.context.sessionId,
       turnId: context.turnId,
       ...(context.runId ? { runId: context.runId } : {}),
@@ -298,6 +298,11 @@ export async function createHostAiSdkBackend(input: HostAiSdkBackendInput): Prom
         ? { emitSkillCatalogTrace: context.emitSkillCatalogTrace }
         : {}),
     });
+    const model = target.model.replace(/[\r\n\t]+/g, ' ').trim();
+    return Object.freeze({
+      ...resolved,
+      text: [`Active model: ${model}`, resolved.text].filter(Boolean).join('\n\n'),
+    });
   };
   const recordRunComposition = input.context.recordRunComposition;
   const commitRunComposition = recordRunComposition


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org