Skip to content

PEN-110: expose daemon models for distributed onboarding#78

Merged
wauputr4 merged 2 commits into
mainfrom
agent/dimas/028a9b8f
Jun 9, 2026
Merged

PEN-110: expose daemon models for distributed onboarding#78
wauputr4 merged 2 commits into
mainfrom
agent/dimas/028a9b8f

Conversation

@wauputr4

@wauputr4 wauputr4 commented Jun 9, 2026

Copy link
Copy Markdown
Member

Summary

  • include live healthy daemon-advertised model IDs in the authenticated /v1/models response without exposing daemon node metadata
  • add coverage for daemon model visibility, stale/disabled/unhealthy filtering, and route duplicate handling
  • document self-serve distributed onboarding and add scripts/distributed-onboarding-smoke.sh

Links

Verification

  • PASS: git diff --check
  • PASS: bash -n scripts/distributed-onboarding-smoke.sh
  • BLOCKED: cargo fmt --all -- --check and CARGO_TARGET_DIR=/tmp/mizan-cargo-target-pen-110 cargo test -p mizan-api providers::tests::list_public_models -- --nocapture (cargo is not installed in this runtime)

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

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 refactors the public models listing API to include capabilities from active, healthy, and non-stale daemon nodes, and adds automated smoke tests and documentation for self-serve distributed onboarding. The review feedback highlights two key improvements: first, making the list_models API more resilient by gracefully skipping daemon nodes with malformed JSON rather than failing the entire request with a 500 error; second, securing the json_field helper in the smoke test script by passing arguments to Python via sys.argv instead of direct shell variable interpolation.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +318 to +322
for (provider_family, model_ids_json) in daemon_rows {
for model_id in parse_json_vec(&model_ids_json, "daemon_node.model_ids_json")? {
if !seen_model_ids.insert(model_id.clone()) {
continue;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

If a single daemon node has corrupted or invalid JSON in model_ids_json, calling list_models will fail the entire request with a 500 Internal Server Error due to the use of the ? operator on parse_json_vec.\n\nTo make the public models listing API more resilient and fault-tolerant, we should log a warning and skip the misconfigured daemon node instead of failing the entire API call.

    for (provider_family, model_ids_json) in daemon_rows {\n        let model_ids = match parse_json_vec(&model_ids_json, "daemon_node.model_ids_json") {\n            Ok(ids) => ids,\n            Err(error) => {\n                warn!(error = %error, "failed to parse daemon node model IDs, skipping node");\n                continue;\n            }\n        };\n        for model_id in model_ids {\n            if !seen_model_ids.insert(model_id.clone()) {\n                continue;\n            }

Comment on lines +10 to +12
json_field() {
python3 -c 'import json,sys; data=json.load(sys.stdin); print(data["'$1'"])'
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Directly interpolating the shell variable $1 into the Python script string can lead to syntax errors or command injection vulnerabilities if the field name contains special characters.\n\nIt is safer and more robust to pass the field name as a command-line argument to the Python process and access it via sys.argv.

Suggested change
json_field() {
python3 -c 'import json,sys; data=json.load(sys.stdin); print(data["'$1'"])'
}
json_field() {\n python3 -c 'import json,sys; data=json.load(sys.stdin); print(data[sys.argv[1]])' "$1"\n}

Co-authored-by: multica-agent <github@multica.ai>
Co-authored-by: multica-agent <github@multica.ai>
@wauputr4 wauputr4 merged commit f165175 into main Jun 9, 2026
1 check passed
@wauputr4 wauputr4 deleted the agent/dimas/028a9b8f branch June 9, 2026 06:06
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.

1 participant