Skip to content

Conversation

@jakubno
Copy link
Member

@jakubno jakubno commented Dec 31, 2025

Absolute paths inside the workdir are resolved to ./<path-inside-workdir> and saved to the tar, but passed to the backed still as absolute path. But backend doesn't know about the SDK workdir, so it's unable to resolve the path correctly


Note

Fixes incorrect handling of absolute paths across JS and Python template builders.

  • Introduces relativizePath/relativize_path to normalize absolute COPY args while preserving original filePath for hashing and upload
  • Extends Instruction with filePath; hashing (calculateFilesHash) and logging now use it; glob/cwd logic updated to support absolute patterns
  • JS: replaces tar usage with modern-tar + gzip streaming; uploadFile renamed param to filePath; deps updated (modern-tar added, tar moved to dev)
  • Python: mirrors path handling changes and uses filePath for upload/hashing in async/sync flows
  • Adds JS and Python tests covering absolute path copies and resolves symlink behavior

Written by Cursor Bugbot for commit e2096cf. This will update automatically on new commits. Configure here.

@changeset-bot
Copy link

changeset-bot bot commented Dec 31, 2025

⚠️ No Changeset found

Latest commit: e2096cf

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@mishushakov mishushakov marked this pull request as ready for review January 2, 2026 21:50
@mishushakov
Copy link
Member

@cursor bugbot review

@cursor

This comment was marked as outdated.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 77abafaaa1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

const dirFiles = await glob(dirPattern, {
ignore: ignorePatterns,
withFileTypes: true,
// dirPattern is always relative (constructed from file.relative()), so use contextPath
Copy link

Choose a reason for hiding this comment

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

Nested directory glob uses wrong cwd for absolute paths

When src is an absolute path, the first glob at line 59 uses cwd: undefined (defaulting to process.cwd()), causing file.relative() to return paths relative to process.cwd(). However, the nested directory glob at lines 74-79 always uses cwd: contextPath. This mismatch means when copying an absolute directory path, the dirPattern (relative to process.cwd()) is incorrectly interpreted relative to contextPath, causing the nested glob to search in the wrong location. The Python SDK correctly uses the same root_dir logic for both globs. This breaks hash calculation and tar creation for absolute directory paths.

Additional Locations (1)

Fix in Cursor Fix in Web

...instruction,
filesHash: await calculateFilesHash(
src,
instruction.filePath.toString(),
Copy link

Choose a reason for hiding this comment

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

JS sends unfiltered filePath to backend, Python doesn't

The JS serialize method passes the entire steps array directly to the API, including the new filePath field which contains the original absolute path and is of type PathLike (could be Buffer/URL). In contrast, Python's _serialize explicitly constructs new step objects with only type, args, force, filesHash, and forceUpload fields, filtering out filePath and resolveSymlinks. This inconsistency means the JS SDK sends potentially sensitive path information and non-string PathLike objects to the backend that the Python SDK properly excludes.

Fix in Cursor Fix in Web

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.

3 participants