Avoid model lookups for thread metadata and goal updates (#63655)

## Why

A slow model lookup can delay thread metadata reads and goal updates even
though both operations have the settings and data they need locally.

## What changed

Use locally configured settings for app-server thread reads, enrichment,
and direct-input checks. The effective configuration snapshot still
validates the service tier against the selected model.

Record goal updates and emit their raw response events using an internal
submission ID without constructing a turn context.

## Testing

Add a regression test that gates model lookup and checks that the local
snapshot and goal recording complete without requesting model info. It
also checks that the goal event matches the history item and that the
effective snapshot filters out an unsupported service tier.

GitOrigin-RevId: 7d008edd775ae459a1fd1e3db79f38f2d9b5ca30
This commit is contained in:
Charlie Marsh
2026-11-24 14:52:00 +00:00
committed by copyberry
parent 53fe98bdc2
commit 3e6daebb48
7 changed files with 84 additions and 20 deletions
@@ -55,7 +55,7 @@ async fn enrich_loaded_thread(
let Ok(loaded_thread) = thread_manager.get_thread(thread_id).await else {
return;
};
let config_snapshot = loaded_thread.config_snapshot().await;
let config_snapshot = loaded_thread.configured_snapshot().await;
apply_live_thread_settings(thread, &loaded_thread, &config_snapshot);
if !matches!(
&thread.source,
@@ -23,7 +23,7 @@ pub(super) fn can_accept_direct_input(
pub(super) async fn ensure_direct_input_allowed(
thread: &CodexThread,
) -> Result<(), JSONRPCErrorError> {
let config_snapshot = thread.config_snapshot().await;
let config_snapshot = thread.configured_snapshot().await;
if !can_accept_direct_input(
thread.multi_agent_version(),
&config_snapshot.session_source,
@@ -3396,7 +3396,7 @@ impl ThreadRequestProcessor {
let persisted = self
.load_persisted_thread_for_read(thread_id, /*include_turns*/ false)
.await?;
let config_snapshot = loaded_thread.config_snapshot().await;
let config_snapshot = loaded_thread.configured_snapshot().await;
if include_turns && config_snapshot.ephemeral {
return Err(ThreadReadViewError::InvalidRequest(
"ephemeral threads do not support includeTurns".to_string(),