mirror of
https://github.com/openai/codex.git
synced 2026-11-20 22:40:37 +00:00
Force executor capability rescans after V2 cache invalidation (#62675)
## Why Invalidating Codex's discovery cache could still return stale inventory if the executor reused its cached snapshot before its file watcher reported a change. ## What changed Add an optional `forceReload` flag to `capabilities/discoverV2` that makes the executor rescan its files. Codex sends it on the next lookup of each invalidated context. Explicit reloads also replace the matching cache entry so subsequent ordinary requests can reuse the fresh result. ## Testing Add coverage for discovering a newly added skill before the watcher runs, forwarding the reload flag after invalidation, and reusing refreshed results. GitOrigin-RevId: c98f2b8d4772e10b74ff09dd382ad8386857158f
This commit is contained in:
committed by
copyberry
parent
ffa05c8bfb
commit
15c5444e87
@@ -39,6 +39,9 @@ pub struct DiscoverV2CapabilitiesRequest {
|
||||
pub cwd: PathUri,
|
||||
#[serde(default)]
|
||||
pub sandbox: Option<FileSystemSandboxContext>,
|
||||
/// Rescan the executor's files even if its watcher has not reported a change.
|
||||
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
|
||||
pub force_reload: bool,
|
||||
}
|
||||
|
||||
/// Discovered metadata before caller policy is applied.
|
||||
|
||||
@@ -7,14 +7,26 @@ use pretty_assertions::assert_eq;
|
||||
#[test]
|
||||
fn discovery_contract_round_trips_json() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let request = DiscoverV2CapabilitiesRequest {
|
||||
force_reload: false,
|
||||
cwd: PathUri::parse("file:///workspace")?,
|
||||
sandbox: None,
|
||||
};
|
||||
let wire = serde_json::to_value(&request)?;
|
||||
assert!(wire.get("forceReload").is_none());
|
||||
assert_eq!(
|
||||
serde_json::from_value::<DiscoverV2CapabilitiesRequest>(wire)?,
|
||||
request
|
||||
);
|
||||
let refreshed = DiscoverV2CapabilitiesRequest {
|
||||
force_reload: true,
|
||||
..request
|
||||
};
|
||||
let wire = serde_json::to_value(&refreshed)?;
|
||||
assert_eq!(wire["forceReload"], true);
|
||||
assert_eq!(
|
||||
serde_json::from_value::<DiscoverV2CapabilitiesRequest>(wire)?,
|
||||
refreshed
|
||||
);
|
||||
let text_file = CapabilityTextFile {
|
||||
path: PathUri::parse("file:///plugin/config.json")?,
|
||||
contents: "{}".to_string(),
|
||||
|
||||
Reference in New Issue
Block a user