fix: sync OpenClaw 2026.9.1 lifecycle (#50)
Co-authored-by: mmckeen-nv <mmckeen-nv@users.noreply.github.com>
This commit is contained in:
@@ -2,6 +2,7 @@ import { execFile, spawn } from "node:child_process"
|
||||
import { promisify } from "node:util"
|
||||
import { HOST_PATH, OPENCLAW_BIN, OPENSHELL_BIN, hostCommandEnv } from "./hostCommands"
|
||||
import { getDefaultOpenClawInstance, getOpenClawDashboardPortForSandbox, resolveOpenClawInstance } from "./openclawInstances"
|
||||
import { restartSandboxGatewayWithNemoClaw } from "./nemoclawCli"
|
||||
|
||||
const execFileAsync = promisify(execFile)
|
||||
const OPENSHELL_GATEWAY = process.env.OPENSHELL_GATEWAY?.trim() || undefined
|
||||
@@ -421,13 +422,13 @@ async function execSandboxSsh(sandboxName: string, command: string, timeoutMs =
|
||||
}
|
||||
|
||||
async function ensureRemoteSandboxOpenClawDashboard(sandboxName: string) {
|
||||
const command = [
|
||||
`curl -fsS --max-time 2 http://127.0.0.1:${SANDBOX_DASHBOARD_REMOTE_PORT}/ >/dev/null 2>&1`,
|
||||
"||",
|
||||
`(nohup /usr/local/bin/openclaw gateway run --allow-unconfigured --bind loopback --port ${SANDBOX_DASHBOARD_REMOTE_PORT} >/tmp/gateway.log 2>&1 &)`
|
||||
].join(" ")
|
||||
|
||||
await execSandboxSsh(sandboxName, command).catch(() => null)
|
||||
try {
|
||||
await execSandboxSsh(sandboxName, `curl -fsS --max-time 2 http://127.0.0.1:${SANDBOX_DASHBOARD_REMOTE_PORT}/ >/dev/null`, 5000)
|
||||
return true
|
||||
} catch {
|
||||
const restart = await restartSandboxGatewayWithNemoClaw(sandboxName)
|
||||
if (!restart.ok) return false
|
||||
}
|
||||
|
||||
for (let attempt = 0; attempt < 16; attempt += 1) {
|
||||
try {
|
||||
@@ -448,7 +449,7 @@ async function ensureSandboxOpenClawDashboardTunnel(sandboxName: string) {
|
||||
const initial = await inspectListeningPort(port)
|
||||
if (initial.listenerPresent) return initial
|
||||
|
||||
await ensureRemoteSandboxOpenClawDashboard(sandboxName)
|
||||
if (!await ensureRemoteSandboxOpenClawDashboard(sandboxName)) return initial
|
||||
|
||||
const child = spawn("ssh", buildSandboxSshArgs(sandboxName, [
|
||||
"-N",
|
||||
|
||||
Reference in New Issue
Block a user