| … | … | @@ -2032,28 +2148,17 @@ export const makeMuseAdapterV2 = Effect.fn("makeMuseAdapterV2")(function* ( | |
| 2034 | 2150 | yield* updateSession("running"); | |
| 2035 | - | const held = wake; | |
| 2036 | - | wake = undefined; | |
| 2151 | + | const held = compact ? undefined : wake; | |
🟠 High server/adapter.ts:2151
A wake that requests approval or user input can deadlock compaction: its request is buffered instead of being shown, while compactWhenIdle waits for that wake's run to complete. Because the continuation that replays the buffer is queued behind compaction, the user cannot answer and compaction cannot retry; let interactive wake requests reach handleRequestEvent while preserving the wake's other output.
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
| 1 | In file @packages/provider-muse/src/server/adapter.ts around line 2151: |
| 2 | |
| 3 | A wake that requests approval or user input can deadlock compaction: its request is buffered instead of being shown, while `compactWhenIdle` waits for that wake's run to complete. Because the continuation that replays the buffer is queued behind compaction, the user cannot answer and compaction cannot retry; let interactive wake requests reach `handleRequestEvent` while preserving the wake's other output. |
Fixed. While a compaction turn is active, every approval or question is shown as a runless request instead of being buffered. That includes ones the held wake buffered before compaction began: only request notifications leave the buffer, and the wake's other output stays queued for its continuation. Runless settlements now bypass turn routing, so a request shown during a compaction that is then stopped still resolves. The new approval cases and "settles a request shown during compaction after the compaction is stopped" in adapter.test.ts deadlock on the previous head and pass now.