Skip to content

Fix stuck 'thinking' status after compaction or agent-end retry#226

Open
jap wants to merge 1 commit into
dnouri:masterfrom
jap:issue/compaction-retry-fallback
Open

Fix stuck 'thinking' status after compaction or agent-end retry#226
jap wants to merge 1 commit into
dnouri:masterfrom
jap:issue/compaction-retry-fallback

Conversation

@jap

@jap jap commented Jun 11, 2026

Copy link
Copy Markdown

After compaction_end with willRetry=true (or agent_end with willRetry), status is set to sending and activity-phase to "thinking", awaiting agent_start or auto_retry_start.

The --prompt-start-wait fallback timer (0.5s → idle) was only scheduled for user-sent prompts. Server-initiated retries had no fallback, so if the server never sends the expected event, the session remains stuck indefinitely.

Fix: Call --begin-prompt-start-wait when status becomes sending after compaction_end and agent_end. The existing 0.5s fallback resets to idle if no agent_start/auto_retry_start arrives. Applied in both --handle-compaction-end-event and --display-agent-end.

After compaction_end with willRetry=true (or agent_end with willRetry),
status is set to 'sending' and activity-phase to 'thinking', awaiting
agent_start or auto_retry_start. The prompt-start-wait fallback timer
(0.5s → idle) was only scheduled for user-sent prompts; server-initiated
retries had no fallback. If the server never sends the expected event,
the session remains stuck indefinitely.

Call --begin-prompt-start-wait when status becomes 'sending' after
compaction_end and agent_end, so the existing 0.5s fallback resets
to idle if no agent_start/auto_retry_start arrives.
@jap

jap commented Jun 11, 2026

Copy link
Copy Markdown
Author

Just adding some human input here, as I had pi/qwen3.6 create this PR :)
I ran into the issue that after a long-running prompt with some steering, followed by compacting, pi-coding-agent.el would get stuck in "thinking" instead of the actual idle. This happened multiple times so I decided to scratch the itch.

I told another instance of pi-coding-agent.el about this bug, pointed it to this repo, and then after some back and forth it created this fix. I haven't run any long-running prompts that tended to get stuck yet, so caveat emptor.
I hope it may be of use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant