Create lockfiles in ide directory#3583
Conversation
There was a problem hiding this comment.
Pull request overview
Moves Copilot CLI integration lockfiles to live under .copilot/ide/ (instead of directly under .copilot/), aligning the extension with the already-shipped CLI behavior.
Changes:
- Update Copilot CLI state directory helper to return
<XDG_STATE_HOME or homedir>/.copilot/ide. - Update lockfile tests to assert the new
.copilot/idelocation and create the correct directory for cleanup tests.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/extension/agents/copilotcli/vscode-node/cliHelpers.ts | Changes the computed state dir from .copilot to .copilot/ide. |
| src/extension/agents/copilotcli/vscode-node/test/lockFile.spec.ts | Updates assertions/setup so lockfile tests reflect the new .copilot/ide directory. |
| const handle = await createLockFile(mockServerUri, mockHeaders, logger); | ||
| createdLockFile = handle.path; | ||
|
|
||
| expect(handle.path).toMatch(/\.copilot.*\.lock$/); | ||
| expect(handle.path).toMatch(/\.copilot[/\\]ide.*\.lock$/); | ||
| expect(fs.existsSync(handle.path)).toBe(true); |
There was a problem hiding this comment.
These createLockFile tests call createLockFile(...) without setting XDG_STATE_HOME, so they write into the real user home directory (now ~/.copilot/ide). The test only deletes the lock file, leaving the .copilot/ide directory behind and making the suite non-hermetic. Set process.env.XDG_STATE_HOME to a temp dir for this describe block (and restore it in afterEach/afterAll) so all filesystem writes are contained and fully cleaned up.
DonJayamanne
left a comment
There was a problem hiding this comment.
Can we make the I/O async
|
I'll follow up these changes with a PR that stops using the deprecated |
DonJayamanne
left a comment
There was a problem hiding this comment.
@copilot address the review comments
src/extension/agents/copilotcli/vscode-node/test/lockFile.spec.ts
Outdated
Show resolved
Hide resolved
|
@copilot address the review comments |
- use async file io in tests - use generateUuid util - parallelize the loop
Refactor Copilot CLI tool registration to use server.registerTool
We decided these are best placed into
.copilot/ide/instead of at.copilot/. The change has already been shipped in the CLI