shmuelie / shmuelie/powershell-modules

ChangeDir does not affect automatic Copilot session selection or MCP path policy

Open
#283 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug module:copilot theme:testing
Dominant language
PowerShell
Stars
0
Forks
0
Avg merge
21m
Merged PRs (30d)
124

Description

Peer-review finding

Reviewed snapshot: 5c38677469756c69f86678c0b907d82e15d0a539.
The reviewer and parent independently reproduced this against unchanged source.
Only fresh synthetic session homes and a fixed non-mutating native stub were
used; no real conversation history, user configuration or Copilot process was
accessed. Do not run destructive reproduction commands against real sessions.

Severity: Medium. Confidence: 10/10.
Suggested existing labels: bug, module:copilot.

Locations: modules\Shmuelie.Copilot\Get-CopilotLaunchPlan.ps1:599-610,677,731;
modules\Shmuelie.Copilot\SessionSelection.ps1:16-49.
Start-Copilot forwards the parameter without changing location at
modules\Shmuelie.Copilot\Start-Copilot.ps1:582-602.

The parameter's help promises to change directory before other work, but the
implementation only appends -C to the future CLI arguments. The launcher itself
continues evaluating MCP path globs and resume candidates against Get-Location
in the original directory.

Minimal synthetic reproduction:

  • Create actual scratch directories A and B, and one fake session per directory.
  • Configure fake-home MCP server only-a with autoConnect = @($directoryA) and
    server only-b with autoConnect = @($directoryB).
  • Stub native Copilot command discovery and Git branch lookup; do not launch
    Copilot.
  • From A, inspect Get-CopilotLaunchPlan -ChangeDir $directoryB, then
    Start-Copilot -PassThru -ChangeDir $directoryB.

Actual: Both plans select A's session. The plan forwards -C B but disables
only-b and leaves only-a enabled.

Expected: B's session is selected and only-a is disabled, with policy evaluated
for B. The caller's original location remains unchanged after planning/launching.

Acceptance criteria: Resolve the effective launch directory before all
directory-sensitive planning, consistently across both entry points. Cover absolute
and relative ChangeDir, session/branch selection, MCP globs, and caller-location
restoration on success and error. Preserve explicit resume and selector semantics.
No assumption about an unverified native CLI flag is needed: the wrong plan is
observable without launching.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read modules\Shmuelie.Copilot\Get-CopilotLaunchPlan.ps1 and SessionSelection.ps1, then compare how Start-Copilot.ps1 forwards ChangeDir. Run the synthetic A/B reproduction with native Copilot discovery and Git branch lookup stubbed, without launching Copilot. Done means both entry points plan against the effective directory for absolute and relative paths, preserve explicit resume and selector behavior, and restore the caller location on success and error.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, powershell
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.