Skip to content
620 changes: 595 additions & 25 deletions packages/cli/src/__tests__/runtime-host-run-command.test.ts

Large diffs are not rendered by default.

8 changes: 0 additions & 8 deletions packages/cli/src/cli-core.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { readFile } from 'node:fs/promises';
import { join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { formatMakaResumeHint } from './cli-invocation.js';
import { resolveMakaDataRoots } from './workspace-root.js';
import { parseRuntimeHostCommand, type RuntimeHostCliCommand } from './runtime-host-cli.js';
import { resolveCliUiLocale } from './cli-ui-locale.js';
Expand Down Expand Up @@ -172,13 +171,6 @@ function helpText(cliCommand: string): string {
].join('\n');
}

export function formatResumeHint(
sessionId: string | null,
cliCommand: string = RELEASE_MAKA_CLI_LAUNCH_OPTIONS.cliCommand,
): string | null {
return formatMakaResumeHint(cliCommand, sessionId);
}

export async function runMakaCli(
argv: string[] = process.argv.slice(2),
options: MakaCliLaunchOptions = RELEASE_MAKA_CLI_LAUNCH_OPTIONS,
Expand Down
13 changes: 6 additions & 7 deletions packages/cli/src/run-command-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export async function runMakaTextCliCore(
}

let outcome: MakaRunOutcome | undefined;
let streamBoundaryFailure = false;
let unclassifiedBoundaryFailure = false;
const boundaryFailureInvocationIds = new Set<string>();
let context: MakaRunContext;
try {
Expand Down Expand Up @@ -293,8 +293,10 @@ export async function runMakaTextCliCore(
runOutcomeObserver: (result) => {
if (result.sandboxBoundary === 'recovered') {
boundaryFailureInvocationIds.delete(result.outcomeId);
unclassifiedBoundaryFailure = false;
} else if (result.sandboxBoundary === 'unresolved') {
boundaryFailureInvocationIds.add(result.outcomeId);
unclassifiedBoundaryFailure = false;
}
outcome = result;
},
Expand Down Expand Up @@ -377,7 +379,7 @@ export async function runMakaTextCliCore(
: {}),
})) {
if (event.type === 'sandbox_boundary_request') {
streamBoundaryFailure = true;
unclassifiedBoundaryFailure = true;
deps.writeStderr(
'maka run: sandbox boundary expansion is unavailable in non-interactive mode\n',
);
Expand All @@ -388,7 +390,7 @@ export async function runMakaTextCliCore(
}
const sandboxFailureReason = sessionEventSandboxBoundaryFailureReason(event);
if (sandboxFailureReason) {
streamBoundaryFailure = true;
unclassifiedBoundaryFailure = true;
deps.writeStderr(
sandboxFailureReason === 'requires_bypass'
? 'maka run: sandbox bypass requires an explicit --yolo\n'
Expand Down Expand Up @@ -420,10 +422,7 @@ export async function runMakaTextCliCore(
return 1;
}
if (streamFailed) return 1;
if (
(streamBoundaryFailure && outcome?.sandboxBoundary !== 'recovered') ||
boundaryFailureInvocationIds.size > 0
) {
if (unclassifiedBoundaryFailure || boundaryFailureInvocationIds.size > 0) {
return 1;
}
if (!outcome) {
Expand Down
Loading