mirror of
https://github.com/openai/codex.git
synced 2026-10-24 18:18:41 +00:00
## What changed - Add a dedicated contextual fragment for developer instructions that emits the `generic.developer_instructions` content kind. - Use the fragment when adding child-specific developer instructions to a full-history subagent fork, preserving their classification and ensuring they reach the child exactly once without appearing in the parent request. ## Testing - Extend full-history subagent coverage to verify the child-only instructions' annotation, placement, and count. GitOrigin-RevId: 82589d311535225fed76d500a19458fda72f40f2
38 lines
856 B
Rust
38 lines
856 B
Rust
use super::ContextualUserFragment;
|
|
use codex_protocol::models::ContentItemKind;
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
pub(crate) struct DeveloperInstructions {
|
|
instructions: String,
|
|
}
|
|
|
|
impl DeveloperInstructions {
|
|
pub(crate) fn new(instructions: impl Into<String>) -> Self {
|
|
Self {
|
|
instructions: instructions.into(),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl ContextualUserFragment for DeveloperInstructions {
|
|
fn content_kind(&self) -> ContentItemKind {
|
|
ContentItemKind("generic.developer_instructions".to_string())
|
|
}
|
|
|
|
fn role(&self) -> &'static str {
|
|
"developer"
|
|
}
|
|
|
|
fn markers(&self) -> (&'static str, &'static str) {
|
|
Self::type_markers()
|
|
}
|
|
|
|
fn type_markers() -> (&'static str, &'static str) {
|
|
("", "")
|
|
}
|
|
|
|
fn body(&self) -> String {
|
|
self.instructions.clone()
|
|
}
|
|
}
|