Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions executor/src/runtime_work/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,13 @@ impl RuntimeWorkRpcHandler {
.unwrap_or_default();
let messages = local_link
.as_ref()
.map(|link| merge_cached_messages(transcript_messages(thread), cached_messages(link)))
.unwrap_or_else(|| transcript_messages(thread));
.map(|link| {
merge_cached_messages(
transcript_messages(thread, &self.device_id),
cached_messages(link),
)
})
.unwrap_or_else(|| transcript_messages(thread, &self.device_id));
Comment on lines 218 to +226

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Pass the computed workspace fallback into transcript normalization.

workspace_path falls back to the request payload here, but transcript_messages still derives file-change workspace_path only from thread.cwd. If Codex omits cwd, the response has the right workspacePath while per-turn fileChanges get an empty workspace and unrelativized paths.

Proposed fix
-                    transcript_messages(thread, &self.device_id),
+                    transcript_messages(thread, &self.device_id, &workspace_path),
                     cached_messages(link),
                 )
             })
-            .unwrap_or_else(|| transcript_messages(thread, &self.device_id));
+            .unwrap_or_else(|| transcript_messages(thread, &self.device_id, &workspace_path));
-pub(crate) fn transcript_messages(thread: &Value, device_id: &str) -> Vec<Value> {
+pub(crate) fn transcript_messages(
+    thread: &Value,
+    device_id: &str,
+    fallback_workspace_path: &str,
+) -> Vec<Value> {
     let mut messages = Vec::new();
-    let workspace_path = string_field(thread, "cwd").unwrap_or_default();
+    let workspace_path =
+        string_field(thread, "cwd").unwrap_or_else(|| fallback_workspace_path.to_owned());
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
let messages = local_link
.as_ref()
.map(|link| merge_cached_messages(transcript_messages(thread), cached_messages(link)))
.unwrap_or_else(|| transcript_messages(thread));
.map(|link| {
merge_cached_messages(
transcript_messages(thread, &self.device_id),
cached_messages(link),
)
})
.unwrap_or_else(|| transcript_messages(thread, &self.device_id));
let messages = local_link
.as_ref()
.map(|link| {
merge_cached_messages(
transcript_messages(thread, &self.device_id, &workspace_path),
cached_messages(link),
)
})
.unwrap_or_else(|| transcript_messages(thread, &self.device_id, &workspace_path));
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@executor/src/runtime_work/handler.rs` around lines 218 - 226, The transcript
normalization path is still using only thread.cwd for file-change workspace
resolution, while the surrounding logic already computes a workspace fallback
from the request payload/local link. Update the message-building flow around
transcript_messages in handler.rs so the computed workspace_path is passed into
transcript_messages (and used for file-change normalization) instead of relying
solely on thread.cwd, ensuring fileChanges and workspacePath stay consistent
when cwd is missing.


Ok(json!({
"success": true,
Expand Down Expand Up @@ -866,7 +871,7 @@ impl RuntimeWorkRpcHandler {
{
Ok(response) => {
let thread = response.get("thread").unwrap_or(&response);
transcript_messages(thread)
transcript_messages(thread, &self.device_id)
}
Err(error) => {
eprintln!("failed to read Codex app-server thread {thread_id}: {error}");
Expand Down
Loading
Loading