diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-16 17:57:24 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-16 17:57:52 +0300 |
| commit | ebff34063a55446c7390e12ec84acd2dad04ce43 (patch) | |
| tree | 0ed8f092d418d245fd69ac0d36e21ee1e3ef1a83 /src/terminal | |
| parent | cc802c8f9c154ca23e6a1db095b8857c1d5f1fe9 (diff) | |
fix: restore omp sessions after same-pane restart
refs #614
Diffstat (limited to 'src/terminal')
| -rw-r--r-- | src/terminal/state.rs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/terminal/state.rs b/src/terminal/state.rs index 9b9b6d43..07e84354 100644 --- a/src/terminal/state.rs +++ b/src/terminal/state.rs @@ -1493,6 +1493,52 @@ mod tests { assert_eq!(terminal.state, AgentState::Working); } + // omp has no Agent identity (the process is pi), so its release suppression + // can only be cleared by a fresh session ref, never by process detection. + // Regression for #614: a same-pane restart must reacquire lifecycle authority. + #[test] + fn omp_reacquires_full_lifecycle_hook_after_release_with_fresh_session_ref() { + let mut terminal = test_terminal(); + terminal.set_hook_authority_with_session_ref( + "herdr:omp".into(), + "omp".into(), + AgentState::Working, + None, + None, + crate::agent_resume::AgentSessionRef::id("omp-old"), + Some(20), + ); + terminal.release_agent("herdr:omp", "omp", Some(21)); + + // A late report from the released run keeps its old session ref and stays + // suppressed, so a just-exited omp cannot resurrect the pane. + let stale = terminal.set_hook_authority_with_session_ref( + "herdr:omp".into(), + "omp".into(), + AgentState::Working, + None, + None, + crate::agent_resume::AgentSessionRef::id("omp-old"), + Some(22), + ); + assert!(stale.is_none()); + assert!(terminal.hook_authority.is_none()); + + // A fresh omp run carries a new session ref and reacquires authority. + let fresh = terminal.set_hook_authority_with_session_ref( + "herdr:omp".into(), + "omp".into(), + AgentState::Working, + None, + None, + crate::agent_resume::AgentSessionRef::id("omp-new"), + Some(23), + ); + assert!(fresh.is_some()); + assert!(terminal.hook_authority.is_some()); + assert_eq!(terminal.state, AgentState::Working); + } + #[test] fn visible_blocker_overrides_non_blocked_hook_for_same_agent() { let mut terminal = test_terminal(); |
