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/29 04:35:04 UTC

(maka) branch main updated: fix(runtime-host): align enabled model limit (#4124)

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

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


The following commit(s) were added to refs/heads/main by this push:
     new ed615013e fix(runtime-host): align enabled model limit (#4124)
ed615013e is described below

commit ed615013ee0179cba002322df467672816b6c70e
Author: Phoenix <Ph...@163.com>
AuthorDate: Sat Aug 29 12:35:00 2026 +0800

    fix(runtime-host): align enabled model limit (#4124)
    
    Connection catalogs allow up to 512 enabled model IDs, but
    mutation validation rejected more than 64. Sharing the catalog limit
    keeps enable-all updates valid and prevents the two paths from drifting.
    
    Fixes #3993
    Generated-by: OpenAI Codex
    Signed-off-by: Jiawei Zhao <Ph...@163.com>
---
 .../runtime-host/src/__tests__/protocol.test.ts    | 30 ++++++++++++++++++++++
 packages/runtime-host/src/protocol/index.ts        |  4 ++-
 .../runtime-host/src/protocol/runtime-policy.ts    |  3 +--
 3 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/packages/runtime-host/src/__tests__/protocol.test.ts b/packages/runtime-host/src/__tests__/protocol.test.ts
index 42e611cd6..662fcd9e8 100644
--- a/packages/runtime-host/src/__tests__/protocol.test.ts
+++ b/packages/runtime-host/src/__tests__/protocol.test.ts
@@ -22,6 +22,7 @@ import assert from 'node:assert/strict';
 import { describe, test } from 'node:test';
 import { MAX_ATTACHMENT_BYTES, MAX_ATTACHMENT_COUNT } from '@maka/core/attachments';
 import { CONTEXT_BUDGET_EXHAUSTED_DETAILS, TOOL_OUTPUT_DELTA_MAX_CHARS } from '@maka/core/events';
+import { CONNECTION_CATALOG_MAX_ENABLED_MODEL_IDS } from '@maka/core/runtime-policy';
 import {
   decodeClientCapabilityReplaceInput,
   decodeClientFrame,
@@ -804,6 +805,35 @@ describe('Runtime Host bootstrap protocol', () => {
     );
   });
 
+  test('keeps the connection update model limit aligned with the catalog', () => {
+    const updateConnection = RUNTIME_POLICY_OPERATION_SPECS['connection.catalog.update'];
+    const enabledModelIds = Array.from(
+      { length: CONNECTION_CATALOG_MAX_ENABLED_MODEL_IDS },
+      (_, index) => `model-${index}`,
+    );
+    const input = {
+      expected: { connectionId: '00000000-0000-4000-8000-000000000001', revision: 1 },
+      changes: {
+        name: 'OpenRouter',
+        enabled: true,
+        enabledModelIds,
+      },
+    };
+
+    assert.doesNotThrow(() => updateConnection.decodeInput(input));
+    assert.throws(
+      () =>
+        updateConnection.decodeInput({
+          ...input,
+          changes: {
+            ...input.changes,
+            enabledModelIds: [...enabledModelIds, 'model-too-many'],
+          },
+        }),
+      isInvalidFrame,
+    );
+  });
+
   test('keeps Runtime Policy request and response codecs exact', () => {
     assert.deepEqual(
       decodeClientFrame({
diff --git a/packages/runtime-host/src/protocol/index.ts b/packages/runtime-host/src/protocol/index.ts
index 7fe709725..101bcd07f 100644
--- a/packages/runtime-host/src/protocol/index.ts
+++ b/packages/runtime-host/src/protocol/index.ts
@@ -94,7 +94,9 @@ export const RUNTIME_HOST_REGISTRATION_SCHEMA_VERSION = 1 as const;
 export const RUNTIME_HOST_PROTOCOL_VERSION = 0 as const;
 // Increment when the same protocol version no longer guarantees safe Client-Host
 // interoperability. Mismatches are rejected before domain commands are admitted.
-export const RUNTIME_HOST_COMPATIBILITY_EPOCH = 62 as const;
+export const RUNTIME_HOST_COMPATIBILITY_EPOCH = 63 as const;
+// 63: Connection updates accept the full canonical enabled-model limit.
+// Older peers reject valid catalogs containing more than 64 enabled models.
 // 62: A Direct peer listener can expose owner-only Peer Mesh management
 // operations. Older peers do not have this closed operation vocabulary.
 // 61: Session explicit model targets carry immutable Connection identity,
diff --git a/packages/runtime-host/src/protocol/runtime-policy.ts b/packages/runtime-host/src/protocol/runtime-policy.ts
index edb88831e..191f68384 100644
--- a/packages/runtime-host/src/protocol/runtime-policy.ts
+++ b/packages/runtime-host/src/protocol/runtime-policy.ts
@@ -78,7 +78,6 @@ export const CONNECTION_CATALOG_PAGE_MAX_BYTES = 48 * 1024;
 export const RUNTIME_POLICY_SNAPSHOT_MAX_BYTES = 48 * 1024;
 export const CREDENTIAL_SECRET_MAX_BYTES = 10 * 1024;
 
-const CONNECTION_MUTATION_MAX_ENABLED_MODEL_IDS = 64;
 const QUERY_ERRORS = [
   'host_not_ready',
   'host_draining',
@@ -1073,7 +1072,7 @@ function modelSource(value: unknown): 'fetched' | 'fallback' {
 }
 
 function assertMutationEnabledModelIds(values: readonly string[]): void {
-  if (values.length > CONNECTION_MUTATION_MAX_ENABLED_MODEL_IDS) {
+  if (values.length > CONNECTION_CATALOG_MAX_ENABLED_MODEL_IDS) {
     throw invalidProtocolFrame('Invalid enabled model ids');
   }
 }


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