mirror of
https://github.com/openai/codex.git
synced 2026-05-02 04:11:39 +03:00
Preserve null developer instructions (#16976)
Preserve explicit null developer-instruction overrides across app-server resume and fork flows.
This commit is contained in:
@@ -2351,6 +2351,26 @@ impl InitialHistory {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_developer_instructions(&self) -> Option<Option<String>> {
|
||||
match self {
|
||||
InitialHistory::New => None,
|
||||
InitialHistory::Resumed(resumed) => {
|
||||
resumed.history.iter().find_map(|item| match item {
|
||||
RolloutItem::SessionMeta(meta_line) => {
|
||||
meta_line.meta.developer_instructions.clone()
|
||||
}
|
||||
_ => None,
|
||||
})
|
||||
}
|
||||
InitialHistory::Forked(items) => items.iter().find_map(|item| match item {
|
||||
RolloutItem::SessionMeta(meta_line) => {
|
||||
meta_line.meta.developer_instructions.clone()
|
||||
}
|
||||
_ => None,
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_dynamic_tools(&self) -> Option<Vec<DynamicToolSpec>> {
|
||||
match self {
|
||||
InitialHistory::New => None,
|
||||
@@ -2549,6 +2569,13 @@ pub struct SessionMeta {
|
||||
skip_serializing_if = "Option::is_none"
|
||||
)]
|
||||
pub base_instructions: Option<Option<BaseInstructions>>,
|
||||
#[serde(
|
||||
default,
|
||||
deserialize_with = "deserialize_double_option",
|
||||
serialize_with = "serialize_double_option",
|
||||
skip_serializing_if = "Option::is_none"
|
||||
)]
|
||||
pub developer_instructions: Option<Option<String>>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub dynamic_tools: Option<Vec<DynamicToolSpec>>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
@@ -2570,6 +2597,7 @@ impl Default for SessionMeta {
|
||||
agent_path: None,
|
||||
model_provider: None,
|
||||
base_instructions: None,
|
||||
developer_instructions: None,
|
||||
dynamic_tools: None,
|
||||
memory_mode: None,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user