From 7fa3ee15d0ae06e22cf5698ba3b04bf37e2ba0d1 Mon Sep 17 00:00:00 2001 From: "Yang,Zhou" Date: Fri, 19 Jun 2026 08:36:45 +0800 Subject: [PATCH] fix: stop Devin SessionStart from showing false Running spinner in sidebar (#5731) Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- src/shared/agent-hook-listener.test.ts | 4 +++- src/shared/agent-hook-listener.ts | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/shared/agent-hook-listener.test.ts b/src/shared/agent-hook-listener.test.ts index f71f1b0f6..4b4bbd05b 100644 --- a/src/shared/agent-hook-listener.test.ts +++ b/src/shared/agent-hook-listener.test.ts @@ -412,7 +412,9 @@ describe('shared agent-hook-listener', () => { 'production' ) - expect(started?.payload).toMatchObject({ agentType: 'devin', state: 'working' }) + // Why: SessionStart fires when the TUI opens/resumes while still idle. + // It must not create a visible "working" row before the user submits a prompt. + expect(started).toBeNull() expect(compacted?.payload).toMatchObject({ agentType: 'devin', state: 'working' }) expect(ended?.payload).toMatchObject({ agentType: 'devin', state: 'done' }) }) diff --git a/src/shared/agent-hook-listener.ts b/src/shared/agent-hook-listener.ts index f507aa921..3f84a7a7d 100644 --- a/src/shared/agent-hook-listener.ts +++ b/src/shared/agent-hook-listener.ts @@ -1833,7 +1833,10 @@ function isNewTurnEvent(source: AgentHookSource, eventName: unknown): boolean { case 'hermes': return eventName === 'pre_llm_call' || eventName === 'on_session_start' case 'devin': - return eventName === 'SessionStart' || eventName === 'UserPromptSubmit' + // Why: SessionStart is handled by an early return in normalizeDevinEvent + // (clears turn cache, returns null) so it never reaches this branch. + // UserPromptSubmit is the real new-turn boundary for Devin. + return eventName === 'UserPromptSubmit' } } @@ -1981,8 +1984,16 @@ function normalizeDevinEvent( paneKey: string, hookPayload: Record ): ParsedAgentStatusPayload | null { + if (eventName === 'SessionStart') { + // Why: Devin emits SessionStart when the TUI opens/resumes while still idle. + // Only UserPromptSubmit or tool activity should create a visible working row — + // mapping SessionStart to 'working' made the sidebar show "Devin - Running" + // with a spinner before the user typed anything. + clearPaneTurnCacheState(state, paneKey) + return null + } + const stateName = - eventName === 'SessionStart' || eventName === 'UserPromptSubmit' || eventName === 'PreToolUse' || eventName === 'PostToolUse' ||