Scope TUI app directory state to the active context (#38743)

## Why

App directory data and in-flight requests can outlive the account, workspace, or thread that produced them, allowing stale apps to appear in the current TUI context.

## What changed

- Invalidate cached app data, dismiss the app picker, and start a fresh fetch when the account, workspace, or thread changes.
- Tag app directory fetches with their originating thread, workspace, and scope generation, and ignore queued requests or results that no longer match.
- Treat `AppListUpdated` notifications as revalidation signals instead of directly adopting their unscoped contents, with deduplication and a bounded error retry.

## Testing

Added coverage for stale request and result rejection, context invalidation, picker dismissal, and notification revalidation.

GitOrigin-RevId: f20930a0598a6abbdfb3c7826ec955346fe2da7a
This commit is contained in:
Charlie Marsh authored and copyberry committed 2026-08-15 10:57:15 +00:00
1 parent 85fc4def35
commit 3c7ae4a812
13 files changed
+505 -28

No files matched your search

+1
View File
@@ -336,6 +336,7 @@ use crate::tui::FrameRequester;
mod command_lifecycle;
mod connectors;
mod constructor;
pub(crate) use self::connectors::ConnectorScopeGeneration;
use self::connectors::ConnectorsState;
mod exec_state;
use self::exec_state::RunningCommand;