mirror of
https://github.com/openai/codex.git
synced 2026-09-14 11:57:03 +00:00
fix tests
This commit is contained in:
@@ -484,10 +484,6 @@ impl McpProcess {
|
||||
method: &str,
|
||||
params: Option<serde_json::Value>,
|
||||
) -> anyhow::Result<i64> {
|
||||
// Drop any stale notifications from previous requests so callers don't
|
||||
// accidentally consume old events when waiting for the next response.
|
||||
self.pending_notifications.clear();
|
||||
|
||||
let request_id = self.next_request_id.fetch_add(1, Ordering::Relaxed);
|
||||
|
||||
let message = JSONRPCMessage::Request(JSONRPCRequest {
|
||||
@@ -499,6 +495,14 @@ impl McpProcess {
|
||||
Ok(request_id)
|
||||
}
|
||||
|
||||
/// Clear any queued notifications.
|
||||
///
|
||||
/// Tests can call this between turns when they want to guarantee that the
|
||||
/// next read_* call sees only events from the new turn.
|
||||
pub fn clear_pending_notifications(&mut self) {
|
||||
self.pending_notifications.clear();
|
||||
}
|
||||
|
||||
pub async fn send_response(
|
||||
&mut self,
|
||||
id: RequestId,
|
||||
|
||||
@@ -553,6 +553,10 @@ async fn turn_start_updates_sandbox_and_cwd_between_turns_v2() -> Result<()> {
|
||||
)
|
||||
.await??;
|
||||
|
||||
// Drop any leftover notifications from the first turn before we wait for
|
||||
// events from the second turn.
|
||||
mcp.clear_pending_notifications();
|
||||
|
||||
// second turn with workspace-write and second_cwd, ensure exec begins in second_cwd
|
||||
let second_turn = mcp
|
||||
.send_turn_start_request(TurnStartParams {
|
||||
|
||||
Reference in New Issue
Block a user