fix: stop Codex loader when turn completes#2073
Conversation
Greptile SummaryThis PR fixes Codex loader completion state by (1) forcing the terminal classifier to remain active for Codex even when hooks are available, and (2) treating an
Confidence Score: 3/5The Codex-specific Because the companion change in
|
| Filename | Overview |
|---|---|
| src/renderer/features/tasks/conversations/conversation-manager.ts | Adds Codex-specific handling for idle_prompt to mark conversations as completed; the status === 'working' guard creates a fallthrough path where a duplicate event (from both hook and classifier being active) can incorrectly set the conversation to awaiting-input. |
| src/main/core/conversations/impl/local-conversation.ts | Excludes Codex from useHooksOnly so the terminal classifier always runs alongside hooks; logic is straightforward and well-commented. |
Sequence Diagram
sequenceDiagram
participant Codex as Codex CLI
participant Hook as Agent Hook
participant Classifier as Terminal Classifier
participant CM as ConversationManager
participant Store as ConversationStore
Note over Hook,Classifier: Both active for Codex (new behaviour)
Codex->>Hook: idle signal (sometimes skipped)
Codex->>Classifier: terminal output (idle pattern)
alt Hook fires first
Hook->>CM: "agentEvent { type: notification, nt: idle_prompt }"
CM->>Store: setStatus completed [status was working]
Note over CM: returns early
Classifier->>CM: "agentEvent { type: notification, nt: idle_prompt }"
CM-->>Store: status not working, falls through to setAwaitingInput
else Hook skipped, Classifier fires
Classifier->>CM: "agentEvent { type: notification, nt: idle_prompt }"
CM->>Store: setStatus completed [status was working]
Note over CM: returns early
end
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
src/renderer/features/tasks/conversations/conversation-manager.ts:109-117
When both the hook **and** the terminal classifier are active for Codex (exactly what the companion change to `local-conversation.ts` causes), the hook fires `idle_prompt` first and sets the conversation to `'completed'`. If the classifier also emits `idle_prompt` before the 10-second cooldown expires this guard doesn't fire (status is no longer `'working'`), so execution falls through to `setAwaitingInput` and plays the `needs_attention` sound — flipping a just-completed Codex task into an "awaiting input" state. Dropping the `status === 'working'` check from the early-return condition (and still returning early) prevents the fallthrough in all cases.
```suggestion
if (event.providerId === 'codex' && nt === 'idle_prompt') {
if (conversationStore.status === 'working') {
conversationStore.setStatus('completed');
soundPlayer.play('task_complete', appFocused);
}
return;
}
```
Reviews (1): Last reviewed commit: "Fix Codex loader completion state" | Re-trigger Greptile
d4ad821 to
e572525
Compare
e572525 to
f865f1c
Compare
|
thanks for the update, this then lgtm! :D |
e4a8dd1 to
319f425
Compare
Summary