[Bug]: Pi sessions remain in workspace agent list after Ctrl+D exit
- Dominant language
- TypeScript
- Stars
- 71.3k
- Forks
- 4.7k
- Avg merge
- 14h 54m
- Merged PRs (30d)
- 520
Description
### Operating system
Linux
### Orca version
v1.4.163
### Details
#### Summary
When a Pi agent exits through `Ctrl+D` (EOF), its completed `Done - Pi` row remains in the workspace agent list. Closing the same kind of agent pane with `Ctrl+W` removes the row immediately.
This makes the displayed agent count grow over time with completed Pi sessions that no longer have a live terminal and cannot be removed through the terminal CLI.
#### Reproduction
1. Open a workspace and start a Pi agent in an Orca terminal.
2. Let the agent finish, or otherwise return it to its normal prompt.
3. Press `Ctrl+D` to send EOF and let Pi exit.
4. Observe that the terminal exits but the workspace sidebar still contains a `Done - Pi` row. Repeat to accumulate more rows.
5. In a separate Pi terminal, press `Ctrl+W` to close its Orca terminal pane/tab.
6. Observe that this agent row disappears from the workspace list.
#### Expected behavior
Once the Pi process has exited and its terminal is no longer live, Orca should remove the corresponding row from the workspace agent list, regardless of whether the terminal ended through EOF (`Ctrl+D`) or was closed with `Ctrl+W`.
#### Actual behavior
`Ctrl+D` ends Pi but leaves a completed agent row in the workspace list. `Ctrl+W` removes the row.
#### Additional context
In the affected workspace, `orca-ide terminal list --worktree path: --json` reports only the currently live terminal; the completed Pi rows are not present as live terminals. This looks like an agent-roster/session cleanup gap specific to the EOF exit path.
A related, previously closed tracker is #8970, but its original symptom was the opposite close path (`Ctrl+W` leaving a row behind). The `Ctrl+W` path works in v1.4.163; the EOF path does not.
Thank you for looking into this!
Contributor guide
Assessment
This issue has not been assessed yet.