Skip to content

Commit b500a38

Browse files
committed
fix(dev): 支持长 worktree 路径下的 SSH control socket
- 从 socket 父目录执行 OpenSSH,保留绝对路径描述与实例归属 - 验证真实 tunnel 的创建、探测和精确关闭
1 parent 82b1d3e commit b500a38

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
修复深层 worktree 路径下开发数据库 SSH control socket 超长导致启动失败的问题,保留实例独立的 tunnel 与清理归属。

‎docs/40-deployment/development-environment.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ tracked files never own a hostname, user, key, or machine path.
2727
The SSH provider sends an allowlisted build context and one bounded Compose payload to the
2828
remote host. Remote services publish dynamic remote-loopback ports and an instance-owned
2929
OpenSSH control tunnel maps independent local-loopback ports to them.
30+
The descriptor keeps the absolute control-socket path, while SSH runs from its parent directory
31+
with the short socket name so long worktree paths do not exceed Unix-domain socket limits.
3032

3133
Runtime state is written to `.runtime/database/<core-svc-instance>/`. Its `runtime.json`,
3234
`profile.json`, and `readiness.json` record:

‎scripts/dev_database_provider.py‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,11 +418,12 @@ def database_access_ready(
418418
(
419419
"ssh",
420420
"-S",
421-
control_socket_path,
421+
Path(control_socket_path).name,
422422
"-O",
423423
"check",
424424
provider.target,
425425
),
426+
cwd=Path(control_socket_path).parent,
426427
timeout=5,
427428
)
428429
except (OSError, subprocess.SubprocessError):
@@ -461,7 +462,7 @@ def open_database_access(
461462
"ssh",
462463
"-M",
463464
"-S",
464-
str(socket_path),
465+
socket_path.name,
465466
"-fnNT",
466467
"-o",
467468
"BatchMode=yes",
@@ -470,6 +471,8 @@ def open_database_access(
470471
*forwards,
471472
provider.target,
472473
),
474+
# OpenSSH appends a temporary suffix; absolute worktree paths can exceed AF_UNIX limits.
475+
cwd=socket_path.parent,
473476
timeout=15,
474477
)
475478
return str(socket_path)
@@ -487,11 +490,12 @@ def close_database_access(
487490
(
488491
"ssh",
489492
"-S",
490-
control_socket_path,
493+
Path(control_socket_path).name,
491494
"-O",
492495
"exit",
493496
provider.target,
494497
),
498+
cwd=Path(control_socket_path).parent,
495499
timeout=5,
496500
)
497501
except (OSError, subprocess.SubprocessError):

0 commit comments

Comments
 (0)