Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions bindings/python/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ struct Router {
/// New parameters MUST be appended here (not inserted mid-list) to avoid
/// breaking external Python callers that pass `_Router(...)` positionally.
drain_settle_secs: u64,
enable_wasm: bool,
}

impl Router {
Expand Down Expand Up @@ -749,6 +750,7 @@ impl Router {
.maybe_tool_call_parser(self.tool_call_parser.as_ref())
.maybe_mcp_config_path(self.mcp_config_path.as_ref())
.maybe_storage_hook_wasm_path(self.storage_hook_wasm_path.as_deref())
.enable_wasm(self.enable_wasm)
.dp_aware(self.dp_aware)
.retries(!self.disable_retries)
.circuit_breaker(!self.disable_circuit_breaker)
Expand Down Expand Up @@ -879,6 +881,7 @@ impl Router {
mesh_peer_urls = vec![],
mesh_advertise_host = None,
drain_settle_secs = 5,
enable_wasm = false,
))]
Comment thread
coderabbitai[bot] marked this conversation as resolved.
#[expect(clippy::too_many_arguments)]
#[expect(
Expand Down Expand Up @@ -994,6 +997,7 @@ impl Router {
mesh_peer_urls: Vec<String>,
mesh_advertise_host: Option<String>,
drain_settle_secs: u64,
enable_wasm: bool,
) -> PyResult<Self> {
let mut all_urls = worker_urls.clone();

Expand Down Expand Up @@ -1119,6 +1123,7 @@ impl Router {
mesh_port,
mesh_peer_urls,
drain_settle_secs,
enable_wasm,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The parameter enable_wasm: bool is missing from the function signature of Router::new (around line 1000). This will cause a compilation error because enable_wasm is not in scope when initializing the Router struct at line 1125, and the PyO3 signature macro will also fail to match the function arguments.

Please update the new function signature in bindings/python/src/lib.rs to include enable_wasm: bool:

    fn new(
        // ...
        drain_settle_secs: u64,
        enable_wasm: bool,
    ) -> PyResult<Self> {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Add enable_wasm to the Rust constructor parameters

When building the Python bindings, this initializer now uses enable_wasm, but fn new still has no enable_wasm argument—the parameter list above still ends at drain_settle_secs. In any build of the Python extension with this commit, the Rust compiler has no local named enable_wasm here, so the bindings fail to compile instead of exposing the new CLI flag.

Useful? React with 👍 / 👎.

})
}

Expand Down
8 changes: 8 additions & 0 deletions bindings/python/src/smg/router_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ class RouterArgs:
mcp_config_path: str | None = None
# Backend selection
backend: str = "sglang"
# WASM support
enable_wasm: bool = False
# Storage hooks (WASM)
storage_hook_wasm_path: str | None = None
# History backend configuration
Expand Down Expand Up @@ -892,6 +894,12 @@ def add_cli_args(
choices=["sglang", "openai", "anthropic"],
help="Backend runtime to use (default: sglang)",
)
backend_group.add_argument(
f"--{prefix}enable-wasm",
action="store_true",
default=None,
help="Enable WebAssembly (WASM) module support",
Comment thread
coderabbitai[bot] marked this conversation as resolved.
)
backend_group.add_argument(
f"--{prefix}storage-hook-wasm-path",
type=str,
Expand Down
3 changes: 3 additions & 0 deletions deploy/helm/smg/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@ Called from the router Deployment template.
- "--rate-limit-tokens-per-second"
- {{ .Values.auth.rateLimitTokensPerSecond | quote }}
{{- end }}
{{- if .Values.router.wasm.enabled }}
- "--enable-wasm"
{{- end }}
{{- if .Values.router.wasm.path }}
- "--storage-hook-wasm-path"
- {{ .Values.router.wasm.path | quote }}
Expand Down
1 change: 1 addition & 0 deletions deploy/helm/smg/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ router:

# -- Optional features
wasm:
enabled: false
path: ""
mcp:
enabled: false
Expand Down
Loading