Repository navigation
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| setState((prev) => | ||
| prev | ||
| ? { | ||
| ...prev, | ||
| sessions: retained | ||
| ? prev.sessions.map((session) => | ||
| session.id === id | ||
| ? { ...session, status: "exited", ready: false } | ||
| : session, | ||
| ) | ||
| : prev.sessions.filter((session) => session.id !== id), | ||
| } | ||
| : prev, | ||
| ); |
There was a problem hiding this comment.
🔴 Concurrent Resume is overwritten by End
When Resume resolves before its lifecycle event, closeSession marks the resumed session exited. The resumed Terminal disappears and selection moves away.
Learn more
A Resume and End can overlap for the same session. resumeSession immediately stores the running Resume response, but the Assistant lifecycle event arrives independently. If the older DELETE resolves during that gap, the lifecycle guard still sees ending and this state update changes the fresh running row back to exited. The following selection fallback then moves away from that session.
Example: End starts for session A. Resume returns a running row for A, but its open Assistant snapshot is delayed. The older End response then marks A exited and selects B, although A has resumed successfully.
Recommended fix: Add a per-session Resume generation or session-status revision fence. Capture it when End starts, and skip both the row update and fallback when a newer Resume or status projection has updated that session.
Was this helpful? React with 👍 or 👎 to provide feedback.
Primary change type
Problem and motivation
Terminal exit can hide End while Assistant is still open. An unsuccessful or late End response can also remove the wrong current state or override newer navigation.
Summary and scope
Keep End available for open or ending Assistant sessions, use the existing confirmation flow with both-engine/history copy, and retain the row and selection after incomplete cleanup. Apply successful updates to current session state, preserving newer Resume and navigation. Dead-pane Close confirms before stopping an active Assistant.
Related work
Related issue: https://linear.app/sapiom/issue/SAP-3292
Depends on #1002. Native stack target: main. Full retained Assistant history rendering and Resume controls follow separately.
Validation
Tests and documentation
Browser cases cover Assistant remaining open after Terminal exit, failed cleanup, unaffected session B, late End versus a newly started session and newer Resume. Three screenshots and exact commands are retained in the workspace handoff. Existing inline React hook suppressions reference an unconfigured plugin; the explicit lint run disables inline config. This is mock HTTP/SSE browser evidence. Incremental size: 430 changed lines including tests; pr:size is absent.
Compatibility and release impact
Security
AI assistance
Checklist
Review evidence
These images show disposable browser fixture states before and after an explicit user action, not a historical pre-implementation baseline. They do not establish native execution or an installed activated release.