mirror of
https://github.com/openai/codex.git
synced 2026-11-17 14:58:36 +00:00
[codex] Exclude external tool output from memories (#26821)
## Summary - add contains_external_context() to tool output so other tools can be opted out of influencing memory when disable_on_external_context=true - Classify standalone web-search output as external context (to match behavior as hosted web search) - Verify with integration test
This commit is contained in:
1 parent
0526cb56ac
commit
26d9329833
4 files changed
+113
-2
No files matched your search
@@ -28,6 +28,7 @@ use codex_extension_api::ToolCallOutcome;
|
||||
use codex_protocol::models::FunctionCallOutputPayload;
|
||||
use codex_protocol::models::ResponseInputItem;
|
||||
use codex_protocol::protocol::EventMsg;
|
||||
use codex_rollout::state_db;
|
||||
use codex_tools::ToolName;
|
||||
use codex_tools::ToolSearchInfo;
|
||||
use codex_tools::ToolSpec;
|
||||
@@ -696,6 +697,16 @@ async fn handle_any_tool(
|
||||
let call_id = invocation.call_id.clone();
|
||||
let payload = invocation.payload.clone();
|
||||
let output = tool.handle(invocation.clone()).await?;
|
||||
if output.contains_external_context()
|
||||
&& invocation.turn.config.memories.disable_on_external_context
|
||||
{
|
||||
state_db::mark_thread_memory_mode_polluted(
|
||||
invocation.session.services.state_db.as_deref(),
|
||||
invocation.session.thread_id,
|
||||
"tool_output",
|
||||
)
|
||||
.await;
|
||||
}
|
||||
let post_tool_use_payload =
|
||||
CoreToolRuntime::post_tool_use_payload(tool, &invocation, output.as_ref());
|
||||
Ok(AnyToolResult {
|
||||
|
||||
Reference in new issue
Block a user