fix: reset per-tab agent state in killAgent()#999
Open
alwynoddle wants to merge 1 commit intogarrytan:mainfrom
Open
fix: reset per-tab agent state in killAgent()#999alwynoddle wants to merge 1 commit intogarrytan:mainfrom
alwynoddle wants to merge 1 commit intogarrytan:mainfrom
Conversation
After the per-tab agent refactor, killAgent() correctly reset the legacy global agentStatus to 'idle' but left the per-tab entry in tabAgents with status 'processing'. spawnClaude() checks the per-tab status, not the global, so every message sent after a kill was silently queued in-memory (tabState.queue) instead of being dispatched to the queue file. Result: the sidebar appeared idle (global status = idle) but would never respond to new messages again until the server was restarted. Fix: reset the per-tab TabAgentState alongside the legacy globals. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
killAgent()resets the legacy globalagentStatus = 'idle'but leaves the per-tab entry intabAgentswithstatus: 'processing'.The
POST /sidebar-commandhandler checks per-tab status (not the global) to decide whether to callspawnClaude()or queue the message. After a kill, the tab is permanently stuck — the sidebar looks idle but silently queues every new message in memory instead of dispatching it. Only fix was a server restart.Root cause
The per-tab
tabAgentsMap was introduced alongside the cancel-file work in #664, butkillAgent()was only updated to write the cancel file — the per-tab state reset was missed.Fix
Reset the
TabAgentStateentry intabAgentsinsidekillAgent(), alongside the existing legacy global resets.Repro
'processing', agent never responds'processing'Test
After the fix: kill an in-progress agent, send a new message, confirm
agent_startappears in the chat buffer and a new entry is appended tosidebar-agent-queue.jsonl.🤖 Generated with Claude Code