Skip to content

fix: update health checks to use new ModelFacade client API#470

Open
andreatgretel wants to merge 1 commit intomainfrom
andreatgretel/fix/health-checks-facade-api
Open

fix: update health checks to use new ModelFacade client API#470
andreatgretel wants to merge 1 commit intomainfrom
andreatgretel/fix/health-checks-facade-api

Conversation

@andreatgretel
Copy link
Copy Markdown
Contributor

📋 Summary

The ModelFacade constructor was refactored in #373 to require a ModelClient instead of a SecretResolver, but scripts/health_checks.py was never updated. This causes a TypeError (exit code 2) on every Health Checks workflow run since March 9.

🐛 Fixed

  • Updated scripts/health_checks.py to use create_model_client() factory and pass the resulting client to ModelFacade via the client keyword argument

🤖 Generated with AI

The ModelFacade constructor was refactored in #373 to accept a
ModelClient instead of a SecretResolver. The health_checks.py script
was not updated, causing a TypeError (exit code 2) on every run
since March 9.
@andreatgretel andreatgretel requested a review from a team as a code owner March 30, 2026 12:33
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 30, 2026

Greptile Summary

This one-file fix restores the Health Checks workflow by updating scripts/health_checks.py to match the ModelFacade API introduced in #373. The old positional call ModelFacade(model_config, secret_resolver, provider_registry) was passing a SecretResolver where a ModelClient is now expected; the new code correctly creates the client first via create_model_client(model_config, secret_resolver, provider_registry) and then constructs ModelFacade(model_config, provider_registry, client=client), which matches both signatures exactly.

Key changes:

  • Added from data_designer.engine.models.clients.factory import create_model_client import
  • Replaced single broken ModelFacade(...) call with the two-step client-then-facade construction pattern

Minor pre-existing issue:

  • scripts/health_checks.py is missing from __future__ import annotations, which AGENTS.md requires in every Python source file. Worth adding while the file is already being touched.

Confidence Score: 5/5

Safe to merge — the fix correctly aligns the health-check script with the current ModelFacade API, resolving an ongoing workflow breakage with no regressions.

The only remaining finding is a pre-existing P2 style issue (from future import annotations) that has no impact on runtime behavior. All P0/P1 concerns are addressed by the fix itself.

No files require special attention beyond the optional from __future__ import annotations cleanup in scripts/health_checks.py.

Important Files Changed

Filename Overview
scripts/health_checks.py Updated _check_model to use create_model_client() factory and pass the resulting client to ModelFacade via the client= keyword argument, correctly aligning with the constructor signature introduced in #373. Only a pre-existing from __future__ import annotations omission remains.

Sequence Diagram

sequenceDiagram
    participant HC as health_checks.py
    participant F as create_model_client()
    participant SR as EnvironmentResolver
    participant PR as ModelProviderRegistry
    participant MF as ModelFacade

    HC->>SR: EnvironmentResolver()
    HC->>PR: _get_provider_registry(provider_name)
    HC->>F: create_model_client(model_config, secret_resolver, provider_registry)
    F->>SR: resolve(api_key_ref)
    F->>PR: get_provider(model_config.provider)
    F-->>HC: client (OpenAICompatibleClient / AnthropicClient)
    HC->>MF: ModelFacade(model_config, provider_registry, client=client)
    MF-->>HC: facade
    HC->>MF: facade.generate(...) or facade.generate_text_embeddings(...)
Loading

Comments Outside Diff (1)

  1. scripts/health_checks.py, line 1-11 (link)

    P2 Missing from __future__ import annotations

    AGENTS.md lists this as a structural invariant: "from __future__ import annotations — required in every Python source file." This file is missing that import. Since this file is already being updated in this PR, it's a good time to add it.

    Context Used: AGENTS.md (source)

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: scripts/health_checks.py
    Line: 1-11
    
    Comment:
    **Missing `from __future__ import annotations`**
    
    `AGENTS.md` lists this as a structural invariant: *"`from __future__ import annotations` — required in every Python source file."* This file is missing that import. Since this file is already being updated in this PR, it's a good time to add it.
    
    
    
    **Context Used:** AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=95f8243f-5118-40bc-a3ab-69210b72e57e))
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: scripts/health_checks.py
Line: 1-11

Comment:
**Missing `from __future__ import annotations`**

`AGENTS.md` lists this as a structural invariant: *"`from __future__ import annotations` — required in every Python source file."* This file is missing that import. Since this file is already being updated in this PR, it's a good time to add it.

```suggestion
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

from __future__ import annotations

"""Health checks for all predefined model providers.

Verifies that each model in each provider can respond to a basic request.
Providers without an API key set in the environment are skipped.

Usage:
    uv run python scripts/health_checks.py
"""
```

**Context Used:** AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=95f8243f-5118-40bc-a3ab-69210b72e57e))

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix: update health checks to use new Mod..." | Re-trigger Greptile

@andreatgretel
Copy link
Copy Markdown
Contributor Author

Health checks pipeline is passing again on this branch: https://github.com/NVIDIA-NeMo/DataDesigner/actions/runs/23749207791

All providers passed in 36s (previously failing with exit code 2 since March 9).

Copy link
Copy Markdown
Contributor

@nabinchha nabinchha left a comment

Choose a reason for hiding this comment

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

Thanks @andreatgretel!

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