You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by "lyc10031 (via GitHub)" <gi...@apache.org> on 2026/10/12 06:35:31 UTC
Re: [I] fix(runtime-host): desktop handoff hangs indefinitely in staging phase during background service replacement [maka]
lyc10031 commented on issue #5476:
URL: https://github.com/apache/maka/issues/5476#issuecomment-6119072967
### Update: Re-occurrence in `0.2.0-dev.78.20261010` & Missing Fallback to Unmanaged Mode
Following up on this issue, we reproduced this deadlock again when updating Maka Desktop to **`0.2.0-dev.78.20261010`** on macOS (Darwin arm64).
While **#5494** decoupled the initial window rendering from Runtime Host readiness and **#5758** surfaced refused handoffs instead of infinite retry loops, **the underlying architectural deadlock remains unhealed**:
#### 1. Failure Manifestation in `dev.78`
When the desktop app upgraded while a previously supervised LaunchAgent daemon (from `dev.62`) was active, the app fell into a recurring timeout loop:
```
[startup] app ready
[shell-env] resolved login-shell PATH
ERROR Error occurred in handler for 'runtime-host:awaitReady': DOMException [TimeoutError]: The operation was aborted due to timeout (every 15s)
ERROR [runtime-host] fatal: RuntimeHostUpgradeCancelledError: Runtime Host restart was cancelled
at RuntimeHostDesktopManagerImpl.connect (runtime-host-desktop-manager.js:889:23)
at async #start (reconnect-lifecycle.js:122:27)
```
In the UI, this manifests as:
- Startup error dialog: **"默认 Runtime Host 无法连接 / 无法连接 Local (RuntimeHostUpgradeCancelledError: Runtime Host restart was cancelled)"**.
- All model connections and permissions in the renderer fail to load (`connections:getSnapshot` times out).
---
#### 2. Root Cause Analysis: The Strict Operator Gate (`managed_root_requires_operator`)
Even if the user unloads the persistent launchd agent via `launchctl bootout`, the desktop app still **refuses to start an embedded Host candidate**.
In `connect-or-spawn.js`:
```javascript
managedDeployment = await readRuntimeHostManagedDeploymentConfig(capability);
const managedLaunchRejection = runtimeHostManagedLaunchRejection(managedDeployment, managedLaunchClaim, 'on_demand');
if (managedLaunchRejection !== undefined) {
return {
kind: 'failed',
reason: managedLaunchRejection === 'managed_root_requires_operator' && sawUnresponsiveEndpoint
? 'host_unresponsive'
: managedLaunchRejection,
};
}
```
Because `~/Library/Application Support/Maka/runtime-host-deployments/<rootId>/runtime-host-deployment.json` still specifies `lifecycle.mode: "supervised"`, `runtimeHostManagedLaunchRejection` deterministically rejects on-demand candidate launches with `managed_root_requires_operator`.
This leaves the user stranded in an unrecoverable state:
- The external operator cannot be upgraded due to handoff failure / lock contention.
- The desktop app refuses to self-host an embedded candidate because it believes an external operator is mandatory.
---
#### 3. Verified Workaround
To unblock the desktop app without losing chat sessions (`runtime.sqlite`) or model catalogs (`connection-catalog.json`), we had to manually strip the supervised deployment markers:
```bash
# 1. Unload launchd agent
launchctl bootout gui/$(id -u) ~/Library/LaunchAgents/com.maka.runtime-host.*.plist
rm -f ~/Library/LaunchAgents/com.maka.runtime-host.*.plist
# 2. Archive managed deployment and service directories
mv ~/Library/Application\ Support/Maka/runtime-host-deployments ~/Library/Application\ Support/Maka/runtime-host-deployments.bak
mv ~/Library/Application\ Support/Maka/runtime-host-services ~/Library/Application\ Support/Maka/runtime-host-services.bak
# 3. Clear transient state-root locks
rm -f ~/Library/Application\ Support/Maka/state-root-owners/*.lock
rm -f ~/Library/Application\ Support/Maka/*.lease
```
After removing the managed deployment definition, Maka Desktop immediately boots its clean, embedded `dev.78` Runtime Host candidate and fully restores all workspaces and models.
---
#### 4. Proposed Architectural Fix
When a supervised handoff permanently fails or the external operator cannot become ready:
1. **UI Fallback Action**: In the startup/handoff failure dialog, offer an explicit **"Reset to Embedded Host / 切换回单机内置模式"** action alongside `["cancel"]`.
2. **Graceful Degradation**: Selecting this action should safely archive/demote `runtime-host-deployment.json` (e.g. rename or mark `unmanaged`), release the operator lock, and allow the desktop client to launch its embedded candidate directly.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org