fix(run): default the Run page cwd to the user's home directory#206
fix(run): default the Run page cwd to the user's home directory#206hoangsonww wants to merge 2 commits into
Conversation
The Run page pre-filled its working directory with the dashboard's own cwd (this repo's root), so ad-hoc `claude` runs inherited the dashboard repo's project context — .claude/agents, .claude/skills, .claude/rules, CLAUDE.md, .mcp.json — which is almost never what an ad-hoc run wants and can noticeably inflate the initial Messages-API request (issue #202). Prefer the `home` cwd suggestion for the initial pre-fill, falling back to the dashboard cwd when no home suggestion is available, and list the home group first in the cwd autocomplete (home > dashboard > recent). Manual override via the picker is unchanged, as is the /api/run/cwds endpoint itself. Adds a focused client test covering the home preference, the dashboard fallback, and the no-suggestions case. Closes #202 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0146oeseRLX17wL3iTqc1trq
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
There was a problem hiding this comment.
Code Review
This pull request changes the default working directory (cwd) on the Run page to the user's home directory instead of the dashboard's own cwd. This prevents ad-hoc runs from inheriting the dashboard repository's project context (such as agents, skills, rules, etc.). It also updates the autocomplete group ordering to list 'home' first, adds comprehensive unit tests in Run.defaultCwd.test.tsx to verify this behavior, and updates the documentation in README.md and server/routes/run.js accordingly. There are no review comments, so I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Pull request overview
Updates the Run page behavior to default its working directory (cwd) to the user’s home directory (a more neutral spawn location) instead of the dashboard server’s cwd, reducing accidental inheritance of this repo’s Claude project context and aligning with issue #202.
Changes:
- Prefer the
homecwd suggestion from/api/run/cwdsfor the mount-time prefill, with fallback todashboardwhenhomeis unavailable. - Reorder the cwd autocomplete groups to
home → dashboard → recentto match the new default. - Add focused client tests covering home-preferred, dashboard-fallback, and empty-suggestions behavior; update docs/comments accordingly.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| server/routes/run.js | Comment update clarifying cwd suggestion intent (no behavior change). |
| client/src/pages/Run.tsx | Prefer home cwd on mount; reorder cwd suggestion groups. |
| client/src/pages/tests/Run.defaultCwd.test.tsx | New tests ensuring correct default-cwd selection and fallbacks. |
| README.md | Documentation updated to reflect the new Run page cwd default and suggestion ordering. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Propagate the README change from the previous commit to the Run Claude feature rows in README-VN.md and README-CN.md: the cwd autocomplete now pre-fills the user's home directory (neutral spawn location that doesn't inherit the dashboard repo's .claude project context), falls back to the dashboard cwd when no home suggestion exists, and lists the home group first (home > dashboard > recent). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0146oeseRLX17wL3iTqc1trq
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
Summary
Implements #202: the Run page now defaults its working directory to the user's home directory (a neutral spawn location) instead of the dashboard's own cwd, so ad-hoc runs no longer inherit this repo's project context (
.claude/agents,.claude/skills,.claude/rules,CLAUDE.md,.mcp.json) — which could noticeably inflate the initial Messages-API request on context-heavy setups.Closes #202
Changes
client/src/pages/Run.tsx(the two spots from the issue):homesuggestion from/api/run/cwds, falling back to thedashboardsuggestion when no home entry is available (e.g.$HOMEdoesn't resolve/exist). Still only fills when the field is empty — never overrides a value the user already typed.home → dashboard → recentso the suggestion list matches the new default. Manual override via the picker is unchanged.server/routes/run.js— comment-only update on/cwds(the endpoint's behavior and response are untouched).client/src/pages/__tests__/Run.defaultCwd.test.tsx— new focused test: home preferred over dashboard, dashboard fallback when no home suggestion exists, field left empty when there are no suggestions at all.Type of Change
How to Test
npm run test:client— 248/248 pass (includes the 3 new tests; per-screen render snapshots unchanged).cd client && npx tsc --noEmit— clean.Checklist
🖋️ CLA Assistantbot will prompt me on my first PR)npm test)npm run format:check)🤖 Generated with Claude Code
https://claude.ai/code/session_0146oeseRLX17wL3iTqc1trq