-
Notifications
You must be signed in to change notification settings - Fork 122
loopd: fix crash in instant if no --experimental #1030
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
loopd: fix crash in instant if no --experimental #1030
Conversation
Previously the daemon crashed with a panic. Now the CLI returns the following message: [loop] rpc error: code = Unimplemented desc = Restart loop with --experimental
Summary of ChangesHello @starius, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical stability issue in the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request addresses a crash that occurs when instant out features are used without the --experimental flag. The fix involves adding nil checks for instantOutManager in InstantOut, InstantOutQuote, and ListInstantOuts, which correctly prevents a panic and instead returns an informative error. My review includes a suggestion to refactor the duplicated check into a helper function to improve code maintainability.
| if s.instantOutManager == nil { | ||
| return nil, status.Error(codes.Unimplemented, | ||
| "Restart loop with --experimental") | ||
| } |
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.
This check is duplicated in InstantOutQuote (line 1537) and ListInstantOuts (line 1561). To improve maintainability and reduce code duplication, consider extracting this logic into a private helper method on swapClientServer.
For example:
func (s *swapClientServer) requireInstantOutManager() error {
if s.instantOutManager == nil {
return status.Error(codes.Unimplemented, "Restart loop with --experimental")
}
return nil
}You could then call this helper at the beginning of InstantOut, InstantOutQuote, and ListInstantOuts:
if err := s.requireInstantOutManager(); err != nil {
return nil, err
}This would also make the code more consistent, as ListReservations has a similar check for reservationManager.
Previously the daemon crashed with a panic. Now the CLI returns the following message:
Pull Request Checklist
release_notes.mdif your PR contains major features, breaking changes or bugfixes