Skip to content
Open
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
4 changes: 4 additions & 0 deletions openhack/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ class ProviderSpec:
"deepinfra", "DeepInfra", "https://api.deepinfra.com/v1/openai",
"DEEPINFRA_API_KEY", "meta-llama/Llama-3.3-70B-Instruct",
),
"runcrate": ProviderSpec(
"runcrate", "Runcrate", "https://api.runcrate.ai/v1",
"RUNCRATE_API_KEY", "Qwen/Qwen3-235B-A22B-Instruct-2507",
),
"nebius": ProviderSpec(
"nebius", "Nebius Token Factory", "https://api.tokenfactory.nebius.com/v1",
"NEBIUS_API_KEY", "meta-llama/Llama-3.3-70B-Instruct",
Expand Down
18 changes: 18 additions & 0 deletions tests/test_providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,24 @@ def test_model_override_and_base_override(monkeypatch):
assert r2.model == "o3"


def test_resolve_runcrate_reads_key_and_base(monkeypatch):
monkeypatch.setenv("RUNCRATE_API_KEY", "rc-test")
monkeypatch.setattr(providers, "get_credential", lambda name: None)
Comment on lines +127 to +128

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Local overrides break the test

If a developer has RUNCRATE_BASE_URL or RUNCRATE_MODEL set, resolve() correctly uses that override, but this test fails because it expects the defaults. Clear both variables with monkeypatch.delenv(..., raising=False) before resolving so the test does not depend on the developer’s environment.

Suggested change
monkeypatch.setenv("RUNCRATE_API_KEY", "rc-test")
monkeypatch.setattr(providers, "get_credential", lambda name: None)
monkeypatch.setenv("RUNCRATE_API_KEY", "rc-test")
monkeypatch.delenv("RUNCRATE_BASE_URL", raising=False)
monkeypatch.delenv("RUNCRATE_MODEL", raising=False)
monkeypatch.setattr(providers, "get_credential", lambda name: None)
Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/test_providers.py
Line: 127-128

Comment:
**Local overrides break the test**

If a developer has `RUNCRATE_BASE_URL` or `RUNCRATE_MODEL` set, `resolve()` correctly uses that override, but this test fails because it expects the defaults. Clear both variables with `monkeypatch.delenv(..., raising=False)` before resolving so the test does not depend on the developer’s environment.

```suggestion
    monkeypatch.setenv("RUNCRATE_API_KEY", "rc-test")
    monkeypatch.delenv("RUNCRATE_BASE_URL", raising=False)
    monkeypatch.delenv("RUNCRATE_MODEL", raising=False)
    monkeypatch.setattr(providers, "get_credential", lambda name: None)
```

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Codex Fix in Claude Code Fix in Cursor Fix in Conductor

assert "runcrate" in providers.list_providers()
r = providers.resolve("runcrate")
assert r.name == "runcrate"
assert r.base_url == "https://api.runcrate.ai/v1"
assert r.api_key == "rc-test"
assert r.missing_key_env is None
assert r.model == "Qwen/Qwen3-235B-A22B-Instruct-2507"


def test_resolve_runcrate_reports_missing_key(monkeypatch):
monkeypatch.delenv("RUNCRATE_API_KEY", raising=False)
monkeypatch.setattr(providers, "get_credential", lambda name: None)
assert providers.resolve("runcrate").missing_key_env == "RUNCRATE_API_KEY"


def test_ollama_is_keyless(monkeypatch):
monkeypatch.delenv("OLLAMA_API_KEY", raising=False)
r = providers.resolve("ollama")
Expand Down