Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
772a115
Share SSH monitoring connections and persist host retry backoff
sox8502 Oct 22, 2026
ee67264
Fix explicit reconnect, growing logs, and long SSH setup
sox8502 Oct 22, 2026
97df5cd
Require idle SSH monitors before dev-slot data cleanup
sox8502 Oct 22, 2026
d2ee43a
Merge remote-tracking branch 'origin/main' into daniel/or-558-shared-ssh
sox8502 Oct 22, 2026
39cb2e4
Show SSH connection and run monitoring diagnostics
sox8502 Oct 22, 2026
aca6872
Preserve quoted SSH known-hosts filename lists
sox8502 Oct 22, 2026
b06a279
Merge remote-tracking branch 'origin/main' into daniel/or-558-shared-ssh
sox8502 Oct 22, 2026
6d046a0
Merge remote-tracking branch 'origin/main' into daniel/or-558-shared-ssh
sox8502 Oct 22, 2026
18157f6
Include shared SSH log files in run artifact cleanup
sox8502 Oct 22, 2026
575f8fa
Support Python 3.6 remote SSH helpers
sox8502 Oct 22, 2026
74d4901
Merge remote-tracking branch 'origin/main' into daniel/or-558-shared-ssh
sox8502 Oct 22, 2026
cc13526
Finish Slurm runs despite unavailable logs
sox8502 Oct 22, 2026
55af17d
Validate SSH log chunks during concurrent rewrites
sox8502 Oct 22, 2026
778114b
Merge origin/main and preserve shared SSH monitoring compatibility
sox8502 Oct 23, 2026
6025952
Detect full-prefix log rewrites and isolate legacy SSH monitors
sox8502 Oct 23, 2026
1e6c37d
Preserve whitespace in interactive SSH credentials
sox8502 Oct 23, 2026
21906b7
Reuse verified log digests and ignore unrelated obsolete SSH routes
sox8502 Oct 23, 2026
ca8fb01
Merge latest main and rebuild the reviewed dashboard
sox8502 Oct 23, 2026
99e8a39
Keep pinned SSH connections stable across unrelated config edits
sox8502 Oct 23, 2026
5cfb903
Merge current main and migrate saved SSH connection bindings
sox8502 Oct 23, 2026
cde56e5
Merge current main and isolate Slurm status read failures
sox8502 Oct 23, 2026
13b0bdf
Merge current main and close SSH retry and Slurm completion gaps
sox8502 Oct 23, 2026
6bee71f
Stream large SSH command input through bounded upload frames
sox8502 Oct 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Require idle SSH monitors before dev-slot data cleanup
  • Loading branch information
sox8502 committed Oct 22, 2026
commit 97df5cdd9af1fb5f1f33bc2538363c79c6ef30b9
10 changes: 6 additions & 4 deletions scripts/dev-slot.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ function removeManagedDirectories(slotPaths, configuration, mainCheckout) {
return true
}

function reclaimStaleReservations(info, registry) {
async function reclaimStaleReservations(info, registry) {
const configurations = [...registry.configurations]
const removed = new Set()
for (let slot = FIRST_SLOT; slot <= LAST_SLOT; slot += 1) {
Expand All @@ -328,6 +328,7 @@ function reclaimStaleReservations(info, registry) {
const owner = { worktreePath: path.dirname(manifest), manifestPath: manifest }
if (!managedStateMatches(state, owner, slotPaths)) continue
if (processGroupExists(state.backendProcess?.pid) || processGroupExists(state.uiProcess?.pid)) continue
try { await stopSshServices(slotPaths, true) } catch { continue }
if (!removeManagedDirectories(slotPaths, backend, info.mainCheckout)) continue
removed.add(slot)
}
Expand Down Expand Up @@ -384,7 +385,7 @@ async function reserveSlot(info, dbMode) {
const release = await acquireAllocatorLock(info)
try {
const registry = loadRegistry(info)
reclaimStaleReservations(info, registry)
await reclaimStaleReservations(info, registry)
const existing = registry.configurations.find((configuration) =>
configuration.port >= 4901
&& configuration.port <= 4909
Expand Down Expand Up @@ -707,7 +708,7 @@ function printStatus(info) {
console.log(` State: ${state ? slotPaths.statePath : 'legacy/unmanaged'}`)
}

export async function stopSshServices(slotPaths) {
export async function stopSshServices(slotPaths, requireIdle = false) {
if (!existsSync(slotPaths.dataDir)) return
for (const name of readdirSync(slotPaths.dataDir)) {
if (!/^ssh-service-[a-f0-9]{64}$/.test(name)) continue
Expand All @@ -719,7 +720,7 @@ export async function stopSshServices(slotPaths) {
socket.setTimeout(15_000, () => socket.destroy(new Error('SSH service shutdown timed out')))
socket.once('error', (error) => error.code === 'ECONNREFUSED' ? resolve(true) : reject(error))
socket.once('connect', () => {
const body = Buffer.from(JSON.stringify({ ...endpoint, port: undefined, target: null, operation: { op: 'shutdown_if_idle' } }))
const body = Buffer.from(JSON.stringify({ ...endpoint, port: undefined, target: null, operation: { op: requireIdle ? 'shutdown' : 'shutdown_if_idle' } }))
const header = Buffer.alloc(4)
header.writeUInt32BE(body.length)
socket.write(Buffer.concat([header, body]))
Expand Down Expand Up @@ -807,6 +808,7 @@ async function cleanupUnlocked(info) {
reservation = reservationFor(info)
if (!reservation) return
const { slotPaths, state, backend } = reservation
await stopSshServices(slotPaths, true)
if (listenerPids(slotPaths.backendPort).length > 0 || listenerPids(slotPaths.uiPort).length > 0) {
throw new Error(`Refusing to clean ${slotPaths.slotKey} while its ports are listening`)
}
Expand Down
8 changes: 6 additions & 2 deletions scripts/dev-slot.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,10 @@ test('stopping a dashboard leaves busy SSH monitoring alive', async () => {
received = Buffer.concat([received, chunk])
if (received.length < 4 || received.length < 4 + received.readUInt32BE()) return
const request = JSON.parse(received.subarray(4).toString())
assert.equal(request.operation.op, 'shutdown_if_idle')
const response = Buffer.from(JSON.stringify({ value: { busy: true }, error: null }))
assert.ok(['shutdown_if_idle', 'shutdown'].includes(request.operation.op))
const response = Buffer.from(JSON.stringify(request.operation.op === 'shutdown'
? { value: null, error: 'SSH monitoring is busy' }
: { value: { busy: true }, error: null }))
const header = Buffer.alloc(4)
header.writeUInt32BE(response.length)
socket.end(Buffer.concat([header, response]))
Expand All @@ -157,6 +159,8 @@ test('stopping a dashboard leaves busy SSH monitoring alive', async () => {
writeFileSync(path.join(root, 'endpoint.json'), JSON.stringify({ port: server.address().port, token: 'fixture', version: 1 }))
await stopSshServices({ dataDir })
assert.equal(server.listening, true)
await assert.rejects(stopSshServices({ dataDir }, true), /SSH monitoring is busy/)
assert.equal(server.listening, true)
} finally {
await new Promise((resolve) => server.close(resolve))
rmSync(dataDir, { recursive: true, force: true })
Expand Down
Loading