fix(tui): ignore stale github pr lookup state

Leave the current GitHub PR pending flag untouched when an async lookup
result arrives for an old cwd. This prevents late stale events from
allowing duplicate lookups for the active status surface cwd.
This commit is contained in:
Felipe Coury
2026-04-11 14:13:31 -03:00
parent 426304645a
commit bd31ba8e4f
2 changed files with 11 additions and 1 deletions
-1
View File
@@ -1935,7 +1935,6 @@ impl ChatWidget {
pull_request: Option<GithubPullRequest>,
) {
if self.status_line_github_pr_cwd.as_ref() != Some(&cwd) {
self.status_line_github_pr_pending = false;
return;
}
self.status_line_github_pr = pull_request;
@@ -948,6 +948,17 @@ async fn github_pr_state_resets_when_no_surface_uses_it() {
assert!(!chat.status_line_github_pr_lookup_complete);
}
#[tokio::test]
async fn stale_github_pr_update_preserves_current_pending_lookup() {
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
chat.status_line_github_pr_cwd = Some(PathBuf::from("/repo/current"));
chat.status_line_github_pr_pending = true;
chat.set_status_line_github_pr(PathBuf::from("/repo/old"), None);
assert!(chat.status_line_github_pr_pending);
}
#[tokio::test]
async fn status_line_branch_refreshes_after_turn_complete() {
let (mut chat, _rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;