Skip to content
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

Conversation

ravicious
Copy link
Member

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 inside case '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 no attempt 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 then startAgent would return an error if the versions were incompatible?


This PR aims to implement this.

@ravicious
Copy link
Member Author

I tested this using packaged versions with my Cloud cluster by manipulating -c.extraMetadata.version= passed to yarn package-term.

@gzdunek
Copy link
Contributor

gzdunek commented Sep 27, 2023

image

Should we change "Failed to verify agent binary" to "Failed to check agent version"? For the processing state we have "Checking agent version", so it would match it more.

EDIT: Or maybe not, it could be confusing.

Copy link
Contributor

@gzdunek gzdunek left a 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 {
Copy link
Contributor

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?

Copy link
Member Author

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.

Comment on lines +388 to +395
} 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
);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@ravicious
Copy link
Member Author

Should we change "Failed to verify agent binary" to "Failed to check agent version"? For the processing state we have "Checking agent version", so it would match it more.

EDIT: Or maybe not, it could be confusing.

Right, the biggest hurdle is that it's not only checking the version but also downloading it.

@ravicious ravicious force-pushed the ravicious/agent-compatibility-fixes branch from 2b72f0a to c5f76e2 Compare September 27, 2023 12:48
@ravicious ravicious merged commit c5f76e2 into gzdunek/agent-compatibility-fixes Sep 27, 2023
@ravicious ravicious deleted the ravicious/agent-compatibility-fixes branch September 27, 2023 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants