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/10/15 06:00:42 UTC

(maka) branch main updated: fix: preserve new Side Chat sessions and stabilize Intel release checks (#6111)

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 1751c39923 fix: preserve new Side Chat sessions and stabilize Intel release checks (#6111)
1751c39923 is described below

commit 1751c399239b0f6b717e98e2a5e2b875c3dd11ce
Author: AstroHan <le...@outlook.com>
AuthorDate: Thu Oct 15 17:00:37 2026 +1100

    fix: preserve new Side Chat sessions and stabilize Intel release checks (#6111)
    
    Keep newly admitted Side Chat forks in the preload catalog until an invalidated Owner snapshot catches up, without suppressing observed activity. Serialize release contracts to reduce competing startup load on Intel macOS, preserve the test set and startup deadline, and include child output in startup timeout errors.
    
    No stored-data migration or public API change. Verified with failing-before/fixed-after regressions, 94 local catalog tests, 221 release tests, build, Desktop typecheck, formatting, lint, exact-head CI, and Intel parallel/serial comparison.
    
    Generated-by: Codex
---
 .../src/main/__tests__/session-local.test.ts       | 51 +++++++++++++++++++---
 apps/desktop/src/main/session-local-service.ts     | 10 +++--
 package.json                                       |  2 +-
 scripts/qualify-released-cli-state-root.mjs        |  4 +-
 scripts/qualify-released-cli-state-root.test.mjs   | 10 +++++
 5 files changed, 65 insertions(+), 12 deletions(-)

diff --git a/apps/desktop/src/main/__tests__/session-local.test.ts b/apps/desktop/src/main/__tests__/session-local.test.ts
index bb5e9c8014..afeb8aade6 100644
--- a/apps/desktop/src/main/__tests__/session-local.test.ts
+++ b/apps/desktop/src/main/__tests__/session-local.test.ts
@@ -47,6 +47,8 @@ import { createAttachmentApprovalRegistry } from '../attachment-approval.js';
 import { parseDesktopSlashCommand } from '../../renderer/application/contracts/desktop-slash-command.js';
 import { projectLocalMessageDraft } from '../../preload/session-local-draft.js';
 import type { DesktopLocalMessageDraft } from '../../shared/session-local-contract.js';
+import { createRuntimeHostSessionCatalogRefresher, resolveRuntimeHostSessionCatalog } from '../../preload/runtime-host-session-catalog.js';
+import type { DesktopSessionSummary } from '../../preload/bridge-contract.js';
 
 const accepted: TurnMessageSubmitResult = {
   disposition: 'turn_started',
@@ -135,6 +137,43 @@ async function waitFor(predicate: () => boolean): Promise<void> {
   assert.fail('Local state did not settle');
 }
 
+test('a pending Owner catalog refresh cannot erase a newly admitted fork', async (t) => {
+  const db = await database(t);
+  const pending = deferred<SessionCatalogProjection[]>();
+  let reads = 0;
+  const target: DesktopSessionLocalTarget = {
+    partition: 'authority', profileId: 'profile', scope: { hostId: 'root-host', targetEpoch: 'target' },
+    client: { ...client('epoch'), listSessions: () => ++reads === 1 ? Promise.resolve([swarmCatalogSession()]) : pending.promise },
+  };
+  const service = new DesktopSessionLocalService(db.store, {
+    targets: () => [target], changed() {}, onError: (error) => assert.fail(String(error)),
+  });
+  db.beforeClose.push(() => service.close());
+  service.catalog();
+  await waitFor(() => db.store.sessions('authority').length === 1);
+  let current = { sessions: [] as DesktopSessionSummary[], completeHostIds: [] as string[] };
+  const refresher = createRuntimeHostSessionCatalogRefresher({
+    currentCatalog: () => current,
+    commitCatalog: (catalog) => { current = catalog; },
+    listCatalog: () => {
+      const [catalog] = service.catalog();
+      return resolveRuntimeHostSessionCatalog(current.sessions, Promise.resolve({
+        sessions: catalog!.sessions.map((summary) => ({ ...summary, runtimeHostId: 'root-host', profileId: 'profile' }) as DesktopSessionSummary),
+        completeHostIds: catalog!.authoritative ? ['root-host'] : [],
+      }), () => ['profile'], Promise.resolve([]));
+    },
+  });
+  await refresher.refresh();
+  const fork = { ...swarmCatalogSession(), id: 'fork' };
+  refresher.admit({ ...fork, runtimeHostId: 'root-host', profileId: 'profile' } as unknown as DesktopSessionSummary);
+  service.changed(target.scope);
+  assert.deepEqual((await refresher.refresh()).sessions.map(({ id }) => id).sort(), ['fork', 'root']);
+  pending.resolve([swarmCatalogSession(), fork]);
+  await waitFor(() => db.store.sessions('authority').length === 2);
+  assert.equal(service.catalog()[0]?.authoritative, true);
+  assert.deepEqual((await refresher.refresh()).sessions.map(({ id }) => id).sort(), ['fork', 'root']);
+});
+
 test('local acceptance survives restart with attachment bytes and an immutable dispatch epoch', async (t) => {
   const db = await database(t);
   const record = db.store.enqueue('authority-1', intent());
@@ -446,12 +485,12 @@ for (const staleResult of ['running', 'removed', 'failed'] as const) {
     await waitFor(() => db.store.sessions('authority').length === 1);
     await nextTurn();
     service.changed(target.scope);
-    assert.equal(service.catalog()[0]?.authoritative, true);
+    assert.equal(service.catalog()[0]?.authoritative, false);
     assert.equal(service.catalog()[0]?.sessions[0]?.backgroundActivity, 'running');
     assert.equal(reads, 2);
     const revision = db.store.revision;
 
-    // Further Host changes dirty the observation without revoking its authority.
+    // Further Host changes retain observed activity without proving absence.
     service.changed(target.scope);
     service.changed(target.scope);
     service.catalog();
@@ -469,7 +508,7 @@ for (const staleResult of ['running', 'removed', 'failed'] as const) {
       assert.equal(service.catalog()[0]?.sessions[0]?.backgroundActivity, undefined);
     } else {
       assert.ok(db.store.revision > revision, 'successful dirty reads must make progress');
-      assert.equal(service.catalog()[0]?.authoritative, true);
+      assert.equal(service.catalog()[0]?.authoritative, false);
       assert.equal(db.store.sessions('authority').length, staleResult === 'removed' ? 0 : 1);
     }
     current.resolve([swarmCatalogSession('idle')]);
@@ -511,7 +550,7 @@ test('continuous Owner invalidations cannot starve successful catalog observatio
     pending[index]!.resolve([swarmCatalogSession(activity)]);
     await waitFor(() => pending.length === index + 2);
     const catalog = service.catalog()[0]!;
-    assert.equal(catalog.authoritative, true, 'publish before notifications become quiet');
+    assert.equal(catalog.authoritative, false, 'a dirty observation cannot prove Session absence');
     assert.equal(catalog.sessions[0]?.backgroundActivity, activity);
     assert.equal(notifications, index + 1);
   }
@@ -545,7 +584,7 @@ test('a queued Owner refresh clears stale activity as soon as a slot is free wit
   })).concat(third);
   service.changed(third.scope);
   const queued = service.catalog()[2]!;
-  assert.equal(queued.authoritative, true);
+  assert.equal(queued.authoritative, false);
   assert.equal(queued.sessions[0]?.backgroundActivity, 'running');
   assert.equal(reads, 1, 'the third partition must wait for a slot');
   first.resolve([]);
@@ -644,7 +683,7 @@ test('continuous fast Owner invalidations cannot fence a slower partition catalo
     reads.get('slow')![index + 1]!.resolve([swarmCatalogSession(activity)]);
     await waitFor(() => reads.get('slow')!.length === index + 3);
     const catalog = service.catalog()[0]!;
-    assert.equal(catalog.authoritative, true);
+    assert.equal(catalog.authoritative, false);
     assert.equal(catalog.sessions[0]?.backgroundActivity, activity,
       'a successful slow observation must publish while another authority remains busy');
   }
diff --git a/apps/desktop/src/main/session-local-service.ts b/apps/desktop/src/main/session-local-service.ts
index f246b38ae5..e135e7d40b 100644
--- a/apps/desktop/src/main/session-local-service.ts
+++ b/apps/desktop/src/main/session-local-service.ts
@@ -368,24 +368,26 @@ export class DesktopSessionLocalService {
       .map((target) => {
         const connection = this.#observeCatalogConnection(target);
         const fresh = this.#catalogFresh.get(target.partition);
-        const authoritative = !this.#closed && !!target.client && fresh?.connection === connection;
+        const live = !this.#closed && !!target.client && fresh?.connection === connection;
         const sessions = this.store
           .sessions(target.partition)
           .map((session) =>
             this.store.creation(target.partition, session.id)
               ? { ...session, localState: 'pending' as const }
-              : authoritative
+              : live
                 ? session
                 : { ...session, runningTurnIds: undefined, backgroundActivity: undefined, backgroundActivityVersion: undefined, localState: 'cached' as const },
           );
         if (
           target.client &&
-          (!authoritative || !fresh ||
+          (!live || !fresh ||
             fresh.invalidationVersion !== connection.invalidationVersion ||
             Date.now() - fresh.at > 5000)
         )
           this.#refreshCatalog(target, connection);
-        return { scope: target.scope, sessions, authoritative };
+        // A live snapshot still carries observed activity, but cannot prove
+        // absence after a Host change until the catalog catches up.
+        return { scope: target.scope, sessions, authoritative: live && fresh.invalidationVersion === connection.invalidationVersion };
       });
   }
 
diff --git a/package.json b/package.json
index 1d7a14b9d0..00aa702eb3 100644
--- a/package.json
+++ b/package.json
@@ -83,7 +83,7 @@
     "check:runtime-host-peer-dependencies": "node scripts/generate-runtime-host-peer-dependencies.mjs --check",
     "generate:runtime-host-peer-notices": "node scripts/generate-runtime-host-peer-notices.mjs",
     "check:runtime-host-peer-notices": "node scripts/generate-runtime-host-peer-notices.mjs --check",
-    "check:release": "npm run check:stale && npm run check:third-party-notices && npm run check:cli-third-party-notices && npm run check:model-metadata && npm run check:product-release-identity && npm run check:asf-npm && node --test scripts/staple-macos-artifact.test.mjs scripts/product-nightly.test.mjs scripts/desktop-release-targets.test.mjs scripts/verify-linux-harness.test.mjs scripts/desktop-nightly.test.mjs scripts/desktop-nightly-stage.test.mjs scripts/desktop-nightly-release.tes [...]
+    "check:release": "npm run check:stale && npm run check:third-party-notices && npm run check:cli-third-party-notices && npm run check:model-metadata && npm run check:product-release-identity && npm run check:asf-npm && node --test --test-concurrency=1 scripts/staple-macos-artifact.test.mjs scripts/product-nightly.test.mjs scripts/desktop-release-targets.test.mjs scripts/verify-linux-harness.test.mjs scripts/desktop-nightly.test.mjs scripts/desktop-nightly-stage.test.mjs scripts/deskto [...]
     "package:macos-arm64": "node scripts/package-macos.mjs arm64",
     "package:macos-x64": "node scripts/package-macos.mjs x64",
     "verify:macos": "node scripts/verify-macos-dmg.mjs",
diff --git a/scripts/qualify-released-cli-state-root.mjs b/scripts/qualify-released-cli-state-root.mjs
index 5c04cb0696..ea5fbd08e0 100644
--- a/scripts/qualify-released-cli-state-root.mjs
+++ b/scripts/qualify-released-cli-state-root.mjs
@@ -590,7 +590,9 @@ function runRuntimeHostUntilVerifierStop(
 
     const startupTimer = setTimeout(() => {
       requestVerifierStop(
-        new Error(`Released Runtime Host did not publish Ready within ${startupTimeoutMs} ms`),
+        new Error(
+          `Released Runtime Host did not publish Ready within ${startupTimeoutMs} ms: ${stderr || stdout}`,
+        ),
       );
     }, startupTimeoutMs);
 
diff --git a/scripts/qualify-released-cli-state-root.test.mjs b/scripts/qualify-released-cli-state-root.test.mjs
index 912842bf40..2522c21eab 100644
--- a/scripts/qualify-released-cli-state-root.test.mjs
+++ b/scripts/qualify-released-cli-state-root.test.mjs
@@ -331,6 +331,16 @@ test('starts the liveness window after the real Runtime Host is ready', {
   }
 });
 
+test('reports startup output when a Runtime Host never reaches Ready', async () => {
+  await assert.rejects(
+    runRuntimeHostFixture(`
+      console.error('fixture startup blocked');
+      setInterval(() => undefined, 1000);
+    `),
+    /did not publish Ready within 1000 ms:.*fixture startup blocked/su,
+  );
+});
+
 test('rejects a Runtime Host that exits cleanly after Ready', async () => {
   await assert.rejects(
     runRuntimeHostFixture(


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