apache / apache/maka

bug(runtime-host): paused Graph recovery retries admission and fails Host startup

Open
#4,991 3 comments 0 reactions 1 assignee Claimed by @Adarsh-Me View on GitHub
bug
Dominant language
TypeScript
Stars
5.4k
Forks
502
Avg merge
1d 2h
Merged PRs (30d)
715

Description

### What happened

Recovering persisted Agent Graph work can prevent the entire Runtime Host from starting when the root Session cannot currently admit background execution: it is in Plan mode, or it is a legacy Session without an explicit `llmConnectionId`.

The supervisor retries the admission rejection three times, then its `onError` triggers Host drain. Startup subsequently fails with `Agent graph coordinator is closed` / `Runtime Host startup failed and shutdown did not complete cleanly`. Restarting the same data root repeats the three attempts.

Expected: preserve the durable checkpoint while that Session waits for explicit account selection / execution resume. The Host should become ready so the user can resolve the Session's configuration.

### How to reproduce

This is a historical persisted-state recovery issue; an ordinary Plan toggle and restart is **not** a confirmed fresh-profile reproduction.

1. Use a disposable copy of a data root containing unfinished Graph work that produces a supervisor checkpoint on recovery.
2. The root Session is in Plan mode, or lacks `llmConnectionId` while using the `ai-sdk` backend.
3. Start the production Runtime Host from the unpatched source build.
4. Observe three new `retryable_failed` entries in `agent_graph_supervisor_wake_attempts`, followed by Host startup failure.
5. Start the same copy again: another three failed attempts are recorded.

Repeated with isolated copies of an affected pre-upgrade database; the original application data was not changed. A separate synthetic, credential-free Plan recovery fixture was also developed during earlier investigation. Neither the original database nor credentials will be attached.

### Environment

- Source build: Maka 0.2.0, commit `5846521372d2dd0d3d2d33dc7784dd046dc3f7c8`, built without the local recovery patch.
- OS: macOS 26.5, Apple Silicon.
- Surface: Desktop / production Runtime Host / Agent Graph recovery.
- Runtime used for the latest direct Host verification: Electron 43.4.1's Node 24.18.1.

### Logs, screenshots, or additional context

| Isolated experiment | New wake attempts | New model-call records | Result |
| --- | ---: | ---: | --- |
| Original state, first startup | 3 | 0 | Fails after 503 ms: missing account selection |
| Same root, second startup | 3 | 0 | Fails after 462 ms: missing account selection |
| Bind the existing account in the copy, retain Plan | 3 | 0 | Fails after 920 ms: Plan rejects background execution |
| Remove existing wake/attempt rows, retain unfinished Graph | 3 | 0 | Recovery generates a new wake and fails |
| Fresh Session, missing account identity and Plan, no Graph work | 0 | 0 | Host ready |
| Original state with local recovery patch | 0 | 0 | Host ready |

The two admission errors are:

```text
This Session requires an explicit account selection before it can run.
Background and delegated roots cannot execute while the Session is in Plan mode.
```

These are local admission attempts, not repeated model API requests. The verified behavior is three attempts per startup, recurring on restart; this report does not claim an infinite loop inside one Host process. Both Host timeouts were 60 seconds, well above the observed failure times.

Related but distinct: #3866 / #4626 concern sandbox-answer reconciliation deadlock; #4695 concerns foreground submission before a Plan transition commits.

Automated report prepared and submitted with OpenAI Codex at the human contributor's request. Codex assisted with diagnosis, reproduction, and the proposed fix.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.