fix(ssh): fix reconnect issues and node binary path resolution #2504
Mergedjuliusmarmingemerged 7 commits into
main fromrefs/pull/2504/headmerged by juliusmarminge View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
juliusmarminge changed the title
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
juliusmarminge changed the title
- packages/ssh/src/tunnel.ts lines 348 to 355OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -303,0 +335,21 @@335+ major: Number(match[1]),336+ minor: Number(match[2] || 0),337+ patch: Number(match[3] || 0),338+ };339+}340+341+function compare(left, right) {342+ if (left.major !== right.major) return left.major > right.major ? 1 : -1;343+ if (left.minor !== right.minor) return left.minor > right.minor ? 1 : -1;344+ if (left.patch !== right.patch) return left.patch > right.patch ? 1 : -1;345+ return 0;346+}347+348+function satisfiesComparator(version, comparator) {349+ const trimmed = comparator.trim();350+ if (!trimmed) return true;351+ const match = trimmed.match(/^(\\^|>=|>|<=|<|=)?\\s*v?(\\d+(?:\\.\\d+){0,2})$/);352+ if (!match) return false;353+ const operator = match[1] || "=";354+ const target = parseVersion(match[2]);355+ if (!target) return false;
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:L
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XL
- @@ -167,2 +169,21 @@167169 const decodeRemoteHttpError = Schema.decodeEffect(Schema.fromJsonString(RemoteHttpError));168170171+const decodeRemoteJsonOutput = <A, E>(172+ stdout: string,173+ decode: (input: string) => Effect.Effect<A, E>,174+): Effect.Effect<A, E> =>175+ decode(stdout).pipe(176+ Effect.catch((error) =>177+ Effect.gen(function* () {178+ const jsonObject = extractJsonObject(stdout);179+ if (jsonObject === stdout.trim()) {180+ return yield* Effect.fail(error);181+ }182+ const exit = yield* Effect.exit(decode(jsonObject));183+ if (Exit.isSuccess(exit)) {184+ return exit.value;185+ }186+ return yield* Effect.fail(error);187+ }),188+ ),189+ );@@ -343,3 +488,7 @@343488 fi344489 mv "$RUNNER_NEXT" "$RUNNER_FILE"345490 chmod 700 "$RUNNER_FILE"491+if ! ensure_remote_node_path; then492+ printf 'Remote host is missing node on PATH. Install Node or configure a supported version manager for non-interactive shells.\\n' >&2493+ exit 1494+fi
- packages/shared/src/semver.ts line 191OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -0,0 +171,21 @@171+ minor: Number(targetMatch[2] || 0),172+ patch: Number(targetMatch[3] || 0),173+ };174+ const compared =175+ version.major !== target.major176+ ? version.major > target.major177+ ? 1178+ : -1179+ : version.minor !== target.minor180+ ? version.minor > target.minor181+ ? 1182+ : -1183+ : version.patch !== target.patch184+ ? version.patch > target.patch185+ ? 1186+ : -1187+ : 0;188+ const operator = match[1] || "=";189+ switch (operator) {190+ case "^":191+ return version.major === target.major && compared >= 0;
- @@ -386,10 +535,15 @@386535 REMOTE_PID="$(cat "$PID_FILE" 2>/dev/null || true)"387536 REMOTE_PORT="$(cat "$PORT_FILE" 2>/dev/null || true)"388537 REMOTE_MANAGED="$(cat "$MANAGED_FILE" 2>/dev/null || true)"389-DEFAULT_REMOTE_PORT="$(resolve_default_runtime_port 2>/dev/null || true)"538+DEFAULT_RUNTIME_INFO="$(resolve_default_runtime_port 2>/dev/null || true)"539+DEFAULT_RUNTIME_PID=""540+DEFAULT_REMOTE_PORT=""541+if [ -n "$DEFAULT_RUNTIME_INFO" ]; then542+ DEFAULT_RUNTIME_PID="\${DEFAULT_RUNTIME_INFO%% *}"543+ DEFAULT_REMOTE_PORT="\${DEFAULT_RUNTIME_INFO#* }"544+fi390545 if [ -n "$DEFAULT_REMOTE_PORT" ]; then391546 REMOTE_PORT="$DEFAULT_REMOTE_PORT"392547 if wait_ready "@@T3_REUSE_READY_TIMEOUT_MS@@"; then393- if [ "$REMOTE_MANAGED" = "managed" ] && [ -n "$REMOTE_PID" ] && kill -0 "$REMOTE_PID" 2>/dev/null; then394- kill "$REMOTE_PID" 2>/dev/null || true395- wait_for_pid_exit "$REMOTE_PID"548+ if [ "$REMOTE_MANAGED" = "managed" ]; then549+ PID_TO_STOP="\${REMOTE_PID:-$DEFAULT_RUNTIME_PID}"
juliusmarminge merged this932df4e
juliusmarminge closed this
Sign in to join this conversation.



Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID:
d1656d40-cd49-4d1b-9d28-920181e5a609You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment `@coderabbitai help` to get the list of available commands and usage tips.