Use core API for app-server instruction loading

This commit is contained in:
Adam Perry
2026-06-04 23:18:54 -07:00
parent ffed2cae1c
commit bd8df31483
4 changed files with 19 additions and 31 deletions
+1
View File
@@ -1916,6 +1916,7 @@ dependencies = [
"codex-cloud-config",
"codex-config",
"codex-core",
"codex-core-api",
"codex-core-plugins",
"codex-exec-server",
"codex-extension-api",
+1
View File
@@ -35,6 +35,7 @@ codex-arg0 = { workspace = true }
codex-cloud-config = { workspace = true }
codex-config = { workspace = true }
codex-core = { workspace = true }
codex-core-api = { workspace = true }
codex-core-plugins = { workspace = true }
codex-exec-server = { workspace = true }
codex-extension-api = { workspace = true }
@@ -1,7 +1,6 @@
use codex_core::AgentsMdManager;
use codex_core::ThreadManager;
use codex_core::config::Config;
use codex_protocol::error::CodexErr;
use codex_core_api::load_thread_user_instructions as preload_thread_user_instructions;
use codex_protocol::error::Result as CodexResult;
use codex_protocol::protocol::TurnEnvironmentSelection;
@@ -12,24 +11,10 @@ pub(super) async fn load_thread_user_instructions(
config: &mut Config,
environments: &[TurnEnvironmentSelection],
) -> CodexResult<()> {
let Some(primary_selection) = environments.first() else {
config.user_instructions = None;
return Ok(());
};
let environment = thread_manager
.environment_manager()
.get_environment(&primary_selection.environment_id)
.ok_or_else(|| {
CodexErr::InvalidRequest(format!(
"unknown turn environment id `{}`",
primary_selection.environment_id
))
})?;
let mut warnings = Vec::new();
let user_instructions = AgentsMdManager::new(config)
.load_user_instructions(environment.as_ref(), &mut warnings)
.await;
config.startup_warnings.extend(warnings);
config.user_instructions = user_instructions;
Ok(())
preload_thread_user_instructions(
config,
thread_manager.environment_manager().as_ref(),
environments,
)
.await
}