-
Notifications
You must be signed in to change notification settings - Fork 91
fix(coding-agent): create the win32 internal RPC socket dir recursively (fixes #1370) #1420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MoerAI
wants to merge
2
commits into
code-yeongyu:main
Choose a base branch
from
MoerAI:fix/1370-rpc-internal-socket-mkdir
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
packages/coding-agent/test/suite/regressions/1370-rpc-internal-socket-mkdir.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| import { existsSync, mkdtempSync, rmSync } from "node:fs"; | ||
| import { tmpdir } from "node:os"; | ||
| import { dirname, join } from "node:path"; | ||
| import { afterEach, describe, expect, it } from "vitest"; | ||
| import { createInternalSocketPath } from "../../../src/modes/rpc/host-lifecycle.ts"; | ||
|
|
||
| // Regression coverage for https://github.com/code-yeongyu/senpi/issues/1370 | ||
| describe("createInternalSocketPath", () => { | ||
| const created: string[] = []; | ||
|
|
||
| afterEach(() => { | ||
| for (const dir of created.splice(0)) rmSync(dir, { recursive: true, force: true }); | ||
| }); | ||
|
|
||
| it("creates the win32 internal directory when rpc-host-daemon does not exist yet", async () => { | ||
| const agentDir = mkdtempSync(join(tmpdir(), "senpi-hlc-win32-")); | ||
| created.push(agentDir); | ||
| const daemonDir = join(agentDir, "rpc-host-daemon"); | ||
| expect(existsSync(daemonDir)).toBe(false); | ||
|
|
||
| const internal = await createInternalSocketPath(daemonDir, "win32"); | ||
|
|
||
| const dir = internal.dir; | ||
| if (dir === undefined) throw new Error("expected an internal socket directory"); | ||
| expect(existsSync(dir)).toBe(true); | ||
| expect(dirname(dir)).toBe(daemonDir); | ||
| expect(internal.socket.startsWith("\\\\.\\pipe\\")).toBe(true); | ||
| expect(internal.secretPath).toBe(join(dir, "secret")); | ||
| }); | ||
|
|
||
| it("keeps the posix internal directory in the OS temp dir", async () => { | ||
| const internal = await createInternalSocketPath(join(tmpdir(), "senpi-hlc-unused"), "linux"); | ||
|
|
||
| const dir = internal.dir; | ||
| if (dir === undefined) throw new Error("expected an internal socket directory"); | ||
| created.push(dir); | ||
| expect(existsSync(dir)).toBe(true); | ||
| expect(dirname(dir)).toBe(tmpdir()); | ||
| expect(internal.socket).toBe(join(dir, "host.sock")); | ||
| }); | ||
| }); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes fresh-profile startup behavior in
host-lifecycle.ts, but the commit leaves bothpackages/coding-agent/src/modes/rpc/changes.mdand the shared-host lifecycle section ofdocs/rpc.mduntouched. Record the Windows bootstrap behavior in both files in this increment so the fork tracker and documented lifecycle contract remain aligned.AGENTS.md reference: packages/coding-agent/src/modes/rpc/AGENTS.md:L52-L52
Useful? React with 👍 / 👎.