Skip to content

Agent Graph supervisor exhausts context and fails after operators complete #1593

Closed

Description

@likun666661

Summary

A read-only multi-operator Graph review exposed three failure modes in one run:

  1. concurrent tool calls could fail with Tool ledger transition rejected: orphan_response;
  2. update_agent_graph accepted non-catalog agent_id values, but those work items remained requested forever with no operator provisioned;
  3. after using the valid catalog agent and obtaining completed operator records, durable supervisor wakes repeatedly exceeded the context window and the CLI exited without a final synthesis.

The third failure is the most damaging: useful work had completed and was persisted, but the root supervisor could not recover/finalize the graph.

Environment

  • Maka repository commit: 14cb517fb5b3
  • package.json version: 0.1.1
  • maka --version: 0.1.0
  • Node.js: v22.19.0
  • macOS 15.5 (24F74)
  • command mode: maka run --graph
  • model used for the successful operator run: gpt-5.6-sol
  • permission mode: bypass

Reproduction outline

Run a Graph task against a non-trivial repository and ask the root to schedule four read-only review operators:

maka run --graph \
  --cwd /path/to/repo \
  --connection <connection> \
  --model gpt-5.6-sol \
  --thinking high \
  --timeout 1800 \
  --max-steps 200 \
  --permission-mode bypass \
  "First call update_agent_graph and schedule four implementation agents. Each agent should inspect a separate aspect of a large PR, produce evidence with file/line references, and make no edits. Wait for committed records, inspect all results, cross-check conflicts, then close the graph with a concise synthesis."

The review produced four initial operators. Three committed complete records; one provider run exceeded context before its final record. The root correctly scheduled a narrower replacement operator, which also finished its investigation and eventually wrote a final assistant result.

The root supervisor then attempted durable wakes but never produced the final graph response. The CLI terminated with:

maka run: Agent graph supervisor wake was not delivered after 3 attempts: errored: Context window exceeded

Observed provider request sizes for two operator/root paths were roughly 335–373 KB. The original checkout remained clean; this was not caused by filesystem mutation or an approval prompt.

Related failure modes observed

A. Concurrent tool responses can orphan the ledger

With another connection/model, an operator emitted three Bash calls together. In explore mode they were denied, after which the session failed immediately with:

Tool ledger transition rejected: orphan_response

Expected: every response should be paired with its call, or the runtime should serialize/normalize concurrent denials without invalidating the session ledger.

B. Unknown agent IDs are accepted but never provisioned

The first scheduling attempt used role names such as write-semantics as agent_id. The current catalog only exposed implementation.

update_agent_graph accepted the schedule, but all work stayed requested, with no child sessions and no actionable validation error.

Expected: reject the update synchronously and report the allowed catalog IDs, or map role labels separately from the provisionable agent_id.

Expected behavior

  • A failed operator should not prevent the root from consuming already committed records.
  • Durable supervisor wakes should reconstruct a compact state from graph projections and committed result records, not repeatedly carry raw operator transcripts/tool output.
  • A context overflow during synthesis should trigger a compact recovery path (fresh supervisor context, summarized records, or bounded agent_output reads).
  • If final synthesis still cannot run, the CLI should return a structured partial result containing completed records and the failed work item, rather than losing the entire user-facing result.
  • Invalid catalog agent IDs should fail at schedule-update time.
  • Concurrent denied tool calls should not produce an orphan ledger transition.

Actual behavior

  • Three complete committed review records and a completed replacement investigation existed on disk.
  • The graph remained open.
  • Supervisor wake delivery failed three times with the same context overflow.
  • maka run exited non-zero without a final synthesis, requiring manual inspection of session JSONL and Graph projection data.

Suggested fixes / diagnostics

  1. Put a strict token/byte budget on supervisor wake context.
  2. Hydrate only topology, work status, and bounded committed-result summaries by default.
  3. Start a fresh compact supervisor session after the first context overflow rather than retrying the same oversized context.
  4. Expose a deterministic partial-finalization path when some records are complete.
  5. Validate agent_id against the graph catalog inside update_agent_graph.
  6. Add a concurrency test where several tool calls are denied/resolved together and assert ledger pairing.
  7. Add an integration test with one failed operator, three large committed records, a replacement work item, and a root synthesis close.

Local diagnostic identifiers, if useful for correlating logs:

  • graph: agent_graph_dce8193c986be9e499849caa7c2349d1
  • root session: df8ef196-7994-4611-b378-b7a6cfafc34a

No credentials or repository contents are included in this report.

Activity

  1. likun666661 commented on Jul 29, 2026

    @likun666661
    MemberAuthor

    Post-fix live regression on the top of the four-PR stack (03fdf594) succeeded against the original large PR-review shape.

    • Root session: 3224f3b4-15a1-4add-9849-021406111bda
    • Graph: agent_graph_d9425bd24df84d0c7c316c4223d6afb4
    • Four parallel review operators were scheduled.
    • Two child runs hit unrelated transient provider Operation failed errors; the durable supervisor added bounded follow-up work to the same operators at schedule revision 2.
    • All four current activations completed and committed results.
    • The graph closed at revision 3 with four selected committed result records.

    agent_output view=result max_bytes=32768 returned 3,778 / 4,559 / 3,965 / 4,937 bytes for the four successful results. The two failed-run diagnostic envelopes were 2,223 / 2,273 bytes. The largest supervisor provider request was 462,287 bytes, versus the original reproduction's 1.13–2.248 MB growth and 479–572 KB individual agent_output payloads.

    No context overflow, compaction, forced recovery, or partial fallback occurred. The supervisor produced and persisted the final review, and maka run --graph exited successfully after the graph closed.

    A separate failure-path issue found during this run is tracked in #1604: maka run --graph can hang when the root provider request fails before any graph schedule exists, and the provider error is reduced to [object Object].

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