Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): a hung network mount no longer freezes the server when it spawns a process #30238

Closedjuliusmarmingewants to merge 21 commits intomain fromrefs/pull/30238/headopened View on GitHub

Showing 9 changed files with 45 additions and 2 deletions (loading 7).

x
0 of 9 viewed, 9 left
13 additions and 2 deletionsapps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.tsModified
View file
@@ -358,7 +358,10 @@
const CLAUDE_ROOT_REFUSAL =
"--dangerously-skip-permissions cannot be used with root/sudo privileges for security reasons";
​
+// The shell enters the cwd: a native cwd blocks the server while a hung mount stalls chdir.
const CLAUDE_GROUP_WATCH_SCRIPT = [
+ 'cd -P -- "$1" || exit 125',
+ "shift",
"{ trap '' TERM; read -r _ <&3; kill -TERM 0; sleep 5; kill -KILL 0; } </dev/null >/dev/null 2>&1 &",
'exec "$@" 3<&-',
].join("\n");
@@ -374,11 +377,19 @@
onStderr: (text: string) => void = () => {},
onStderrClose: () => void = () => {},
): ClaudeSpawnedProcess {
+ // Relative to the server's cwd, as a native cwd is; `./` keeps CDPATH out of it.
+ const cwd = options.cwd ?? ".";
const child = NodeChildProcess.spawn(
"/bin/sh",
- ["-c", CLAUDE_GROUP_WATCH_SCRIPT, "t3-claude", options.command, ...options.args],
+ [
+ "-c",
+ CLAUDE_GROUP_WATCH_SCRIPT,
+ "t3-claude",
+ cwd.startsWith("/") ? cwd : `./${cwd}`,
+ options.command,
+ ...options.args,
+ ],