apache / apache/maka

Desktop can submit the next turn before Plan mode transition commits

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

Description

### What happened

Maka Desktop can display Plan mode as active while the next root turn is still admitted with `collaborationMode: 'agent'`.

In the observed flow:

1. A Plan was submitted, approved, and executed.
2. Runtime returned the Session to Agent mode for execution.
3. Plan mode was enabled again from the Desktop composer.
4. A new message was sent immediately after enabling Plan mode.
5. The composer displayed Plan mode as selected, but the new turn behaved as an ordinary Agent turn:
- no new Plan proposal or approval card was produced;
- the Plan workflow was unavailable to the assistant;
- the assistant incorrectly told the user that the Session was still in ordinary execution mode.

This creates a split-brain state: the Desktop UI says Plan, but the admitted AgentRun uses Agent mode.

Expected behavior:

Once the composer displays Plan mode as selected, the next submitted root turn must either:

- be admitted with `collaborationMode: 'plan'`; or
- remain blocked until the Plan mode transition has committed.

Maka should never silently start a turn in Agent mode while the composer displays Plan mode.

### How to reproduce

The issue appears timing-sensitive.

1. Open an existing Desktop Session in Agent mode.
2. Enable Plan mode from the composer.
3. Immediately submit a message that requires a Plan proposal, for example:

> Create `maka-plan-demo.md`, read it back for verification, and track each execution step. Start by submitting a plan for approval.

4. Observe that the composer displays Plan mode as selected.
5. Observe that the new turn may behave as an ordinary Agent turn instead of submitting a Plan proposal.

The issue was originally observed with this sequence:

1. Enter Plan mode.
2. Submit a Plan.
3. Approve and execute the Plan.
4. Finish the execution, which returns the Session to Agent mode.
5. Enable Plan mode again.
6. Immediately send another message.
7. The UI displays Plan, but the new turn behaves as Agent.

For a deterministic regression test:

1. Delay the `sessions:setCollaborationMode` IPC response.
2. Click the Plan toggle.
3. Submit a message before the IPC response resolves.
4. Verify that the turn is not admitted using the previous `agent` mode.

### Environment

Maka Desktop diagnostic report
Captured at: 2026-09-03T23:22:32.778Z

Capture
Surface: manual

Environment
Maka: 0.2.0-dev.15.20260902
Build: packaged
Channel: nightly
Electron: 43.4.1
Chrome: 150.0.7871.224
Node: 24.18.1
OS: win32 10.0.19042 (x64)
Locale: zh-CN
Renderer locale: zh-CN
Renderer user agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Maka/0.2.0-dev.15.20260902 Chrome/150.0.7871.224 Electron/43.4.1 Safari/537.36
Workspace: ~\AppData\Roaming\Maka\workspaces\default
Main process uptime: 79924s

