[Bug]: Pi idle extension dialogs trigger false “work completed” notifications
- Dominant language
- TypeScript
- Stars
- 71.3k
- Forks
- 4.7k
- Avg merge
- 17h 8m
- Merged PRs (30d)
- 475
Description
### Operating system
Linux
### Orca version
1.4.200
### Details
Short summary:
Orca shows a “work completed” notification whenever I confirm a selection in a Pi extension dialog, even when no AI task is running.
What happened?
I encountered this with a custom `/yank` command that copies previous assistant messages or individual code blocks. It uses Pi’s standard `ctx.ui.select()` API for multiple steps:
1. Select an assistant message.
2. Choose full-message or code-block copying.
3. Select a code block.
A completion notification appears between selections. The built-in `/copy` command is unaffected because it copies directly without opening a dialog.
Environment:
- Orca: 1.4.200
- Pi running in an Orca-managed Linux container terminal
- Orca-managed `orca-agent-status.ts` integration enabled
Expected behavior:
Opening or closing an idle utility dialog should not trigger a “work completed” notification.
Notifications for real agent completion, questions, and approval requests should continue to work.
Actual behavior:
Confirming a Pi extension selection dialog triggers a “work completed” notification even though no agent turn is active.
How can we reproduce it?
1. Run Pi in an Orca-managed Linux container terminal with the Orca-managed `orca-agent-status.ts` integration enabled.
2. Use a Pi extension command that calls `ctx.ui.select()` while no AI task is running.
3. Confirm a selection in the dialog.
4. Observe that Orca shows a “work completed” notification.
Anything else that might help:
An offline replay of the installed Pi integration and Orca relay state mapping showed this sequence for each selection:
```text
ui_prompt_start
→ waiting
ui_prompt_end { is_idle: true }
→ done
```
Three dialog interactions produced three `done` states, with zero `agent_end` events.
The integration appears to forward UI prompt events even when no agent turn is in progress. The relay then maps `ui_prompt_end` with `is_idle: true` to `done`, which can trigger a false completion notification.
The desktop notification dispatch itself was not replayed offline; the visible notifications were observed during real `/yank` usage.
Suggested fix:
Distinguish idle utility dialogs from prompts associated with an active agent turn.
One possible fix is to ignore `ui_prompt_start` when `piTurnInFlight` is false, while preserving balanced handling for dialogs opened during an active turn.
An in-memory trial of this change suppressed the false completion states while retaining:
- Waiting/working states for questions during an agent turn.
- One completion state when the agent actually finishes.
- Correct completion when an agent finishes while a dialog remains open.
Any permanent fix should update Orca’s extension-generation source, not only the generated local extension.
Contributor guide
Research direction
Start with the Orca-managed orca-agent-status.ts integration and trace ui_prompt_start, ui_prompt_end, agent_end, and piTurnInFlight through the relay state mapping. Verify the fix in an idle Pi ctx.ui.select() dialog and during an active agent turn, including a dialog that remains open when the agent finishes; done means no false completion notification and one real completion state.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100