Skip to content

maka run --graph hangs after root provider failure before graph creation #1604

Closed

Description

@likun666661

Summary

maka run --graph can hang indefinitely when the root supervisor's provider request fails before it commits the first update_agent_graph schedule. The AgentRun is already terminal (failed) and the Session is blocked, but the CLI continues waiting for graph completion even though no graph was created and therefore nothing can ever close.

The same failure path also collapses a structured provider error to Operation failed / [object Object], which prevents classification and diagnosis.

Reproduction

Tested from the top of the #1593 fix stack (agent/1593-large-output-regression, commit 03fdf594) with:

node packages/cli/dist/cli.js run - \
  --cwd <repo> \
  --connection sub2api-stg \
  --model gpt-5.6-sol \
  --thinking medium \
  --timeout 3600 \
  --permission-mode bypass \
  --graph

Use a prompt whose first action should create graph work, then make the initial provider stream fail (the live reproduction used a transient upstream failure).

Observed twice:

  • Session 8c89dfff-73d3-4d79-8a17-aa2bac0bff25: root AgentRun failed before any tool call; CLI printed maka run: Operation failed and exited.
  • Session af1d5c81-20fd-453f-8d23-fc220068ac0b: root AgentRun failed after view_agent_graph, before any work was scheduled; the process remained alive and silent until explicitly sent SIGTERM.
  • Session 1a078bda-caf7-4ee9-80d6-cf6fa23ae8b1: initial request failed at only 3.2 KiB; the process again remained alive after the run was terminal. Two interactive Ctrl-C attempts did not stop it; kill -TERM did.

Representative operational events:

model_stream_failed errorClass=Other error="Operation failed"
rawErrorName="object" rawErrorType="object"
redactedErrorMessage="[object Object]"
run_failed failureClass=unknown

No subagent_spawns or graph schedule existed for the affected root session.

Expected

  • If the root run fails before a graph exists, maka run --graph exits non-zero immediately with the underlying classified provider error.
  • If a graph exists, waiting should be canceled when the root terminal state makes further reconciliation impossible, or should have an explicit durable terminal failure state.
  • SIGINT should always stop the CLI wait.
  • Structured non-Error provider failures should be normalized without reducing them to [object Object].

Suggested direction

Race agentGraph.waitForCompletion(sessionId) against the root invocation terminal result and process cancellation. Before waiting, distinguish graph exists and remains reconcilable from no schedule was ever committed. Normalize thrown objects at the provider boundary (status/code/message/body where safe) before redaction and failure classification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions