Skip to content

fix(run): default the Run page cwd to the user's home directory#206

Open
hoangsonww wants to merge 2 commits into
masterfrom
fix/run-page-default-cwd-home
Open

fix(run): default the Run page cwd to the user's home directory#206
hoangsonww wants to merge 2 commits into
masterfrom
fix/run-page-default-cwd-home

Conversation

@hoangsonww

Copy link
Copy Markdown
Owner

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):
    • The mount-time pre-fill now prefers the home suggestion from /api/run/cwds, falling back to the dashboard suggestion when no home entry is available (e.g. $HOME doesn't resolve/exist). Still only fills when the field is empty — never overrides a value the user already typed.
    • The cwd autocomplete group order is now home → dashboard → recent so 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.
  • README — Run page cwd description updated.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

How to Test

  1. npm run test:client — 248/248 pass (includes the 3 new tests; per-screen render snapshots unchanged).
  2. cd client && npx tsc --noEmit — clean.
  3. Manual: open Run — the cwd field is pre-filled with your home directory, and the autocomplete lists Home first, then Dashboard server, then Recent. Picking any other directory works exactly as before.

Checklist

  • I have read the contributing guidelines
  • I have signed the CLA (the 🖋️ CLA Assistant bot will prompt me on my first PR)
  • My code follows the project's coding standards
  • I have added/updated tests that prove my fix or feature works
  • All new and existing tests pass (npm test)
  • Code is formatted (npm run format:check)
  • I have updated documentation where necessary

🤖 Generated with Claude Code

https://claude.ai/code/session_0146oeseRLX17wL3iTqc1trq

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
Copilot AI review requested due to automatic review settings July 4, 2026 11:43
@cursor

cursor Bot commented Jul 4, 2026

Copy link
Copy Markdown

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.

@github-actions github-actions Bot added bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed question Further information is requested labels Jul 4, 2026

@gemini-code-assist gemini-code-assist 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.

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.

Copilot AI 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.

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 home cwd suggestion from /api/run/cwds for the mount-time prefill, with fallback to dashboard when home is unavailable.
  • Reorder the cwd autocomplete groups to home → dashboard → recent to 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.

Comment thread client/src/pages/__tests__/Run.defaultCwd.test.tsx
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
@cursor

cursor Bot commented Jul 4, 2026

Copy link
Copy Markdown

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed question Further information is requested

Projects

Development

Successfully merging this pull request may close these issues.

Enhancement: default the Run page cwd to the user's home directory instead of the dashboard project root

2 participants