-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Check compatibility when autostarting, not before autostart #32638
Check compatibility when autostarting, not before autostart #32638
Conversation
I tested this using packaged versions with my Cloud cluster by manipulating |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is much better now, thanks!
@@ -49,7 +49,7 @@ export function checkAgentCompatibility( | |||
: 'incompatible'; | |||
} | |||
|
|||
export function CompatibilityError(): JSX.Element { | |||
export function CompatibilityError(props: { showAlert: boolean }): JSX.Element { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hideAlert?: boolean
maybe? Usually we want to show the alert, so perhaps it is better to crate a special case for hiding it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think I'm going to do hideAlert
with a default to false.
} catch (error) { | ||
// Turn off autostart if it fails, otherwise the user wouldn't be able to turn it off by | ||
// themselves. | ||
workspacesService.setConnectMyComputerAutoStart( | ||
rootClusterUri, | ||
false | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Right, the biggest hurdle is that it's not only checking the version but also downloading it. |
2b72f0a
to
c5f76e2
Compare
Responding to this comment: #32477 (comment)
The check for
!isAgentConfigured
was was added here: #31951 (comment)I originally wanted to make it so that if the agent is not started and there's a compatibility error, we show an error indicator. However, the indicator shouldn't be shown if the agent is not configured. Otherwise we'd show the error if versions are incompatible even if the user never touched Connect My Computer.
Instead of adding
isAgentConfigured
insidecase 'not-started'
, I assumed that there's no reason to show the indicator at all if the agent is not configured, hence this guard clause.What we really want to ask is "Was the agent not autostarted because of a compatibility error?". But the check for compatibility is done from outside of any
useAsync
call, so there's noattempt
object we could inspect.I was going to say that this isn't necessarily bad and that if
startAgent
entered an error state because of compatibility issues, we'd have to add a special check for that as well. But is it actually true?Wouldn't it make the code less complex if
shouldAutoStartAgent
didn't look at agent compatibility, merely check if the compatibility is known, and thenstartAgent
would return an error if the versions were incompatible?This PR aims to implement this.