Use installed callable apps for TUI mentions (#39051)

## Why

The app directory is a discovery catalog and can include apps that are not
callable in the active thread. Using it for `$` suggestions can therefore
offer mentions that cannot be used.

## What changed

- Load mention candidates from `app/installed`, enrich callable apps through
  bounded `app/read` batches, and retain compatibility with app servers that
  do not support `app/installed`.
- Keep the mention catalog separate from the `/apps` directory cache and scope
  results to the current thread, workspace, and account.
- Refresh mentions after app notifications, enablement changes, configuration
  updates, and apps MCP readiness, while immediately removing disabled apps.

## Testing

Add coverage for batching and fallback behavior, stale scoped results,
notification refreshes, enablement changes, MCP startup races, and filtering
non-callable apps from mentions.

GitOrigin-RevId: 4d9e20794aed30cc97120170792fb555b86fe1e7
This commit is contained in:
Charlie Marsh
2026-08-17 19:11:34 +00:00
committed by copyberry
parent d7d526b81d
commit fe5889928c
17 changed files with 759 additions and 116 deletions
+13 -3
View File
@@ -953,11 +953,21 @@ impl ChatWidget {
}
fn plugin_install_auth_app_is_installed(&self, app_id: &str) -> bool {
self.connectors_for_mentions().is_some_and(|connectors| {
connectors
if !self.connectors_enabled() {
return false;
}
let connectors = &self.connectors;
connectors.installed_app_ids.contains(app_id)
|| connectors
.partial_snapshot
.iter()
.chain(match &connectors.cache {
super::connectors::ConnectorsCacheState::Ready(snapshot) => Some(snapshot),
_ => None,
})
.flat_map(|snapshot| &snapshot.connectors)
.any(|connector| connector.id == app_id && connector.is_accessible)
})
}
fn finish_plugin_install_auth_flow(&mut self, abandoned: bool) {