mirror of
https://github.com/openai/codex.git
synced 2026-11-24 23:20:47 +00:00
Enforce required environment skills before model inference (#51157)
## What changed - Accept per-environment `skills.required` lists through `environment/add` and `environments.toml`. - Before inference, require each named skill to be enabled and supplied by the selected environment. Missing skills fail the turn before a model request, including when environment setup fails. - Stop applying an environment's requirements after it is deselected. Exempt isolated Guardian reviewers, which have no skill catalog. ## Testing Add tests for available, missing, disabled, and wrong-environment skills, failed environment setup, recovery after deselection, and propagation of TOML requirements to the correct environment. GitOrigin-RevId: 302ced4774697d2f414f745fe0535e71f747eda2
This commit is contained in:
committed by
copyberry
parent
c9253c4977
commit
42312d4ff4
@@ -115,6 +115,7 @@ use codex_skills::collect_explicit_skill_mentions;
|
||||
use codex_skills::tool_kind_for_path;
|
||||
use codex_skills_extension::HostSkillPrompts;
|
||||
use codex_skills_extension::InjectedHostSkillPrompts;
|
||||
use codex_skills_extension::validate_required_skills;
|
||||
use codex_thread_store::PersistContext;
|
||||
use codex_tools::DiscoverableTool;
|
||||
use codex_tools::ToolName;
|
||||
@@ -508,6 +509,16 @@ pub(crate) async fn run_turn(
|
||||
.record_step_world_state_if_changed(step_context.as_ref())
|
||||
.await?;
|
||||
|
||||
// Isolated Guardian reviewers deliberately have no skill catalog.
|
||||
if !crate::guardian::is_basic_session_source(&turn_context.session_source) {
|
||||
validate_required_skills(
|
||||
&sess.services.thread_extension_data,
|
||||
&turn_context.extension_data,
|
||||
step_context.environments.required_skills(),
|
||||
)
|
||||
.map_err(CodexErr::Fatal)?;
|
||||
}
|
||||
|
||||
// Keep the override after accepted input so history truncation removes them together.
|
||||
sess.record_reasoning_effort_override(step_context.as_ref())
|
||||
.await;
|
||||
|
||||
Reference in New Issue
Block a user