(
coordinator: State<'_, Arc<ConversationCoordinator>>,
app_state: State<'_, AppState>,
startup_trace: State<'_, DesktopStartupTrace>,
request: RestoreSessionRequest,
)
| 1761 | |
| 1762 | #[tauri::command] |
| 1763 | pub async fn restore_session_view( |
| 1764 | coordinator: State<'_, Arc<ConversationCoordinator>>, |
| 1765 | app_state: State<'_, AppState>, |
| 1766 | startup_trace: State<'_, DesktopStartupTrace>, |
| 1767 | request: RestoreSessionRequest, |
| 1768 | ) -> Result<RestoreSessionViewResponse, String> { |
| 1769 | let started_at = Instant::now(); |
| 1770 | let result = async { |
| 1771 | let trace_id = request.trace_id.as_deref().unwrap_or("none"); |
| 1772 | debug!( |
| 1773 | "restore_session_view request received: trace_id={}, session_id={}", |
| 1774 | trace_id, request.session_id |
| 1775 | ); |
| 1776 | let path_started_at = Instant::now(); |
| 1777 | let effective_path = desktop_effective_session_storage_path( |
| 1778 | &app_state, |
| 1779 | &request.workspace_path, |
| 1780 | request.remote_connection_id.as_deref(), |
| 1781 | request.remote_ssh_host.as_deref(), |
| 1782 | ) |
| 1783 | .await; |
| 1784 | let resolve_storage_path_duration_ms = |
| 1785 | path_started_at.elapsed().as_millis().min(u64::MAX as u128) as u64; |
| 1786 | debug!( |
| 1787 | "restore_session_view storage path resolved: trace_id={}, session_id={}, duration_ms={}", |
| 1788 | trace_id, |
| 1789 | request.session_id, |
| 1790 | resolve_storage_path_duration_ms |
| 1791 | ); |
| 1792 | |
| 1793 | let session_storage_path = effective_path; |
| 1794 | let tail_turn_count = request |
| 1795 | .tail_turn_count |
| 1796 | .filter(|count| *count > 0) |
| 1797 | .map(|count| count.min(16)); |
| 1798 | let (session, mut turns, total_turn_count, mut timings) = |
| 1799 | if let Some(tail_turn_count) = tail_turn_count { |
| 1800 | if request.include_internal { |
| 1801 | coordinator |
| 1802 | .restore_internal_session_view_from_storage_path_tail_timed( |
| 1803 | &session_storage_path, |
| 1804 | &request.session_id, |
| 1805 | tail_turn_count, |
| 1806 | ) |
| 1807 | .await |
| 1808 | } else { |
| 1809 | coordinator |
| 1810 | .restore_session_view_from_storage_path_tail_timed( |
| 1811 | &session_storage_path, |
| 1812 | &request.session_id, |
| 1813 | tail_turn_count, |
| 1814 | ) |
| 1815 | .await |
| 1816 | } |
| 1817 | } else if request.include_internal { |
| 1818 | coordinator |
| 1819 | .restore_internal_session_view_from_storage_path_timed( |
| 1820 | &session_storage_path, |
nothing calls this directly
no test coverage detected