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>
This commit is contained in:
Yang,Zhou 2026-06-19 08:36:45 +08:00 committed by GitHub
parent d46349ce82
commit 7fa3ee15d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 3 deletions

View File

@ -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' })
})

View File

@ -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<string, unknown>
): 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' ||