Recent main-process logs (9)
[2026-09-03T01:10:28.654Z] LOG [startup] app ready
[2026-09-03T01:10:41.400Z] ERROR (node:34424) [DEP0180] DeprecationWarning: fs.Stats constructor is deprecated.
(Use `Maka --trace-deprecation ...` to show where the warning was created)
[2026-09-03T07:29:09.914Z] ERROR Error occurred in handler for 'sessions:transcript:open': Error: Transcript observation ended before it became ready
at #deleteTranscript (file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-session-observation-registry.js:396:35)
at RuntimeHostSessionObservationRegistry.closeTranscript (file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-session-observation-registry.js:280:31)
at file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-desktop-manager.js:233:95
at Array.map ()
at RuntimeHostDesktopManagerImpl.closeTranscript (file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-desktop-manager.js:233:60)
at file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-boot.js:1406:35
at Session. (node:electron/js2c/browser_init:2:118387)
at Session.emit (node:events:509:28)
[2026-09-03T15:34:57.789Z] ERROR Error occurred in handler for 'sessions:transcript:open': Error: Transcript observation ended before it became ready
at #deleteTranscript (file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-session-observation-registry.js:396:35)
at RuntimeHostSessionObservationRegistry.closeTranscript (file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-session-observation-registry.js:280:31)
at file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-desktop-manager.js:233:95
at Array.map ()
at RuntimeHostDesktopManagerImpl.closeTranscript (file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-desktop-manager.js:233:60)
at file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-boot.js:1406:35
at Session. (node:electron/js2c/browser_init:2:118387)
at Session.emit (node:events:509:28)
[2026-09-03T15:34:57.796Z] ERROR Error occurred in handler for 'sessions:observe': Error: Session observation ended before it became ready
at #deleteRegistration (file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-session-observation-registry.js:319:35)
at #remove (file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-session-observation-registry.js:311:33)
at RuntimeHostSessionObservationRegistry.unobserve (file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-session-observation-registry.js:207:27)
at file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-desktop-manager.js:230:95
at Array.map ()
at RuntimeHostDesktopManagerImpl.unobserveSession (file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-desktop-manager.js:230:60)
at file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-boot.js:1400:35
at Session. (node:electron/js2c/browser_init:2:118387)
at Session.emit (node:events:509:28)
[2026-09-03T15:34:57.796Z] ERROR Error occurred in handler for 'sessions:observe': Error: Session observation ended before it became ready
at #deleteRegistration (file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-session-observation-registry.js:319:35)
at #remove (file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-session-observation-registry.js:311:33)
at RuntimeHostSessionObservationRegistry.unobserve (file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-session-observation-registry.js:207:27)
at file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-desktop-manager.js:230:95
at Array.map ()
at RuntimeHostDesktopManagerImpl.unobserveSession (file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-desktop-manager.js:230:60)
at file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-boot.js:1400:35
at Session. (node:electron/js2c/browser_init:2:118387)
at Session.emit (node:events:509:28)
[2026-09-03T23:13:27.347Z] ERROR Error occurred in handler for 'sessions:transcript:open': Error: Transcript observation ended before it became ready
at #deleteTranscript (file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-session-observation-registry.js:396:35)
at RuntimeHostSessionObservationRegistry.closeTranscript (file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-session-observation-registry.js:280:31)
at file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-desktop-manager.js:233:95
at Array.map ()
at RuntimeHostDesktopManagerImpl.closeTranscript (file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-desktop-manager.js:233:60)
at file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-boot.js:1406:35
at Session. (node:electron/js2c/browser_init:2:118387)
at Session.emit (node:events:509:28)
[2026-09-03T23:13:27.431Z] ERROR Error occurred in handler for 'sessions:observe': Error: Session observation ended before it became ready
at #deleteRegistration (file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-session-observation-registry.js:319:35)
at #remove (file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-session-observation-registry.js:311:33)
at RuntimeHostSessionObservationRegistry.unobserve (file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-session-observation-registry.js:207:27)
at file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-desktop-manager.js:230:95
at Array.map ()
at RuntimeHostDesktopManagerImpl.unobserveSession (file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-desktop-manager.js:230:60)
at file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-boot.js:1400:35
at Session. (node:electron/js2c/browser_init:2:118387)
at Session.emit (node:events:509:28)
[2026-09-03T23:13:27.432Z] ERROR Error occurred in handler for 'sessions:observe': Error: Session observation ended before it became ready
at #deleteRegistration (file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-session-observation-registry.js:319:35)
at #remove (file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-session-observation-registry.js:311:33)
at RuntimeHostSessionObservationRegistry.unobserve (file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-session-observation-registry.js:207:27)
at file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-desktop-manager.js:230:95
at Array.map ()
at RuntimeHostDesktopManagerImpl.unobserveSession (file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-desktop-manager.js:230:60)
at file:///~/AppData/Local/Programs/@makadesktop/resources/app.asar/dist/main/runtime-host-boot.js:1400:35
at Session. (node:electron/js2c/browser_init:2:118387)
at Session.emit (node:events:509:28)

Recent local Runtime Host process exits (0)

Runtime Host
Epoch: c2890f54-ab69-42bb-a09f-bdd6fbecac06
Protocol: v0 · compatibility 96
State: ready
Process: 37272 · uptime 79918s
Runtime: Node 24.18.1 · win32 10.0.19042 (x64)
Activity: 1 connections · 1 operations · 1 residencies
Recent Runtime Host logs (2)
[2026-09-03T01:10:38.928Z] ERROR [runtime-host] models.dev no longer carries 4 path(s) the bundled snapshot described; adopting upstream: /metadata/openrouter/anthropic~1claude-opus-4.7-fast, /metadata/openrouter/anthropic~1claude-opus-4.8-fast, /metadata/openrouter/anthropic~1claude-opus-5-fast, /metadata/vercel/deepseek~1deepseek-v3
[2026-09-03T08:50:00.586Z] ERROR (node:37272) [DEP0180] DeprecationWarning: fs.Stats constructor is deprecated.
(Use `Maka --trace-deprecation ...` to show where the warning was created)

### Logs, screenshots, or additional context

_No response_

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.