You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by wy...@apache.org on 2026/09/04 01:16:51 UTC
(maka) branch main updated: fix(runtime-host): preserve legacy handoff operator (#4696)
This is an automated email from the ASF dual-hosted git repository.
M4n5ter 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 b39e8d36ef fix(runtime-host): preserve legacy handoff operator (#4696)
b39e8d36ef is described below
commit b39e8d36ef4b561b3f46971d59ecdbb30ecc481c
Author: Wang <m4...@gmail.com>
AuthorDate: Fri Sep 4 09:16:48 2026 +0800
fix(runtime-host): preserve legacy handoff operator (#4696)
Refs #4657
Generated-by: OpenAI Codex
---
.../runtime-host-local-remote-access.test.ts | 13 ++++++++----
.../src/main/runtime-host-local-remote-access.ts | 23 ++++++++++++++++------
2 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/apps/desktop/src/main/__tests__/runtime-host-local-remote-access.test.ts b/apps/desktop/src/main/__tests__/runtime-host-local-remote-access.test.ts
index faa04a1a05..c1c9214a53 100644
--- a/apps/desktop/src/main/__tests__/runtime-host-local-remote-access.test.ts
+++ b/apps/desktop/src/main/__tests__/runtime-host-local-remote-access.test.ts
@@ -404,6 +404,7 @@ test('replaces a conflicting supervised Host with the requested active-work poli
resolveManagedDeploymentAuthority: async () => ({
kind: 'active',
lifecycleMode: 'supervised',
+ deploymentRoot: join(base, 'deployment'),
target: {
schemaVersion: 2,
serviceId: rootId,
@@ -513,14 +514,14 @@ test('does not persist recoverable setup authority before Desktop ownership comm
assert.equal(setupCalls, 0);
});
-test('adopts committed managed authority from a released handoff without replaying setup', async (t) => {
+test('adopts a released handoff through its existing legacy operator', async (t) => {
const base = await mkdtemp(join(tmpdir(), 'maka-local-remote-access-prestart-'));
t.after(() => rm(base, { recursive: true, force: true }));
const clientDataRoot = join(base, 'client');
const rootPath = join(clientDataRoot, 'workspaces', 'default');
const rootId = 'a'.repeat(64);
const deploymentId = '22222222-2222-4222-8222-222222222222';
- const installedOperator = testOperator(join(base, 'installed', 'operator.mjs'));
+ const deploymentRoot = join(base, 'installed');
await mkdir(rootPath, { recursive: true });
await writeFile(
join(clientDataRoot, 'runtime-host-local-service.json'),
@@ -543,10 +544,11 @@ test('adopts committed managed authority from a released handoff without replayi
resolveManagedDeploymentAuthority: async () => ({
kind: 'active',
lifecycleMode: 'supervised',
+ deploymentRoot,
target: {
schemaVersion: 2,
serviceId: rootId,
- operator: installedOperator,
+ operator: testOperator(join(deploymentRoot, 'operator.mjs')),
rootPath,
rootId,
deploymentId,
@@ -570,7 +572,10 @@ test('adopts committed managed authority from a released handoff without replayi
schemaVersion: 2,
state: 'managed',
serviceId: rootId,
- operator: installedOperator,
+ operator: {
+ kind: 'legacy_posix_executable',
+ executablePath: join(deploymentRoot, 'operator'),
+ },
rootPath,
rootId,
deploymentId,
diff --git a/apps/desktop/src/main/runtime-host-local-remote-access.ts b/apps/desktop/src/main/runtime-host-local-remote-access.ts
index 06bcf4e414..268fa68dee 100644
--- a/apps/desktop/src/main/runtime-host-local-remote-access.ts
+++ b/apps/desktop/src/main/runtime-host-local-remote-access.ts
@@ -92,6 +92,7 @@ type LocalManagedDeploymentAuthority =
| {
readonly kind: 'active';
readonly lifecycleMode: 'on_demand' | 'supervised';
+ readonly deploymentRoot: string;
readonly target: LocalServiceTarget;
}
| { readonly kind: 'transition' };
@@ -205,6 +206,7 @@ export function createDesktopLocalRuntimeHostRemoteAccess(input: {
return {
kind: 'active',
lifecycleMode: authority.record.lifecycle.mode,
+ deploymentRoot: authority.record.deploymentRoot,
target: requireServiceTarget(
{
schemaVersion: 2,
@@ -223,7 +225,7 @@ export function createDesktopLocalRuntimeHostRemoteAccess(input: {
});
const adoptCommittedSetup = async (
- setup: LocalServiceSetupPending,
+ setup: LocalServiceSetupPending | LocalServiceLegacyHandoff,
): Promise<
| { readonly kind: 'absent' | 'transition' }
| { readonly kind: 'managed'; readonly managed: LocalServiceManaged }
@@ -231,7 +233,16 @@ export function createDesktopLocalRuntimeHostRemoteAccess(input: {
const authority = await resolveManagedDeploymentAuthority(setup.rootId);
if (!authority) return { kind: 'absent' };
if (authority.kind === 'transition') return authority;
- const managed = managedLifecycle(authority.target);
+ const target =
+ setup.schemaVersion === 1
+ ? {
+ ...authority.target,
+ operator: createRuntimeHostLegacyPosixOperatorCommand(
+ join(authority.deploymentRoot, 'operator'),
+ ),
+ }
+ : authority.target;
+ const managed = managedLifecycle(target);
await writeDocument(lifecyclePath, managed);
return { kind: 'managed', managed };
};
@@ -472,7 +483,7 @@ export function createDesktopLocalRuntimeHostRemoteAccess(input: {
| { readonly kind: 'complete'; readonly managed: LocalServiceManaged }
> => {
const pending = pendingSetup(legacy);
- const authority = await adoptCommittedSetup(pending);
+ const authority = await adoptCommittedSetup(legacy);
if (authority.kind === 'managed') {
return { kind: 'complete', managed: authority.managed };
}
@@ -487,7 +498,7 @@ export function createDesktopLocalRuntimeHostRemoteAccess(input: {
);
if (retirement.kind === 'active_tasks') return { kind: 'active_tasks' };
if (retirement.kind === 'not_owned') {
- const raced = await adoptCommittedSetup(pending);
+ const raced = await adoptCommittedSetup(legacy);
if (raced.kind === 'managed') {
return { kind: 'complete', managed: raced.managed };
}
@@ -857,7 +868,7 @@ export function createDesktopLocalRuntimeHostRemoteAccess(input: {
const pending = await readLifecycle(lifecyclePath, input.rootPath, input.rootId);
if (pending?.state !== 'setupPending' && pending?.state !== 'handoff') return false;
const current = pendingSetup(pending);
- const authority = await adoptCommittedSetup(current);
+ const authority = await adoptCommittedSetup(pending);
if (authority.kind === 'absent') return false;
if (authority.kind === 'managed') return true;
if (pending.state === 'handoff') await writeDocument(lifecyclePath, current);
@@ -882,7 +893,7 @@ export function createDesktopLocalRuntimeHostRemoteAccess(input: {
return;
}
if (lifecycle.state === 'handoff' || lifecycle.state === 'setupPending') {
- const committed = await adoptCommittedSetup(pendingSetup(lifecycle));
+ const committed = await adoptCommittedSetup(lifecycle);
if (committed.kind === 'managed') return;
if (!supported(input.directPeerAvailable)) return;
if (lifecycle.state === 'handoff') await recoverLegacyHandoff(lifecycle);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org