Skip to content

fix(app): prefer exact project directory matches - #55782

Open
udayasree25 wants to merge 2 commits into
anomalyco:devfrom
udayasree25:project-selection
Open

udayasree25 wants to merge 2 commits into
anomalyco:devfrom
udayasree25:project-selection

Conversation

@udayasree25

@udayasree25 udayasree25 commented Oct 15, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #55351

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

An earlier canonical project can win on sandbox membership before the resolver reaches the exact selected directory. I'm leaning toward exact-directory precedence here, keeping the server filter and sandbox/project-ID fallbacks; happy to adjust if sandbox matches are intentionally meant to override explicit entries.

If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!

How did you verify your code works?

From packages/app:

  • bun test --conditions=solid --isolate --preload ./happydom.ts ./src/new-session — passed, 21 tests. Both new exact-match cases fail before the fix; coverage includes Windows separators and sandbox fallback.
  • bun typecheck — passed.

From the repository root:

  • bun run check — passed via the mandatory pre-push gate: lint and all 36 typecheck tasks (Bun 1.4.2, Node 24.22.0).
  • bun x --no-install prettier --check packages/app/src/new-session/project/selector.tsx packages/app/src/new-session/project/selector.test.tsx — passed.
  • git diff --check — passed.

Screenshots / recordings

If this is a UI change, please include a screenshot or recording.

Real selector in a temporary Storybook fixture, with /repo/app-uat selected and shared sandbox metadata. Also verified that selecting app-release updates both the chip and checkmark. This is component-level browser verification, not a full Desktop end-to-end run.

Before After
Before: app-uat is selected but the chip and checkmark show app-dev After: the chip and checkmark correctly show app-uat

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.


Added by the opencode bot (AI-generated).

Related: #50821

Resolve the selected project by exact normalized worktree before falling back to sandbox membership or project ID. This keeps sibling clone labels and checkmarks aligned with the selected directory.

Co-authored-by: Copilot <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@opencode-agent opencode-agent 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.

Looks good. I reproduced #55351 in the web UI run from source: three clones of one repo, with the other two listed in the app-dev project's sandboxes. On the base, the new-session chip and checkmark stay on app-dev while app-uat and then app-release are selected. With this change they follow the selected directory. The new exact-match tests fail on the base and pass here, and the packages/app type check passes.

Public API: unchanged.

Non-blocking, possibly for a follow-up: the same single find() that matches worktree or sandboxes together is still used in session/session-identity-header.tsx, runtime/extension/mounted-session.ts (listedProject) and home/sessions/records.ts. With sibling clones they could resolve to the canonical entry instead of the exact directory.

Related: #50821

Before

After

This branch has not been deployed

No deployments
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.

desktop: new-session project chip never reflects sibling directories of the same git repo

1 participant