-
Notifications
You must be signed in to change notification settings - Fork 2
Handle early agent-info messages #14
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?
Conversation
Summary of ChangesHello @backkem, 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 significantly enhances the network communication layer by introducing a Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. 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 introduces a NetworkStateMachine to wrap the existing Spake2StateMachine, enabling more flexible message routing during the authentication phase. This is a crucial change that allows the system to gracefully handle non-authentication messages, such as agent-info messages, which can arrive before authentication is complete, preventing DecodeFailed crashes. The message encoding and decoding logic has been refactored to use RFC 9000 variable-length integers for type keys, improving adherence to the OpenScreen Protocol specification. The introduction of decode_body methods for various message types also enhances modularity and clarity in the serialization logic. Overall, this is a well-structured change that improves robustness and protocol compliance.
| log::debug!( | ||
| "Received agent-info-response during network phase, storing as unverified" | ||
| ); | ||
| // TODO: parse AgentInfoResponse, populate self.peer_agent_info |
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.
0c59806 to
963383a
Compare
|
Rebase and fixed the lint. Technically this is mergeable as-is, it does move things forward slightly. |
Note: Marking this as a draft for now but with the purpose to solicit early feedback.
Summary
NetworkStateMachinewrapper aroundSpake2StateMachinethat peeks type keys and routes: auth (1001-1005) →SPAKE2, agent-info (10-13, 120) → skip, unknown → skip
DecodeFailedcrash when peer sends agent-info-request during authentication (spec-allowed perapplication.bs §4.1)
Agent-Info handling
I suggest to handle Agent-info messages at the network level because the spec
allows them before authentication completes. The network layer recognises
the type keys and stores raw metadata (display name, opaque capability
codes) as unverified
PeerAgentInfo. Interpreting capabilities (mappingu64codes toAgentCapabilityvariants likeReceiveVideoorControlPresentation) remains in the application crate, which is theonly layer that assigns semantic meaning to those values.
Application vs Network abstraction
I think there may also be room to make the split between both protocol layers more stricts. For reference, here's what i did on the Go side for the network protocol: