mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Spread AbsolutePathBuf (#17792)
Mechanical change to promote absolute paths through code.
This commit is contained in:
1 parent
dae56994da
commit
dd1321d11b
166 files changed
+1638
-1214
No files matched your search
@@ -42,8 +42,6 @@ use std::sync::atomic::Ordering;
|
||||
use std::time::Duration;
|
||||
use std::time::Instant;
|
||||
|
||||
use url::Url;
|
||||
|
||||
use self::realtime::PendingSteerCompareKey;
|
||||
use crate::app_command::AppCommand;
|
||||
use crate::app_event::RealtimeAudioDeviceKind;
|
||||
@@ -942,7 +940,7 @@ pub(crate) struct ChatWidget {
|
||||
// Current working directory (if known)
|
||||
current_cwd: Option<PathBuf>,
|
||||
// Instruction source files loaded for the current session, supplied by app-server.
|
||||
instruction_source_paths: Vec<PathBuf>,
|
||||
instruction_source_paths: Vec<AbsolutePathBuf>,
|
||||
// Runtime network proxy bind addresses from SessionConfigured.
|
||||
session_network_proxy: Option<codex_protocol::protocol::SessionNetworkProxyRuntime>,
|
||||
// Shared latch so we only warn once about invalid status-line item IDs.
|
||||
@@ -1370,6 +1368,7 @@ fn app_server_request_id_to_mcp_request_id(
|
||||
|
||||
fn exec_approval_request_from_params(
|
||||
params: CommandExecutionRequestApprovalParams,
|
||||
fallback_cwd: &AbsolutePathBuf,
|
||||
) -> ExecApprovalRequestEvent {
|
||||
ExecApprovalRequestEvent {
|
||||
call_id: params.item_id,
|
||||
@@ -1378,7 +1377,7 @@ fn exec_approval_request_from_params(
|
||||
.as_deref()
|
||||
.map(split_command_string)
|
||||
.unwrap_or_default(),
|
||||
cwd: params.cwd.unwrap_or_default(),
|
||||
cwd: params.cwd.unwrap_or_else(|| fallback_cwd.clone()),
|
||||
reason: params.reason,
|
||||
network_approval_context: params
|
||||
.network_approval_context
|
||||
@@ -1972,13 +1971,8 @@ impl ChatWidget {
|
||||
self.thread_name = event.thread_name.clone();
|
||||
self.forked_from = event.forked_from_id;
|
||||
self.current_rollout_path = event.rollout_path.clone();
|
||||
self.current_cwd = Some(event.cwd.clone());
|
||||
match AbsolutePathBuf::try_from(event.cwd.clone()) {
|
||||
Ok(cwd) => self.config.cwd = cwd,
|
||||
Err(err) => {
|
||||
tracing::warn!(path = %event.cwd.display(), %err, "session cwd should be absolute");
|
||||
}
|
||||
}
|
||||
self.current_cwd = Some(event.cwd.to_path_buf());
|
||||
self.config.cwd = event.cwd.clone();
|
||||
if let Err(err) = self
|
||||
.config
|
||||
.permissions
|
||||
@@ -3629,15 +3623,10 @@ impl ChatWidget {
|
||||
|
||||
fn on_image_generation_end(&mut self, event: ImageGenerationEndEvent) {
|
||||
self.flush_answer_stream_with_separator();
|
||||
let saved_path = event.saved_path.map(|saved_path| {
|
||||
Url::from_file_path(Path::new(&saved_path))
|
||||
.map(|url| url.to_string())
|
||||
.unwrap_or(saved_path)
|
||||
});
|
||||
self.add_to_history(history_cell::new_image_generation_call(
|
||||
event.call_id,
|
||||
event.revised_prompt,
|
||||
saved_path,
|
||||
event.saved_path,
|
||||
));
|
||||
self.request_redraw();
|
||||
}
|
||||
@@ -4535,7 +4524,7 @@ impl ChatWidget {
|
||||
id: ev.call_id,
|
||||
reason: ev.reason,
|
||||
changes: ev.changes.clone(),
|
||||
cwd: self.config.cwd.to_path_buf(),
|
||||
cwd: self.config.cwd.clone(),
|
||||
};
|
||||
self.bottom_pane
|
||||
.push_approval_request(request, &self.config.features);
|
||||
@@ -5920,10 +5909,7 @@ impl ChatWidget {
|
||||
});
|
||||
}
|
||||
ThreadItem::ImageView { id, path } => {
|
||||
self.on_view_image_tool_call(ViewImageToolCallEvent {
|
||||
call_id: id,
|
||||
path: path.into(),
|
||||
});
|
||||
self.on_view_image_tool_call(ViewImageToolCallEvent { call_id: id, path });
|
||||
}
|
||||
ThreadItem::ImageGeneration {
|
||||
id,
|
||||
@@ -5989,7 +5975,11 @@ impl ChatWidget {
|
||||
let id = request.id().to_string();
|
||||
match request {
|
||||
ServerRequest::CommandExecutionRequestApproval { params, .. } => {
|
||||
self.on_exec_approval_request(id, exec_approval_request_from_params(params));
|
||||
let fallback_cwd = self.config.cwd.clone();
|
||||
self.on_exec_approval_request(
|
||||
id,
|
||||
exec_approval_request_from_params(params, &fallback_cwd),
|
||||
);
|
||||
}
|
||||
ServerRequest::FileChangeRequestApproval { params, .. } => {
|
||||
self.on_apply_patch_approval_request(
|
||||
|
||||
Reference in new issue
Block a user