You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ed65c9e
Browse filesBrowse the repository at this point in the historyBrowse files
fix(workbot): reconnect the computer view and rebuild outdated ones (#6432)
The desktop guest's WebSocket upgrade handler read the outer `transport`
("vnc" or "screencast") inside a callback that later declared its own
`const transport`, so every viewer connection threw a ReferenceError and
took the guest down. The Browser and Computer views retried until they
showed "Connection lost", and rebuilding could not help because every
computer runs the same guest. The VNC handle is now called `vnc`, and a
test runs the bundled guest and opens both kinds of viewer socket.
When the viewer finds a computer out of date, Workbot now rebuilds it and
connects, instead of asking the person to press Rebuild. Concurrent viewers
share one rebuild, and a running turn is never stopped by it. If a fresh
computer is still out of date, Workbot no longer suggests rebuilding again.
Signed-off-by: Jalil <reachjalil@gmail.com>
assert.deepEqual(awaitoutdated.json(),{error: "desktop_outdated",message: "Your computer needs an update before it can connect. Rebuild it, or ask your workspace admin if that doesn't help."})
179
+
// The Browser view and the chat's live glimpse open together: one rebuild, then both connect.
// Rebuilding stops a running turn, so while one runs the person decides.
185
+
current=false
186
+
busy=true
187
+
constwaiting=awaitopen()
188
+
assert.equal(waiting.status,409)
189
+
assert.deepEqual(awaitwaiting.json(),{error: "desktop_outdated",message: "Your computer needs an update before it can connect. Rebuild it, or ask your workspace admin if that doesn't help."})
190
+
assert.equal(rebuilds.length,1)
191
+
// A fresh computer that is still out of date needs an operator, not another rebuild.
192
+
busy=false
193
+
stillOutdated=true
194
+
assert.deepEqual(await(awaitopen()).json(),{error: "desktop_outdated",message: "Your computer still needs an update after rebuilding. Ask your workspace admin for help."})
195
+
assert.equal(rebuilds.length,2)
196
+
})
197
+
198
+
test("Computer asks to reconnect for other desktop failures",asynct=>{
if(code==="desktop_outdated")returnc.json({error: code,message: "Your computer needs an update before it can connect. Rebuild it, or ask your workspace admin if that doesn't help."},409)
230
+
/**
231
+
* The runner's desktop codes in the person's words; anything else reads as a reconnectable outage. `rebuilt`: Workbot
232
+
* already rebuilt the computer, so rebuilding again won't help.
if(code==="desktop_outdated")returnc.json({error: code,message: rebuilt ? "Your computer still needs an update after rebuilding. Ask your workspace admin for help." : "Your computer needs an update before it can connect. Rebuild it, or ask your workspace admin if that doesn't help."},409)
234
237
returnc.json({error: "desktop_unavailable",message: "Your computer is unavailable. Try reconnecting."},409)
235
238
}
239
+
/** One automatic rebuild per computer at a time: the Browser view and the chat's live glimpse can both find it outdated. */
0 commit comments