Skip to content

fix(cursor): write workspace trust where cursor-agent reads it - #38807

Merged
Jinwoo-H merged 2 commits into
stablyai:mainfrom
Jackylee1992:fix/cursor-trust-slug
Nov 7, 2026
Merged

Jinwoo-H merged 2 commits into
stablyai:mainfrom
Jackylee1992:fix/cursor-trust-slug

Conversation

@Jackylee1992

Copy link
Copy Markdown
Contributor

ELI5

Before starting Cursor in a new worktree, Orca leaves a "this folder is trusted" note where Cursor looks for it. Orca spelled the folder name slightly differently from Cursor, so Cursor never found the note and kept asking the user to trust the folder.

What Changed

cursorWorkspaceSlug now builds the ~/.cursor/projects/<name> directory with the same rule cursor-agent uses: every character that is not a letter or digit becomes -, repeated dashes collapse, and leading/trailing dashes are trimmed.

Before: a worktree at /Users/me/orca/workspaces/my_repo/feature got its marker in Users-me-orca-workspaces-my_repo-feature, cursor-agent looked in Users-me-orca-workspaces-my-repo-feature, and the trust menu appeared on every fresh launch.
After: Orca writes to the directory cursor-agent reads, so the menu is skipped as intended.

Why

The old rule only replaced characters that are illegal in Windows file names, which matches Cursor only for paths made of letters, digits, -, and separators. The new rule is copied from cursor-agent 2026.11.05 (utils/dist/workspace-paths.js, the function behind ~/.cursor/projects/<slug>), so the two can't drift for _, ., spaces, @, or non-ASCII names.

Linked Issue

Fixes #38806

Visual Proof

N/A — no UI change; the fix only changes which directory receives an existing trust marker. Evidence from a real worktree on macOS before the fix (~/.cursor/projects/):

...-my_repo-feature/.workspace-trusted   written by Orca at launch, never read
...-my-repo-feature/.workspace-trusted   written by cursor-agent 12s later, after clicking "Trust"

