refactor(framework): Disable gRPC Control API by default - #8093
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The behavior change is localized, covered by a targeted test, and does not introduce risky control-flow or interface changes.
Pull request overview
This PR refactors SuperLink startup so the gRPC Control API is disabled by default and can be explicitly enabled via an environment variable, aligning the default runtime posture with a more restricted exposed surface.
Changes:
- Gate
SuperLinkLifespan._start_control_api()behindFLWR_INTERNAL_GRPC_CONTROL_API=1. - Add a regression test verifying the gRPC Control API only starts when explicitly opted in.
- Update CLI comments/log messages to reflect the new behavior.
Review Notes
Critical issues
- None found.
Simplicity/readability suggestions
- The new “Control HTTP API” start log is redundant because only a single FastAPI/Uvicorn server is started (same host/port); consider consolidating logs.
- One updated comment still implies FastAPI serves only “Runtime HTTP”, but the FastAPI app also includes Control routes.
Consistency concerns
- The
"1"env-var opt-in pattern matches other toggles already used in the codebase (e.g., update check/event log toggles).
Should this PR be split?
- No.
Verdict
- Good change overall; a couple of small messaging cleanups suggested in review comments.
File summaries
| File | Description |
|---|---|
| framework/py/flwr/superlink/cli/flower_superlink.py | Gate gRPC Control API startup behind an opt-in env var; adjust CLI comments/logging. |
| framework/py/flwr/superlink/cli/flower_superlink_test.py | Add test coverage for the new opt-in behavior. |
| framework/py/flwr/common/constant.py | Introduce FLWR_INTERNAL_GRPC_CONTROL_API constant for the new toggle. |
Review details
Suppressed comments (1)
framework/py/flwr/superlink/cli/flower_superlink.py:530
- Two INFO logs announce starting separate Runtime and Control HTTP APIs on the same host/port, but only one Uvicorn/FastAPI server is started here. This is redundant and can confuse operators into thinking there are multiple listeners; consider logging a single combined message.
log(
INFO,
"Starting the SuperLink Runtime HTTP API on %s:%s.",
lifespan_config.host,
lifespan_config.port,
)
log(
INFO,
"Starting the SuperLink Control HTTP API on %s:%s.",
lifespan_config.host,
lifespan_config.port,
)
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0c9e009cc4
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
No description provided.