mirror of
https://github.com/openai/codex.git
synced 2026-09-14 11:57:03 +00:00
R3
This commit is contained in:
@@ -860,7 +860,7 @@ impl Session {
|
||||
exec_command_context: ExecCommandContext,
|
||||
) {
|
||||
// Ensure core pre-tool readiness (e.g., ghost snapshot) before the first tool call.
|
||||
self.ensure_pretool_ready().await;
|
||||
self.await_pretool_ready().await;
|
||||
let ExecCommandContext {
|
||||
sub_id,
|
||||
call_id,
|
||||
|
||||
@@ -22,7 +22,7 @@ pub(crate) async fn handle_mcp_tool_call(
|
||||
arguments: String,
|
||||
) -> ResponseInputItem {
|
||||
// Ensure core pre-tool readiness (e.g., ghost snapshot) before the first tool call.
|
||||
sess.ensure_pretool_ready().await;
|
||||
sess.await_pretool_ready().await;
|
||||
// Parse the `arguments` as JSON. An empty string is OK, but invalid JSON
|
||||
// is not.
|
||||
let arguments_value = if arguments.trim().is_empty() {
|
||||
|
||||
@@ -42,7 +42,7 @@ impl Session {
|
||||
let cwd = turn_context.cwd.clone();
|
||||
let sess = Arc::clone(self);
|
||||
// Capture the readiness flag and token so we can always mark readiness,
|
||||
// avoiding races with locks held by ensure_pretool_ready().
|
||||
// avoiding races with locks held by await_pretool_ready().
|
||||
let ready_flag = Arc::clone(&flag);
|
||||
let ready_token = token;
|
||||
tokio::spawn(async move {
|
||||
@@ -87,7 +87,7 @@ impl Session {
|
||||
}
|
||||
|
||||
/// Await pre-tool readiness (ghost snapshot) once. Subsequent calls resolve immediately.
|
||||
pub async fn ensure_pretool_ready(&self) {
|
||||
pub async fn await_pretool_ready(&self) {
|
||||
let flag_opt = {
|
||||
let active = self.active_turn.lock().await;
|
||||
match active.as_ref() {
|
||||
|
||||
Reference in New Issue
Block a user