Skip to content

fix: resolve relative file paths in CLI before sending to daemon#667

Open
juliobrasa wants to merge 1 commit intovercel-labs:mainfrom
juliobrasa:fix/resolve-relative-paths
Open

fix: resolve relative file paths in CLI before sending to daemon#667
juliobrasa wants to merge 1 commit intovercel-labs:mainfrom
juliobrasa:fix/resolve-relative-paths

Conversation

@juliobrasa
Copy link

Summary

  • Adds resolve_path() helper that converts relative paths to absolute using the CLI's CWD
  • Applies to all path-taking commands: screenshot, pdf, download, upload, trace stop, record start/restart, state save/load
  • Prevents files from being saved to the daemon's working directory instead of the user's CWD

Problem

When using commands like agent-browser screenshot ./page.png, the relative path ./page.png was resolved against the daemon's working directory (wherever it was spawned from) instead of the user's current directory. This caused files to appear in unexpected locations.

Test plan

  • cargo check passes
  • Updated existing tests to verify paths are resolved to absolute
  • Added new tests: absolute path passthrough, pdf path resolution, upload paths resolution

Fixes #137

🤖 Generated with Claude Code

When commands like screenshot, pdf, upload, download, trace, record,
and state accept file paths, relative paths were resolved against the
daemon's working directory instead of the CLI's CWD. This caused files
to be saved/read from unexpected locations.

Add resolve_path() helper that converts relative paths to absolute
paths using the CLI's current working directory before sending them
to the daemon process.

Fixes vercel-labs#137

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link
Contributor

vercel bot commented Mar 6, 2026

Someone is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

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

Additional Suggestions:

  1. The waitfordownload and profiler stop commands send relative file paths to the daemon without resolving them to absolute paths, unlike all other path-taking commands in the PR.
  1. Tests for recording_start, recording_restart, trace_stop, and download commands assert against raw relative paths but the code now applies resolve_path() which converts them to absolute paths, causing test failures.

Fix on Vercel

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.

Bug: Relative file paths resolve to daemon's working directory, not CLI's

1 participant