Skip to content

[Bug]: Grok Composer hangs on Stop, resume replay floods thread, and long session/load stalls #3560

Description

@mwolson

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

Reproduced on T3 Code desktop with Grok Build / Grok Composer 2.5 Fast on a multi-turn thread (main @ ffae5410e).

A. Stop / working state stuck after Grok finishes

  1. Open a Grok-backed thread with several prior turns.
  2. Send a tool-heavy prompt.
  3. When Grok has effectively finished (tools done, prose streaming) but T3 Code still shows working/Stop, press Stop.
  4. session/prompt can remain stranded for many minutes while the composer stays active; follow-up turns may not dispatch.

B. Resume replay floods the live turn

  1. Use a long-lived Grok thread, restart T3 Code, and reopen the thread.
  2. Grok session/load replays historical session/update chunks marked _meta.isReplay: true.
  3. T3 Code projects those replay chunks into the new turn and the composer shows old tool calls / prose again.

C. Long session/load after restart

  1. Resume a long Grok native session after restart.
  2. Replay finishes but the session/load RPC may never return (observed ~90s+).
  3. Resume can stall or fall back to session/new, orphaning pending messages.

D. Timeline / missing prose on rebound segments

  1. On threads where Grok reuses assistant segment ids across turns, responses can sort above the user message that started the turn, making tools/prose look missing below the prompt.

Expected behavior

  • Turns settle when Grok returns to idle, even if the standard ACP session/prompt RPC stays stranded.
  • Stop cancels the in-flight Grok prompt and clears composer state without requiring an app restart.
  • Resume ignores replay-marked session/update traffic and completes load promptly (normal RPC or replay-idle synthesis).
  • Assistant timeline keeps stable chronological order across rebound/replay segments.

Actual behavior

  • Grok can emit _x.ai/session/prompt_complete while session/prompt never settles, leaving the composer stuck.
  • Stop may return success without unblocking a wedged session/prompt RPC.
  • Replay chunks after restart attach to the live turn and flood the composer.
  • session/load can hang after replay on long sessions.
  • Reused segment ids can leave prose/tools visually above the prompting user message; streaming markdown can jump near completion.

Impact

Major degradation or frequent failure

Version or commit

main @ ffae5410e (current upstream; reproduced on 0.0.27 desktop)

Environment

  • Linux x86_64 desktop AppImage
  • Grok Build CLI via ACP (grok-composer-2.5-fast)
  • Long-lived native Grok session across multiple turns and restarts

Logs or stack traces

# Stalled prompt (~27 min); Stop did not unblock the RPC before app restart
RpcClient.session/prompt duration ~1,630,000ms, exit Interrupted (process restart)
interruptTurn Success, but session/prompt kept running until restart

# Same thread after fix in #3156: prompt_complete race settles the turn
RpcClient.session/prompt duration ~39s, exit Interrupted
sendTurn Success

Workaround

Restart T3 Code and send a follow-up message. Avoid restarting long Grok threads when possible.

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