Repository navigation
fix(server): device_open finds a booted AVD by name and says when the device list failed #30289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 9 commits
2edae13
de2724b
1feef5a
dd0fed0
ca52209
984d245
149d343
044d489
111ec52
0125d13
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -168,21 +168,28 @@ const pickDevice = Effect.fn("handlers.pickDevice")(function* ( | |
| if (input.deviceId !== undefined) { | ||
| const { deviceId, hostId } = input; | ||
| const devices = yield* DeviceService.DeviceService; | ||
| const located = yield* devices.locateDevice({ deviceId, hostId }).pipe(mapLocateErrors); | ||
| if (Option.isSome(located)) return located.value; | ||
| const target = | ||
| hostId === undefined | ||
| ? undefined | ||
| : (state.hosts.find((host) => host.id === hostId) ?? { id: hostId }); | ||
| const failures = failedHosts(state, target === undefined ? state.hosts : [target]).map( | ||
| ({ host, detail }) => `${hostName(host)} failed to start: ${detail}`, | ||
| // A failed refresh keeps the previous devices, so the device may be there unlisted. | ||
| const failures = failedHosts(state, target === undefined ? state.hosts : [target]); | ||
| const located = yield* devices.locateDevice({ deviceId, hostId }).pipe( | ||
| Effect.catchTags({ | ||
| DeviceOnOtherHostError: (error) => | ||
| failures.length > 0 ? Effect.succeedNone : Effect.fail(error), | ||
| }), | ||
| mapLocateErrors, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Report refresh failures before unresolved AVD-name ambiguity. When a failed host retains a When no exact ID matches, prioritize relevant refresh failures over AVD-name ambiguity. Preserve ambiguity errors for exact-ID matches. Extend the failure-reporting test with this retained-entry case.
|
||
| ); | ||
| // An AVD-name match could be on another host than the one whose list failed. | ||
| if (Option.isSome(located) && (failures.length === 0 || located.value.id === deviceId)) { | ||
| return located.value; | ||
| } | ||
| return yield* new DeviceToolUnavailableError({ | ||
| reason: [ | ||
| `No device ${deviceId} on ${target === undefined ? "any host" : hostName(target)}.`, | ||
| ...failures, | ||
| "Call device_list for current ids.", | ||
| ].join(" "), | ||
| reason: | ||
| failures.length > 0 | ||
| ? `Device ${deviceId} is not in the last device list, and listing devices failed on ${failures.map(({ host, detail }) => `${hostName(host)} (${detail})`).join(", ")}. Call device_list to retry.` | ||
| : `No device ${deviceId} on ${target === undefined ? "any host" : hostName(target)}. Call device_list for current ids.`, | ||
| }); | ||
| } | ||
| const hostId = input.hostId ?? LOCAL_DEVICE_HOST_ID; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.