Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/shared/agent-hook-listener.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' })
})
Expand Down
15 changes: 13 additions & 2 deletions src/shared/agent-hook-listener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
}

Expand Down Expand Up @@ -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' ||
Expand Down
Loading