Skip to content

fix(cloud): show cloud run file content from session events instead of local file system#1686

Merged
VojtechBartos merged 4 commits intomainfrom
vojta/file-link
Apr 16, 2026
Merged

fix(cloud): show cloud run file content from session events instead of local file system#1686
VojtechBartos merged 4 commits intomainfrom
vojta/file-link

Conversation

@VojtechBartos
Copy link
Copy Markdown
Member

Problem

When clicking a file link in an agent message during a cloud run, users see "Failed to load file." This happens because the app tries to read the file from the local filesystem (e.g., /tmp/workspace/repos/.../src/App.js), but that path only exists on the remote cloud sandbox — there's no local copy.

Solution

For cloud runs, extract file content from the session events instead of the local filesystem. The agent's tool call results already contain file content: read tool calls embed the file text, and write/edit tool calls include newText in their diffs.

Showcase

code-filelink.mov

@VojtechBartos VojtechBartos self-assigned this Apr 16, 2026
if (!enabled || !events) {
return { content: null, touched: false, isLoading };
}
const summary = buildCloudEventSummary(events);
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.

can we make this more efficient? users might have multiple tabs during active cloud runs, maybe we can have some hook there

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

created share hook for the cloud event summary

* Combines read tool results and write/edit diffs to reconstruct the latest
* known content for a file from a cloud session's tool calls.
*/
export function extractCloudFileContent(
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.

if the agent renames or moves a file how would this work? I guess we would end up in a broken state?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

ups, add handle for it

@VojtechBartos VojtechBartos merged commit 94888c4 into main Apr 16, 2026
15 checks passed
@VojtechBartos VojtechBartos deleted the vojta/file-link branch April 16, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants