mirror of
https://github.com/stablyai/orca.git
synced 2026-11-03 18:47:40 +00:00
fix(mobile): keep polling the server list and read a server's reachability from relay
A hosts-list read slower than the poll stopped the feed for good, since the next tick was scheduled when the read started; it is now scheduled from the finish. A server workspace now reads connected only when the desktop relays to it, so a server with no status yet is not shown up. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
This commit is contained in:
@@ -269,13 +269,17 @@ test('phone paired with a desktop lists, opens and types into a workspace on its
|
||||
|
||||
await host.restartServeProcess({
|
||||
betweenProcesses: async () => {
|
||||
// The server is down: the desktop says so, and its workspace stays listed from its last rows.
|
||||
// The server is down: the desktop reports it reconnecting and not relaying, which the phone
|
||||
// shows as connecting; its workspace stays listed from its last rows.
|
||||
await expect
|
||||
.poll(async () => (await listedHost(socket, serverHostId))?.relay, {
|
||||
timeout: 60_000,
|
||||
intervals: [1_000]
|
||||
})
|
||||
.toBe('unavailable')
|
||||
.poll(
|
||||
async () => {
|
||||
const down = await listedHost(socket, serverHostId)
|
||||
return down && { health: down.health, relay: down.relay }
|
||||
},
|
||||
{ timeout: 60_000, intervals: [1_000] }
|
||||
)
|
||||
.toEqual({ health: 'connecting', relay: 'unavailable' })
|
||||
const lastRows = await hostWorktrees(socket, serverHostId)
|
||||
expect(lastRows?.worktrees.map((row) => row.path)).toContain(serverFolder)
|
||||
// A relayed call fails as unavailable, and never runs on the desktop instead.
|
||||
@@ -294,13 +298,13 @@ test('phone paired with a desktop lists, opens and types into a workspace on its
|
||||
}
|
||||
}
|
||||
})
|
||||
// Back up: the desktop reports it available again, and the same phone socket reaches it.
|
||||
// Back up: the desktop relays to it again, and the same phone socket reaches it.
|
||||
await expect
|
||||
.poll(async () => (await listedHost(socket, serverHostId))?.health, {
|
||||
.poll(async () => (await listedHost(socket, serverHostId))?.relay, {
|
||||
timeout: 90_000,
|
||||
intervals: [2_000]
|
||||
})
|
||||
.toBe('available')
|
||||
.toBe('ready')
|
||||
const reopened = await call(
|
||||
socket,
|
||||
{ id: 'ps-restarted', ...list, executionHost: serverHostId },
|
||||
|
||||
Reference in New Issue
Block a user