Skip to content

Optimize the code#3

Merged
kerthcet merged 5 commits into
InftyAI:mainfrom
kerthcet:cleanup/optimize-code
May 27, 2026
Merged

Optimize the code#3
kerthcet merged 5 commits into
InftyAI:mainfrom
kerthcet:cleanup/optimize-code

Conversation

@kerthcet
Copy link
Copy Markdown
Member

What this PR does / why we need it

Which issue(s) this PR fixes

Fixes #

Special notes for your reviewer

Does this PR introduce a user-facing change?


kerthcet added 2 commits May 27, 2026 21:45
Signed-off-by: kerthcet <kerthcet@gmail.com>
Signed-off-by: kerthcet <kerthcet@gmail.com>
Copilot AI review requested due to automatic review settings May 27, 2026 20:55
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Despite the title "Optimize the code", this PR is primarily a feature/refactor change that introduces WebSocket subprotocol versioning (sandd.v1) between the daemon client and the server, renames the public Python execute_command keyword from timeout_secs to timeout, and reduces noise in the heartbeat monitor log. It also tidies up trailing whitespace in docs/PROTOCOL.md and expands the simple command example to iterate over all daemons and test multiple commands.

Changes:

  • Add WebSocket Sec-WebSocket-Protocol: sandd.v1 negotiation on both server (Axum handler) and daemon (tokio-tungstenite client request), with docs in PROTOCOL.md.
  • Rename the public Python execute_command parameter timeout_secstimeout in PyO3 binding, Python wrapper, README, and the example script (wire protocol field timeout_secs is unchanged).
  • Simplify the heartbeat monitor log to only show registry.count(), and reorder route registration.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
server/src/server.rs Adds HeaderMap + subprotocol negotiation in websocket_handler; simplifies heartbeat log; reorders /stats and /health routes.
server/src/lib.rs Renames PyO3 keyword timeout_secstimeout; still serializes to wire field timeout_secs.
sandd/src/main.rs Builds a manual IntoClientRequest to send Sec-WebSocket-Protocol: sandd.v1, and logs the negotiated protocol from the response.
python/sandd/init.py Updates execute_command signature and docstring to use timeout.
README.md Updates example to use timeout= kwarg.
examples/simple_command_test.py Iterates over all daemons and runs multiple test commands (success, intentional error, echo).
docs/PROTOCOL.md Documents subprotocol versioning; strips trailing whitespace on Direction lines.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread server/src/server.rs
Comment thread server/src/server.rs Outdated
Comment thread server/src/lib.rs
Comment thread server/src/server.rs Outdated
kerthcet added 3 commits May 27, 2026 22:04
Signed-off-by: kerthcet <kerthcet@gmail.com>
Signed-off-by: kerthcet <kerthcet@gmail.com>
Signed-off-by: kerthcet <kerthcet@gmail.com>
@kerthcet kerthcet merged commit 1584824 into InftyAI:main May 27, 2026
5 checks passed
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