The best way to control Claude Code, Codex and more from any computer or phone
fix(ssh): host discovery skips hidden Include matches (#30910)
Co-authored-by: Simone <185146821+Lucenx9@users.noreply.github.com>
Simone committed
Nov 6, 2026 at 05:41 UTC
948f6b55d0d73a405080aee7b7816b0bdab208b2
2 files changed
+17
-2
packages/ssh/src/config.test.ts
+16
-2
@@ -56,7 +56,7 @@ describe("ssh config", () => {
56
}).pipe(Effect.provide(NodeServices.layer), Effect.scoped),
57
);
58
59
- it.effect("skips directory Include matches without losing file aliases or known hosts", () =>
59
+ it.effect("skips directories and implicit dotfile Include matches but keeps explicit ones", () =>
60
Effect.gen(function* () {
61
const fs = yield* FileSystem.FileSystem;
62
const path = yield* Path.Path;
@@ -66,12 +66,24 @@ describe("ssh config", () => {
66
yield* fs.makeDirectory(path.join(sshDir, "explicit-directory"));
67
yield* fs.writeFileString(
68
path.join(sshDir, "config"),
69
- "Include config.d/*\nInclude explicit-directory\nHost real\n HostName real.example.com\n",
69
+ "Include config.d/*\nInclude config.d/.literal.conf\nInclude config.d/.enabled-*.conf\nInclude explicit-directory\nHost real\n HostName real.example.com\n",
70
);
71
yield* fs.writeFileString(
72
path.join(sshDir, "config.d", "team.conf"),
73
"Host team\n HostName team.example.com\n",
74
);
75
+ yield* fs.writeFileString(
76
+ path.join(sshDir, "config.d", ".backup.conf"),
77
+ "Host *\n HostName obsolete.example.com\n",
78
+ );
79
+ yield* fs.writeFileString(
80
+ path.join(sshDir, "config.d", ".literal.conf"),
81
+ "Host literal\n HostName literal.example.com\n",
82
+ );
83
+ yield* fs.writeFileString(
84
+ path.join(sshDir, "config.d", ".enabled-one.conf"),
85
+ "Host enabled\n HostName enabled.example.com\n",
86
+ );
87
yield* fs.writeFileString(
88
path.join(sshDir, "known_hosts"),
89
"known.example.com ssh-ed25519 AAAA\n",
@@ -81,7 +93,9 @@ describe("ssh config", () => {
93
assert.deepEqual(
94
hosts.map((host) => [host.alias, host.hostname, host.source]),
95
[
96
+ ["enabled", "enabled.example.com", "ssh-config"],
97
["known.example.com", "known.example.com", "known-hosts"],
98
+ ["literal", "literal.example.com", "ssh-config"],
99
["real", "real.example.com", "ssh-config"],
100
["team", "team.example.com", "ssh-config"],
101
],
packages/ssh/src/config.ts
+1
@@ -112,6 +112,7 @@ const expandGlob = Effect.fnUntraced(function* (pattern: string) {
112
const entries = yield* fs.readDirectory(directory);
113
const matchedPaths: string[] = [];
114
for (const entry of entries) {
115
+ if (entry.startsWith(".") && !basePattern.startsWith(".")) continue;
116
if (!matcher.test(entry)) {
117
continue;
118
}