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/20 15:16:55 UTC

(maka) 05/06: fix(cli): aggregate recovered graph boundaries

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

Astro-Han pushed a commit to branch refactor/3088-unify-run-outcomes
in repository https://gitbox.apache.org/repos/asf/maka.git

commit 270a56678b6bd72119092bad612014321eac95af
Author: AstroHan <le...@outlook.com>
AuthorDate: Thu Aug 20 23:16:09 2026 +0800

    fix(cli): aggregate recovered graph boundaries
    
    Treat raw stream boundary failures as unclassified until the corresponding outcome records recovery or an unresolved failure. Keep unresolved outcomes aggregated by outcome id so a later successful Graph result cannot overwrite an earlier boundary decision.
    
    Generated-by: Codex
---
 .../cli/src/__tests__/runtime-host-run-command.test.ts     | 14 ++++++++++++++
 packages/cli/src/run-command-core.ts                       | 13 ++++++-------
 2 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/packages/cli/src/__tests__/runtime-host-run-command.test.ts b/packages/cli/src/__tests__/runtime-host-run-command.test.ts
index e61cea408..9c4aa6cee 100644
--- a/packages/cli/src/__tests__/runtime-host-run-command.test.ts
+++ b/packages/cli/src/__tests__/runtime-host-run-command.test.ts
@@ -218,6 +218,20 @@ describe('Runtime Host maka run adapter', () => {
     assert.equal(stdout.join(''), 'Final graph answer\n');
   });
 
+  test('returns exit code 0 when a root Graph boundary failure recovers', async () => {
+    const stdout: string[] = [];
+    const fixture = runFixture({
+      graph: true,
+      turnEvents: recoveredSandboxEvents('turn-1'),
+    });
+    const exitCode = await runFixtureCommand(fixture, ['recover once', '--graph'], (text) =>
+      stdout.push(text),
+    );
+
+    assert.equal(exitCode, 0);
+    assert.equal(stdout.join(''), 'Final graph answer\n');
+  });
+
   test('returns exit code 1 when the final Graph Turn fails', async () => {
     const fixture = runFixture({
       graph: true,
diff --git a/packages/cli/src/run-command-core.ts b/packages/cli/src/run-command-core.ts
index 90e88f6d9..e0279c795 100644
--- a/packages/cli/src/run-command-core.ts
+++ b/packages/cli/src/run-command-core.ts
@@ -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 {
@@ -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;
       },
@@ -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',
         );
@@ -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'
@@ -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) {


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