Use thread configuration for app/read (#37891)

## What changed

- Add an optional `threadId` parameter to `app/read`.
- When provided, load the thread's effective configuration before applying app feature gating, workspace policy, and plugin attribution.
- Share the thread-aware configuration loader with `app/list`.

## Testing

- Add coverage showing that `app/read` honors a thread-level connector feature override.

GitOrigin-RevId: 161e910a2d7435ecf4acd0ba9f5f5069d1631f12
This commit is contained in:
Matthew Zeng authored and copyberry committed 2026-08-10 22:39:29 +00:00
1 parent 9742cc8ed5
commit 7f928f6ddc
15 files changed
+138 -23

No files matched your search

@@ -49,7 +49,7 @@ impl AppsRequestProcessor {
let mut snapshot_tool_count = 0;
let result = async {
let config = self
.load_apps_installed_config(params.thread_id.as_deref())
.load_apps_config(params.thread_id.as_deref())
.await?;
let auth = self.auth_manager.auth().await;
let apps_enabled = config
@@ -200,21 +200,6 @@ impl AppsRequestProcessor {
}
result
}
async fn load_apps_installed_config(
&self,
thread_id: Option<&str>,
) -> Result<Config, JSONRPCErrorError> {
let Some(thread_id) = thread_id else {
return self.load_latest_config(/*fallback_cwd*/ None).await;
};
let (_, thread) = self.load_thread(thread_id).await?;
let thread_config = thread.config().await;
self.config_manager
.load_latest_config_for_thread(thread_config.as_ref())
.await
.map_err(|err| internal_error(format!("failed to reload config: {err}")))
}
}
fn connector_runtime_tool(tool: &ToolInfo) -> ConnectorRuntimeTool<'_> {
@@ -12,6 +12,7 @@ impl AppsRequestProcessor {
let started_at = Instant::now();
let AppsReadParams {
app_ids,
thread_id,
include_tools,
} = params;
if app_ids.len() > APP_READ_MAX_IDS {
@@ -25,7 +26,7 @@ impl AppsRequestProcessor {
.into_iter()
.filter(|app_id| seen_app_ids.insert(app_id.clone()))
.collect::<Vec<_>>();
let config = self.load_latest_config(/*fallback_cwd*/ None).await?;
let config = self.load_apps_config(thread_id.as_deref()).await?;
let auth = self.auth_manager.auth().await;
if !config
.features