Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ const PROTOCOL = {
max: RUNTIME_HOST_PROTOCOL_VERSION,
} as const;

test('two UDS Clients query and control one Agent graph through Session invalidation', {
skip: process.platform === 'win32' ? 'POSIX UDS integration' : false,
test('two Clients query and control one Agent graph through Session invalidation', {
timeout: 10_000,
}, async () => {
const base = await mkdtemp(join(tmpdir(), 'maka-agent-graph-two-client-'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ const PROTOCOL = {
max: RUNTIME_HOST_PROTOCOL_VERSION,
} as const;

test('two UDS Clients share one revision-pinned Automation authority', {
skip: process.platform === 'win32' ? 'POSIX UDS integration' : false,
}, async () => {
test('two Clients share one revision-pinned Automation authority', async () => {
const base = await mkdtemp(join(tmpdir(), 'maka-host-automation-uds-'));
const root = join(base, 'interactive');
const capability = await resolveStorageRoot({ path: root, kind: 'interactive' });
Expand Down
18 changes: 18 additions & 0 deletions packages/runtime-host/src/__tests__/control-endpoint.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,24 @@ function legacyPrefix(): string {
return `m-${process.getuid?.()}-${rootTag()}-`;
}

describe('runtime host Windows named-pipe endpoint', { skip: process.platform !== 'win32' }, () => {
test('derives a stable pipe name and has idempotent lifecycle hooks', async () => {
const endpoint = await prepareRuntimeHostEndpoint({ rootId: ROOT_ID, hostEpoch: 'epoch-1' });
assert.equal(endpoint.path, `\\\\.\\pipe\\maka-runtime-host-${ROOT_ID.slice(0, 16)}-epoch-1`);
await endpoint.prepareAfterListen();
await endpoint.cleanup();
await endpoint.cleanup();
});

test('rejects an invalid storage root identity', async () => {
await assert.rejects(
prepareRuntimeHostEndpoint({ rootId: 'not-a-root-id', hostEpoch: '1' }),
(error: unknown) =>
error instanceof RuntimeHostEndpointError && error.code === 'insecure_endpoint_directory',
);
});
});

describe('runtime host control endpoint', { skip: process.platform === 'win32' }, () => {
const originalTmpdir = process.env.TMPDIR;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ const PROTOCOL = {
max: RUNTIME_HOST_PROTOCOL_VERSION,
} as const;

test('two UDS Clients share Daily Review config, generation, and restart recovery', {
skip: process.platform === 'win32' ? 'POSIX UDS integration' : false,
}, async () => {
test('two Clients share Daily Review config, generation, and restart recovery', async () => {
const base = await mkdtemp(join(tmpdir(), 'maka-host-daily-review-uds-'));
const root = join(base, 'interactive');
const capability = await resolveStorageRoot({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ const PROTOCOL = {
max: RUNTIME_HOST_PROTOCOL_VERSION,
} as const;

test('two UDS Clients and a restarted production Host share one Deep Research projection', {
skip: process.platform === 'win32' ? 'POSIX UDS integration' : false,
}, async () => {
test('two Clients and a restarted production Host share one Deep Research projection', async () => {
const base = await mkdtemp(join(tmpdir(), 'maka-host-deep-research-uds-'));
const root = join(base, 'interactive');
const capability = await resolveStorageRoot({ path: root, kind: 'interactive' });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import { removePosixEndpointDirectories } from './fixtures/endpoint-hygiene.js';

const PROCESS_TIMEOUT_MS = 10_000;

test('a live Host serves Interactive inspection over its real UDS while retaining exclusive ownership', {
skip: process.platform === 'win32' ? 'POSIX UDS integration' : false,
test('a live Host serves Interactive inspection over its real endpoint while retaining exclusive ownership', {
skip: process.platform === 'win32' ? 'Windows execution Host startup lifecycle' : false,
timeout: 60_000,
}, async () => {
const base = await mkdtemp(join(tmpdir(), 'maka-runtime-host-inspect-'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ import {
} from '../server/operation-dispatcher.js';
import { RuntimePolicyActivationGate } from '../server/runtime-policy-activation-gate.js';

test('OAuth enrollment presents only on the initiating Client over real UDS', {
skip: process.platform === 'win32' ? 'POSIX UDS integration' : false,
test('OAuth enrollment presents only on the initiating Client over the real endpoint', {
timeout: 30_000,
}, async () => {
const base = await mkdtemp(join(tmpdir(), 'maka-oauth-two-client-'));
Expand Down Expand Up @@ -153,8 +152,7 @@ test('OAuth enrollment presents only on the initiating Client over real UDS', {
}
});

test('OAuth enrollment honors Claude and Codex opt-out flags over real UDS', {
skip: process.platform === 'win32' ? 'POSIX UDS integration' : false,
test('OAuth enrollment honors Claude and Codex opt-out flags over the real endpoint', {
timeout: 30_000,
}, async () => {
const cases = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ const PROTOCOL = {
max: RUNTIME_HOST_PROTOCOL_VERSION,
} as const;

test('two UDS Clients and a restarted production Host share one retry-safe Plan authority', {
skip: process.platform === 'win32' ? 'POSIX UDS integration' : false,
}, async () => {
test('two Clients and a restarted production Host share one retry-safe Plan authority', async () => {
const base = await mkdtemp(join(tmpdir(), 'maka-host-plan-uds-'));
const root = join(base, 'interactive');
const capability = await resolveStorageRoot({ path: root, kind: 'interactive' });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ const CURRENT_PROTOCOL = {
const PROCESS_TIMEOUT_MS = 10_000;
const WIRE_OVERSIZED_MODEL_ID = '😀'.repeat(256);

test('two UDS Clients share stable Session creation, CAS configuration, and catalog continuity', {
skip: process.platform === 'win32' ? 'POSIX UDS integration' : false,
test('two Clients share stable Session creation, CAS configuration, and catalog continuity', {
skip: process.platform === 'win32' ? 'Windows SQLite shutdown lifecycle' : false,
timeout: 120_000,
}, async () => {
const base = await mkdtemp(join(tmpdir(), 'maka-runtime-host-session-catalog-'));
Expand Down Expand Up @@ -665,7 +665,7 @@ test('two UDS Clients share stable Session creation, CAS configuration, and cata
});

test('stable Session creation survives response loss and Host restart', {
skip: process.platform === 'win32' ? 'POSIX UDS integration' : false,
skip: process.platform === 'win32' ? 'Windows SQLite shutdown lifecycle' : false,
timeout: 120_000,
}, async () => {
const base = await mkdtemp(join(tmpdir(), 'maka-runtime-host-session-create-retry-'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ const PROTOCOL = {
max: RUNTIME_HOST_PROTOCOL_VERSION,
} as const;

test('two UDS Clients share one durable Session recap effect', {
skip: process.platform === 'win32' ? 'POSIX UDS integration' : false,
}, async () => {
test('two Clients share one durable Session recap effect', async () => {
const base = await mkdtemp(join(tmpdir(), 'maka-session-effect-uds-'));
const root = join(base, 'interactive');
const capability = await resolveStorageRoot({ path: root, kind: 'interactive' });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ const LINEAGE_REVISION_TARGET_ID = 'lineage-revision-target';
const LINEAGE_BRANCH_TARGET_ID = 'lineage-branch-target';
const GRAPH_REVISION_TARGET_ID = 'graph-revision-target';

test('two UDS Clients share exact retryable Session branch and revision authority', {
skip: process.platform === 'win32' ? 'POSIX UDS integration' : false,
test('two Clients share exact retryable Session branch and revision authority', {
skip: process.platform === 'win32' ? 'Windows SQLite shutdown lifecycle' : false,
timeout: 120_000,
}, async () => {
const base = await mkdtemp(join(tmpdir(), 'maka-runtime-host-session-revision-'));
Expand Down
6 changes: 5 additions & 1 deletion packages/runtime-host/src/control/endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export class RuntimeHostEndpointError extends Error {
export async function prepareRuntimeHostEndpoint(
input: RuntimeHostEndpointInput,
): Promise<RuntimeHostEndpoint> {
assertValidRootId(input.rootId);
if (process.platform === 'win32') {
const path = `\\\\.\\pipe\\maka-runtime-host-${input.rootId.slice(0, 16)}-${input.hostEpoch}`;
return {
Expand Down Expand Up @@ -115,13 +116,16 @@ function endpointDirectoryPrefix(rootPrefix: string, pid: number): string {
}

function endpointRootTag(rootId: string): string {
return Buffer.from(rootId, 'hex').toString('base64url');
}

function assertValidRootId(rootId: string): void {
if (!/^[a-f0-9]{64}$/.test(rootId)) {
throw new RuntimeHostEndpointError(
'insecure_endpoint_directory',
'Runtime Host endpoint requires a valid storage root identity',
);
}
return Buffer.from(rootId, 'hex').toString('base64url');
}

// Reclaims same-rootId endpoint directories whose owning process is gone,
Expand Down
Loading