Testing

  • Verified the expected directory name by running cursor-agent 2026.11.05's own slug function on the test path and on a real worktree path; both match the new output.

  • Added a test that writes the marker for /orca-missing/My_Repo/feature--1.2 and expects orca-missing-My-Repo-feature-1-2; it fails on main (orca-missing-My_Repo-feature--1.2).

  • pnpm test:node src/main/agent-launch/trust/agent-trust-presets.test.ts: 15 passed, 1 skipped (pre-existing Windows-only case).

  • pnpm check:changed on macOS: all static checks passed; the related unit-test step reported 12,153 passing tests and 7 failing files, each traced to the local environment rather than the slug change:

    • 6 tests/e2e/cross-version-wire/* files failed with Lock file is already being held under parallel workers (plus one worker SIGKILL in plugin-appearance.test.ts); all pass when rerun with --maxWorkers=1.
    • runtime-git-stage-worktree-scope.test.ts failed because my global git excludes file ignores .gitignore, so its fixture commit was empty; it passes with GIT_CONFIG_GLOBAL=/dev/null.
  • Platforms: macOS only. Windows uses the same rule as cursor-agent; Linux paths behave like macOS.

  • I manually tested these changes locally (not run end-to-end in a rebuilt Orca; verified against cursor-agent's own slug function and the on-disk markers above)

  • Automated tests added/updated, or explained why not below

  • Every added test fails without this change and avoids the test anti-patterns

Risk

Level: Low

Only the Cursor trust preset changes. Paths that already matched Cursor (letters, digits, single -, separators) produce the same name as before. For other paths, Orca now writes one extra marker in the directory Cursor actually reads; markers written to the old name are left in place and remain unused. Windows paths go through the same rule as cursor-agent (C:\Users\me\repo → C-Users-me-repo). Revert is a plain revert.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e2405182-5685-4725-ada6-6ee7649a9ff9
Commits

Reviewing files that changed from the base of the PR and between a23ccef and 335d061.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
Walkthrough

cursorWorkspaceSlug now replaces non-ASCII-alphanumeric characters with hyphens, collapses repeated hyphens, and trims leading and trailing hyphens. A test checks the project directory names produced for Unix-style and Windows-style paths containing mixed characters.

Severity of issue fixed: Medium

Merge Risk: Moderate · previous review a23cc

Colliding workspace paths can leave Orca’s trust marker associated with the wrong folder. Resolve how Cursor handles that marker before merging.

Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title "fix(cursor): write workspace trust where cursor-agent reads it" names the main change: Orca now writes the Cursor workspace-trust marker to the project directory that cursor-agent reads. It…
Description check Passed The description follows the repository template and fills in every required section. ELI5, What Changed, and Why explain the before and after and the mechanism. Linked Issue cites #38806. Visual Proof…
Linked Issues check Passed [#38806] The whole-PR diff (mergeBase 11cad93 to head a23ccef) changes cursorWorkspaceSlug in src/main/agent-launch/trust/agent-trust-presets.ts to `absPath.replace(/[^a-zA-Z0-9]/g, '-').replace…
Out of Scope Changes check Passed [#38806] The whole-PR diff touches two files only: agent-trust-presets.ts (the slug function) and agent-trust-presets.test.ts (one added test). Both changes address the Cursor trust-marker directo…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Title check

Explanation

The title "fix(cursor): write workspace trust where cursor-agent reads it" names the main change: Orca now writes the Cursor workspace-trust marker to the project directory that cursor-agent reads. It fits the changeset, which changes cursorWorkspaceSlug to match cursor-agent's slug rule and adds a test for it. It is specific and concise, and a reviewer scanning history can tell the primary change.

Full details: Description check

Explanation

The description follows the repository template and fills in every required section. ELI5, What Changed, and Why explain the before and after and the mechanism. Linked Issue cites #38806. Visual Proof is marked N/A with a reason, and the author gives evidence from on-disk markers. Testing lists the new test, the local results, and the platforms tested (macOS only). Risk states Low, the affected scope, and a revert path. The author checks the automated-test items. Gaps: the AI Disclosure section is left as the template comment, although it is optional for internal contributors and the author may be an external one. The Review, Agent skill upstream boundary, and Checklist sections are not filled in. Windows and Linux were not tested directly, which the author states. These gaps are minor and do not make the description largely incomplete.

Full details: Linked Issues check

Explanation

[#38806] The whole-PR diff (mergeBase 11cad93 to head a23ccef) changes cursorWorkspaceSlug in src/main/agent-launch/trust/agent-trust-presets.ts to absPath.replace(/[^a-zA-Z0-9]/g, '-').replace(/-+/g, '-').replace(/^-+|-+$/g, ''). This is the same rule the issue gives for cursor-agent 2026.11.05. markCursorWorkspaceTrusted derives the ~/.cursor/projects/&lt;slug&gt; directory from this function, so the marker goes to the directory cursor-agent reads. I hand-traced the new test input /orca-missing/My Repo_v2/Ünï code--x.1 through the regex and got orca-missing-My-Repo-v2-n-code-x-1, which matches the expected value. The Windows input C:\Users\Jane Doe\orca\feat yields C-Users-Jane-Doe-orca-feat, which also matches. I did not run the test suite. The PR's reported run (15 passed, 1 skipped Windows-only) is author-reported evidence only.

Full details: Out of Scope Changes check

Explanation

[#38806] The whole-PR diff touches two files only: agent-trust-presets.ts (the slug function) and agent-trust-presets.test.ts (one added test). Both changes address the Cursor trust-marker directory named in #38806. The added test is supporting coverage for the new slug rule and does not add unrelated behavior. The other trust presets (Copilot, Antigravity, Kimi, Codex) are unchanged in the diff. No unrelated change was found.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b9404a5c-92a6-4dd2-94c2-c06e2bf04761
Commits

Reviewing files that changed from the base of the PR and between e0ea64a and a23ccef.

Files selected for processing: 1

  • src/main/agent-launch/trust/agent-trust-presets.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Jackylee1992 and others added 2 commits November 7, 2026 14:06
cursor-agent names ~/.cursor/projects/<dir> by replacing every
non-alphanumeric character with '-', collapsing repeats, and trimming
dashes. Orca only replaced Windows-illegal characters, so paths with
'_', '.', spaces or non-ASCII got a marker cursor-agent never reads and
the trust menu appeared on every fresh worktree.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Jackylee1992
Jackylee1992 force-pushed the fix/cursor-trust-slug branch from a23ccef to 335d061 Compare November 7, 2026 06:07
@Jackylee1992

Copy link
Copy Markdown
Contributor Author

Quick status update on the earlier CI failures.

The failed checks were not caused by this PR. The PR CI run (42275110470) tested a merge with main from a time when main itself was briefly broken. None of the errors touch the two files this PR changes (src/main/agent-launch/trust/agent-trust-presets.ts and its test):

  • static analysis and typecheck
    • TS2307 in src/main/acp/acp-structured-restored-model.test.ts. It imported agent-session-wire/structured-agent-session-host-test-harness and -test-data, but those modules had moved to agent-session-wire/host/testing/, apparently a semantic conflict between Keep the saved model when reopening ACP chats #38815 and a concurrent refactor. main fixed the imports in 4941215.
    • check-path-literal-ratchet flagged .github/workflows/mobile.yml entries that still pointed at the old agent-session-journal/journal-*.ts paths. main now uses item-lifecycle/.
  • test / tests node 24 2/12: the same missing-module import in acp-structured-restored-model.test.ts.
  • PR checks passed: failed only because the two jobs above failed.

What I changed: I rebased the two commits onto the latest main (20c8b84). There were no conflicts and no code changes, just a cleaner history with no merge commit. The new head is 335d061.

Local verification on the rebased branch (Node 24.22.2, pnpm 12.14.0, matching CI):

  • pnpm check:changed --base=origin/main --force: 22/22 passed (format, oxlint, typecheck for node/web/cli, all ratchets including path-literal-ratchet, import boundaries, localization, unit tests)
  • pnpm typecheck:node: passed

The workflows on the new commits are waiting for maintainer approval because this PR comes from a fork. Could a maintainer approve the workflow run and take a look when you have a moment? Thanks!

@Jinwoo-H
Jinwoo-H merged commit b07b043 into stablyai:main Nov 7, 2026
45 checks passed
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]: Cursor trust marker is written to a directory cursor-agent never reads for paths with '_' or '.'

2 participants