-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Problem
OAgent keeps background state for non-active sessions and restores it when the user switches back, but there are several paths where processing state can drift from reality. A session can continue showing as active after the underlying runtime has finished, or the UI can restore stale spinner / status metadata when switching rapidly between sessions. This is especially risky because it makes users think an agent is still working, masks terminal/runtime exits, and can confuse follow-up actions such as interrupt, compact, or resend.
Why this matters
This is a reliability bug, not just a cosmetic one. Once session state gets out of sync, the user loses confidence in whether the app is showing live runtime state or cached UI state. It also increases the chance of duplicate sends, unnecessary interrupts, and mistaken reports that a provider or MCP server is hung.
Suspected scope
- Background session store processing flags
- Session switch / restore flows
- Exit, interrupt, and turn-complete paths
- Draft-to-active session transitions
- Sidebar spinner state versus active chat state
Acceptance Criteria
- Switching away from and back to a running session should preserve only live state, not stale spinners.
- Finished or exited sessions should reliably clear processing state in both the sidebar and main chat view.
- Interrupt, provider failure, and normal completion should converge on the same settled session state.
- Add regression coverage for rapid session switching while one or more sessions are actively streaming.
- Document any known edge cases if a full fix requires deeper runtime refactoring.