Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

feat(model-hub): enable Model Hub by default (#1917)

Call White06f444c13d5c
diff --git a/config/v2_config.py b/config/v2_config.py
index e097c6888..387daac04 100644
--- a/config/v2_config.py
+++ b/config/v2_config.py
@@ -1491,10 +1491,10 @@ _MODEL_HUB_CREDENTIAL_QUERY_KEYS = {
def is_model_hub_enabled(environ: Optional[Mapping[str, str]] = None) -> bool:
- """Return the backend-authoritative Model Hub release capability."""
+ """Enable Model Hub by default, honoring an explicit deployment override."""
source = os.environ if environ is None else environ
- return source.get(MODEL_HUB_ENABLED_ENV, "").strip().lower() in {"1", "true", "yes", "on"}
+ return source.get(MODEL_HUB_ENABLED_ENV, "1").strip().lower() in {"1", "true", "yes", "on"}
def _validate_optional_datetime(value: object, field_path: str) -> Optional[str]:
diff --git a/core/controller.py b/core/controller.py
index c35323a8c..1a8797b60 100644
--- a/core/controller.py
+++ b/core/controller.py
@@ -559,7 +559,7 @@ class Controller:
pending.clear()
def _init_model_hub(self) -> None:
- """Own the CPA dependency and opt in to the full Model Hub aggregate."""
+ """Own the CPA dependency and the default-on Model Hub aggregate."""
from config.v2_config import V2Config, is_model_hub_enabled
from vibe.model_hub_runtime import get_model_hub_engine_adapter
diff --git a/docs/plans/model-hub-e2e-test-plan.md b/docs/plans/model-hub-e2e-test-plan.md
index b9bdeee10..17992bfc0 100644
--- a/docs/plans/model-hub-e2e-test-plan.md
+++ b/docs/plans/model-hub-e2e-test-plan.md
@@ -217,7 +217,8 @@ lane-to-lane.
- `VIBE_E2E_BASE_URL` — target Avibe UI origin (default `http://127.0.0.1:5123`).
- `VIBE_E2E_MOCK_UPSTREAM_URL` — running mock upstream origin.
-- `VIBE_MODEL_HUB_ENABLED=1` — required for all scenarios.
+- `VIBE_MODEL_HUB_ENABLED` — optional; Model Hub is enabled when absent. Harnesses
+ may explicitly set `1` for isolation or `0` to exercise the disabled surface.
- `VIBE_MODEL_HUB_ENGINE_MANIFEST_PATH` — offline engine manifest override for
hermetic engine install; engine-dependent pytest scenarios must skip (not
fail) with a clear reason when neither this nor GitHub egress is available.
diff --git a/docs/plans/model-hub-implementation.md b/docs/plans/model-hub-implementation.md
index 644928916..97027c491 100644
--- a/docs/plans/model-hub-implementation.md
+++ b/docs/plans/model-hub-implementation.md
@@ -229,7 +229,7 @@ that reconciliation may change content but is not expected to change file owners
| **I4 Sources / Gateway UI** *(tentative; one lane, two increments)* | codex | `ui/src/components/settings/models/**`; `ui/src/i18n/*.json`; `vibe/i18n/*.json`; UI tests. Both i18n trees are I4-exclusive. The current increment consumes the already-specified install/unsupported-host surfaces for AC-38/AC-43; each model row may open frame 02, render the drawing, and consume the chain read projection, but no chain-write caller is wired and Save remains disabled. Exact-chain editing and its UI tests belong to the second increment only after K5's third-round G-32 specification merges. That second increment sends visible noninterrupting hop removal as one ordinary PUT and echoes both refusal-plan arrays unchanged only when protected supply would be interrupted, after I7 freezes both fixtures; the current increment continues to consume master's pre-I7 refusal shape and must not add inactive confirmation fields. It consumes AC-36/37/39–42/44–50 only after K5 round 2 changes their G rows from gaps to contract references and registers the live-backoff presentation; AC-51's read-before-retry client rule activates in the second increment after I7 freezes the deletion/recreate fixture. AC-53's materialization-error `interrupted_pairs` consumer activates only in that second increment after K5 round 2 registers E6 and I7 freezes positive/negative API payload fixtures. AC-54's `accept_unavailable_inventory` producer also belongs to the second increment after K5 round 2 names state ⑤ and I7 freezes both server-result cells; clean creation and pull-origin state ⑤′ never emit it. This is an ordering split inside I4, not a new lane identity. **Revised through the 2026-08-12 04:40 PM ruling.** | current increment: I1 envelopes + K4 contracts; second increment: K5 rounds 1–3 merged + frozen I7/I2/I3 fixtures |
| **I7 contract-completion implementation (backend)** | codex | After K6 merges, exclusive ownership transfers from I1 for `config/v2_config.py`; `core/handlers/model_hub/{service,resolver,classification,rpc,request,errors,events}.py`; `modules/agents/model_hub.py`; `vibe/{ui_server,model_hub_client}.py`; `tests/test_model_hub_config.py`; `tests/test_model_hub_api.py`; and `tests/test_model_hub_resolution.py`. For the Model Hub failure-callback seam only, I7 also exclusively owns `modules/agents/base.py`, `modules/agents/claude_agent.py`, `modules/agents/codex/{agent,event_handler}.py`, `modules/agents/opencode/{agent,poll_loop}.py`, exact cross-backend phase fixtures in `tests/{test_claude_agent_sessions,test_codex_agent,test_opencode_server}.py`, and mechanical signature consumers in `tests/{test_claude_cli_path,test_multi_platform_runtime}.py`. I7 owns AC-35–AC-47 and AC-50–AC-54's backend producers/tests plus AC-48's API/service half. `service.py` is the sole shared guard-plan owner and implements every guard-totality row and the error-to-required-array relation; it also enforces AC-52's both-channel re-auth acknowledgement before any OAuth adapter call and AC-53's materialization-error response condition, and AC-54's unavailable-inventory consent gate against the repeated server observation. `modules/agents/model_hub.py` owns the native classification/state decision: backend callbacks supply raw failure shape and phase only, and no native path writes a persistent network cooldown. The transferred resolver/classifier/event boundary owns `retired: false` filtering and all four network-failure cells; its post-output executor/provenance fixture consumes K6's G-34 row without inventing an outcome id, copy key, or payload shape. I7 delegates OAuth tuple claim/coalescing and terminal-flow expiry to I3's registry; its service/API half branches explicit cancellation by nonce presence, retaining the I3 flow for nonce-bearing reconciliation and forgetting only no-nonce flows. Its first AC-50 mechanical action is the sole owner-authorized I2-file exception: delete the strict xfail marker from `tests/test_model_hub_l3.py::test_probe_transport_failures_await_ac50_backoff_contract` in the same commit that makes its forward contract assertions XPASS; it otherwise consumes I2 managed-Gateway facts and I3 OAuth fixtures without editing their files. It never edits contracts, UI/i18n, scenario trees, or any other I2–I5 file. **Revised through the 2026-08-12 04:40 PM ruling.** | K4 + #1312 + K6 merged; every listed transfer and native callback seam activates only after all three merge |
| **I5 scenario validation** *(tentative)* | codex | `tests/scenarios/model_hub/**` except I3's native-import scenario; `tests/scenario_harness/**` | I1–I4 + I7 |
-| **I6 release-gate removal** *(tentative)* | codex | After I5 merges, exclusive ownership transfers from I1 for `is_model_hub_enabled()` and every call site, `_init_model_hub()`, `core/controller.py`, and `tests/test_controller_model_hub_gate.py`. Delete the gate function rather than leaving a constant-true shell; invert the gate test so the final default state always constructs the v3 aggregate | I5 merged and all Model Hub scenarios green |
+| **I6 default-on availability** *(owner-approved 2026-09-06)* | codex | Replace the shared capability resolver's absent-variable default with enabled; retain its explicit deployment/emergency opt-out. Verify controller aggregate construction, public API/capability projection and internal RPC with no environment opt-in. Saved backend modes, routing, model selection and engine-install consent remain unchanged. This supersedes the historical default-off and full gate-deletion directions below; it is not a constant-true shell. | Owner requested a PR to make Model Hub available by default. Full merged LOCAL live/visual acceptance remains outstanding and is not waived or claimed by this release-default change. |
**Executor ruling (owner, 2026-08-09; I7/K5/K6 registry completed 2026-08-12).** Every new K5, K6, and I1–I7 lane uses
`codex`, including frontend work. Visual-fidelity risk is closed by process rather than
diff --git a/docs/plans/model-hub.md b/docs/plans/model-hub.md
index 540951172..dfa5f4d0c 100644
--- a/docs/plans/model-hub.md
+++ b/docs/plans/model-hub.md
@@ -1562,9 +1562,13 @@ delivery lane. It must not appear as a placeholder third module in the v3 UI.
`OPENCODE_CONFIG` overlay for OpenCode, gateway-config hash tracked for
long-lived `opencode serve`). Native user configs are never written.
- **Availability is default-on.** Absence of `VIBE_MODEL_HUB_ENABLED` cannot disable
- the controller, `/api/models/` routes, or Models UI. I1 deletes the old default-off
- gate; an explicitly configured development/emergency override may disable the surface,
- but no fresh user depends on an environment variable to receive the product default.
+ the controller, `/api/models/` routes, or Models UI. The shared capability resolver
+ defaults to enabled when the variable is absent. Explicit `1`, `true`, `yes`, or
+ `on` enables it (case-insensitive, surrounding whitespace ignored); explicit `0`,
+ `false`, `no`, or `off` disables it for development/emergency use. Explicit empty
+ or unrecognized values remain disabled. No fresh user depends on an environment
+ variable to receive the product default. Availability does not change saved backend
+ modes, model selections, Sources, routes, native configuration, or engine-install consent.
- **Direct (supported diagnostic/self-managed path)**: current behavior —
per-backend native config editing (auth tabs, API key + base URL, writes to
`settings.json` etc.), useful for diagnostics and self-managed setups. On an existing
diff --git a/tests/test_controller_model_hub_gate.py b/tests/test_controller_model_hub_gate.py
index b4efaa4a2..a45183677 100644
--- a/tests/test_controller_model_hub_gate.py
+++ b/tests/test_controller_model_hub_gate.py
@@ -13,7 +13,7 @@ from core.controller import Controller
from modules.agents.model_hub import resolve_model_hub_launch, resolve_opencode_overlay_launch
-def test_controller_leaves_model_hub_aggregate_absent_by_default(monkeypatch):
+def test_controller_leaves_model_hub_aggregate_absent_when_explicitly_disabled(monkeypatch):
import core.handlers.model_hub as model_hub
import vibe.model_hub_runtime as model_hub_runtime
@@ -25,7 +25,7 @@ def test_controller_leaves_model_hub_aggregate_absent_by_default(monkeypatch):
factory_calls += 1
return object()
- monkeypatch.delenv("VIBE_MODEL_HUB_ENABLED", raising=False)
+ monkeypatch.setenv("VIBE_MODEL_HUB_ENABLED", "0")
monkeypatch.setattr(model_hub, "create_default_service", create_service)
monkeypatch.setattr(
model_hub_runtime,
@@ -43,7 +43,8 @@ def test_controller_leaves_model_hub_aggregate_absent_by_default(monkeypatch):
assert factory_calls == 0
-def test_controller_builds_one_model_hub_aggregate_after_explicit_opt_in(monkeypatch):
[email protected]("env_value", [None, "1"])
+def test_controller_builds_one_model_hub_aggregate_by_default_or_explicit_enable(monkeypatch, env_value):
import core.handlers.model_hub as model_hub
import core.handlers.model_hub.turn_gateway as turn_gateway
import modules.agents.model_hub as agent_model_hub
@@ -67,7 +68,10 @@ def test_controller_builds_one_model_hub_aggregate_after_explicit_opt_in(monkeyp
self.service = service
self.turn_gateway = turn_gateway
- monkeypatch.setenv("VIBE_MODEL_HUB_ENABLED", "1")
+ if env_value is None:
+ monkeypatch.delenv("VIBE_MODEL_HUB_ENABLED", raising=False)
+ else:
+ monkeypatch.setenv("VIBE_MODEL_HUB_ENABLED", env_value)
adapter = object()
captured = {}
diff --git a/tests/test_internal_server.py b/tests/test_internal_server.py
index 161f3b502..47b187757 100644
--- a/tests/test_internal_server.py
+++ b/tests/test_internal_server.py
@@ -2190,8 +2190,12 @@ def test_health_endpoint():
assert resp.json() == {"ok": True, "service": "vibe-remote-internal", "version": 1}
-def test_model_hub_rpc_uses_controller_owned_service(monkeypatch):
- monkeypatch.setenv("VIBE_MODEL_HUB_ENABLED", "1")
[email protected]("env_value", [None, "1"])
+def test_model_hub_rpc_uses_controller_owned_service(monkeypatch, env_value):
+ if env_value is None:
+ monkeypatch.delenv("VIBE_MODEL_HUB_ENABLED", raising=False)
+ else:
+ monkeypatch.setenv("VIBE_MODEL_HUB_ENABLED", env_value)
controller = _build_controller_double()
controller.model_hub_service = MagicMock()
controller.model_hub_service.list_sources.return_value = [{"id": "src_owned"}]
@@ -2213,7 +2217,7 @@ def test_model_hub_rpc_uses_controller_owned_service(monkeypatch):
def test_model_hub_rpc_is_stably_disabled_without_touching_service(monkeypatch):
- monkeypatch.delenv("VIBE_MODEL_HUB_ENABLED", raising=False)
+ monkeypatch.setenv("VIBE_MODEL_HUB_ENABLED", "0")
controller = _build_controller_double()
controller.model_hub_service = MagicMock()
app = internal_server.create_app(controller)
@@ -2244,7 +2248,7 @@ def test_model_hub_dependency_rpc_remains_available_when_feature_is_disabled(mon
EngineStatus,
)
- monkeypatch.delenv("VIBE_MODEL_HUB_ENABLED", raising=False)
+ monkeypatch.setenv("VIBE_MODEL_HUB_ENABLED", "0")
controller = _build_controller_double()
controller.model_hub_service = None
controller.model_hub_engine_adapter = SimpleNamespace(
diff --git a/tests/test_memory_disabled_isolation.py b/tests/test_memory_disabled_isolation.py
index 330926ead..95ed63cca 100644
--- a/tests/test_memory_disabled_isolation.py
+++ b/tests/test_memory_disabled_isolation.py
@@ -92,9 +92,56 @@ def _memory_state_entries(home: Path) -> list[Path]:
"memory" in part.casefold() or "everos" in part.casefold()
for part in path.relative_to(home).parts
)
+ # Every config writer uses this legacy-named lock, not just Memory.
+ and not (
+ path.relative_to(home) == Path("config/memory-config.tx.lock")
+ and path.is_file()
+ and not path.is_symlink()
+ )
]
+def test_memory_state_inventory_excludes_only_the_shared_config_lock(
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
+ config = V2Config.default()
+ config.memory = replace(config.memory, enabled=False)
+ config.save()
+
+ assert (tmp_path / "config" / "memory-config.tx.lock").is_file()
+ assert _memory_state_entries(tmp_path) == []
+
+
+ "relative_path,kind",
+ [
+ ("memory", "directory"),
+ ("everos", "directory"),
+ ("config/memory-status.json", "file"),
+ ("config/memory-config.tx.lock.extra", "file"),
+ ("other/memory-config.tx.lock", "file"),
+ ("config/memory-config.tx.lock", "directory"),
+ ("config/memory-config.tx.lock", "symlink"),
+ ],
+)
+def test_memory_state_inventory_keeps_runtime_assets_and_lock_lookalikes(
+ tmp_path: Path, relative_path: str, kind: str,
+) -> None:
+ candidate = tmp_path / relative_path
+ candidate.parent.mkdir(parents=True, exist_ok=True)
+ if kind == "directory":
+ candidate.mkdir()
+ elif kind == "symlink":
+ target = tmp_path / "target"
+ target.touch()
+ candidate.symlink_to(target)
+ else:
+ candidate.touch()
+
+ assert Path(relative_path) in _memory_state_entries(tmp_path)
+
+
def test_memory_cli_session_keeps_authenticated_boundary_when_implementation_is_unavailable() -> None:
controller = Controller.__new__(Controller)
controller.config = types.SimpleNamespace(
@@ -157,8 +204,9 @@ async def _start_disabled_cleanup(
return controller, cleanup_task, record_path
[email protected]("model_hub_env", [None, "0"])
def test_memory_indep_013_disabled_fresh_startup_has_no_runtime_side_effects(
- tmp_path: Path,
+ tmp_path: Path, model_hub_env: str | None,
) -> None:
script = r'''
import asyncio
@@ -167,7 +215,7 @@ from pathlib import Path
from config import paths
from config.v2_compat import to_app_config
-from config.v2_config import V2Config
+from config.v2_config import V2Config, is_model_hub_enabled
from core.controller import Controller
from core.memory_adapter import DisabledMemoryAdapter, TurnAccepted
from modules.im import MessageContext
@@ -188,6 +236,7 @@ config = to_app_config(V2Config.from_payload({
controller = Controller(config)
home = paths.get_vibe_remote_dir()
+assert (controller.model_hub_service is not None) == is_model_hub_enabled()
assert isinstance(controller.memory_adapter, DisabledMemoryAdapter)
assert controller.memory_runtime is None
assert controller.memory_module is None
@@ -197,6 +246,11 @@ assert not [
path for path in home.rglob("*")
if any("memory" in part.casefold() or "everos" in part.casefold()
for part in path.relative_to(home).parts)
+ and not (
+ path.relative_to(home) == Path("config/memory-config.tx.lock")
+ and path.is_file()
+ and not path.is_symlink()
+ )
]
asyncio.run(controller._schedule_disabled_memory_cleanup())
assert controller._memory_disabled_cleanup_task is None
@@ -244,6 +298,9 @@ asyncio.run(offer_capture())
environment["AVIBE_HOME"] = str(home)
environment["HOME"] = str(tmp_path)
environment["PYTHONPATH"] = str(ROOT)
+ environment.pop("VIBE_MODEL_HUB_ENABLED", None)
+ if model_hub_env is not None:
+ environment["VIBE_MODEL_HUB_ENABLED"] = model_hub_env
completed = subprocess.run(
[sys.executable, "-c", script],
@@ -259,8 +316,9 @@ asyncio.run(offer_capture())
assert _memory_state_entries(home) == []
[email protected]("model_hub_env", [None, "0"])
def test_memory_indep_014_disabled_controller_starts_with_runtime_imports_blocked(
- tmp_path: Path,
+ tmp_path: Path, model_hub_env: str | None,
) -> None:
script = r'''
import asyncio
@@ -287,7 +345,7 @@ class BlockMemoryImplementation(importlib.abc.MetaPathFinder):
sys.meta_path.insert(0, BlockMemoryImplementation())
from config.v2_compat import to_app_config
-from config.v2_config import V2Config
+from config.v2_config import V2Config, is_model_hub_enabled
from core import internal_server
from core.controller import Controller
from core.memory_adapter import DisabledMemoryAdapter
@@ -308,6 +366,7 @@ config = to_app_config(V2Config.from_payload({
controller = Controller(config)
internal_server.create_app(controller, memory_ui_secret="test-secret")
status = asyncio.run(controller.memory_status_payload())
+assert (controller.model_hub_service is not None) == is_model_hub_enabled()
assert isinstance(controller.memory_adapter, DisabledMemoryAdapter)
assert controller.memory_runtime is None
assert status == {
@@ -324,6 +383,9 @@ assert not BLOCKED.intersection(sys.modules)
environment["AVIBE_HOME"] = str(tmp_path / "home")
environment["HOME"] = str(tmp_path)
environment["PYTHONPATH"] = str(ROOT)
+ environment.pop("VIBE_MODEL_HUB_ENABLED", None)
+ if model_hub_env is not None:
+ environment["VIBE_MODEL_HUB_ENABLED"] = model_hub_env
completed = subprocess.run(
[sys.executable, "-c", script],
diff --git a/tests/test_model_hub_api.py b/tests/test_model_hub_api.py
index 19f4524a2..55011a888 100644
--- a/tests/test_model_hub_api.py
+++ b/tests/test_model_hub_api.py
@@ -73,8 +73,8 @@ SOURCE_EDIT_VALIDATION_CASES = json.loads(
@pytest.fixture(autouse=True)
-def _enable_model_hub_for_existing_contract_tests(monkeypatch):
- monkeypatch.setenv("VIBE_MODEL_HUB_ENABLED", "1")
+def _use_default_model_hub_release_environment(monkeypatch):
+ monkeypatch.delenv("VIBE_MODEL_HUB_ENABLED", raising=False)
def _schema(name: str) -> dict:
@@ -4637,7 +4637,7 @@ def test_disabled_model_hub_rest_surface_returns_feature_disabled_without_runtim
def unexpected_remote_access_read():
raise AssertionError("disabled Model Hub must short-circuit before remote access config")
- monkeypatch.delenv("VIBE_MODEL_HUB_ENABLED", raising=False)
+ monkeypatch.setenv("VIBE_MODEL_HUB_ENABLED", "0")
monkeypatch.setattr(ui_server, "_load_remote_access_config", unexpected_remote_access_read)
monkeypatch.setattr(
"vibe.model_hub_client.ModelHubRemoteService",
@@ -4669,7 +4669,7 @@ def test_disabled_model_hub_rest_surface_returns_feature_disabled_without_runtim
@pytest.mark.parametrize("method", ["get", "post"])
[email protected](("env_value", "expected"), [(None, False), ("0", False), ("1", True)])
[email protected](("env_value", "expected"), [(None, True), ("0", False), ("1", True)])
def test_config_capability_exactly_projects_backend_model_hub_gate(monkeypatch, tmp_path, method, env_value, expected):
from config.v2_config import is_model_hub_enabled
@@ -5569,7 +5569,7 @@ def test_disabled_gate_preserves_existing_model_hub_config_bytes(monkeypatch):
from config import paths
from core.services.settings import default_config
- monkeypatch.delenv("VIBE_MODEL_HUB_ENABLED", raising=False)
+ monkeypatch.setenv("VIBE_MODEL_HUB_ENABLED", "0")
config = default_config()
config.save()
config_path = paths.get_config_path()
diff --git a/tests/test_model_hub_config.py b/tests/test_model_hub_config.py
index c8adef7c9..64f25d1d0 100644
--- a/tests/test_model_hub_config.py
+++ b/tests/test_model_hub_config.py
@@ -2697,8 +2697,15 @@ def test_model_hub_release_capability_accepts_explicit_truthy_values(value):
assert is_model_hub_enabled({MODEL_HUB_ENABLED_ENV: value}) is True
+def test_model_hub_release_capability_is_available_without_an_environment_override(monkeypatch):
+ monkeypatch.delenv(MODEL_HUB_ENABLED_ENV, raising=False)
+
+ assert is_model_hub_enabled({}) is True
+ assert is_model_hub_enabled() is True
+
+
@pytest.mark.parametrize("value", ["", "0", "false", "no", "off", "unexpected"])
-def test_model_hub_release_capability_defaults_and_fails_closed(value):
+def test_model_hub_release_capability_respects_explicit_disable_and_fails_closed(value):
assert is_model_hub_enabled({MODEL_HUB_ENABLED_ENV: value}) is False
diff --git a/tests/test_opencode_server.py b/tests/test_opencode_server.py
index fb503eb3f..d11ebb3f0 100644
--- a/tests/test_opencode_server.py
+++ b/tests/test_opencode_server.py
@@ -152,6 +152,13 @@ class _FakeSession:
class OpenCodeServerTests(unittest.IsolatedAsyncioTestCase):
+ def setUp(self):
+ from core.services.settings import default_config
+
+ config_home = self.enterContext(tempfile.TemporaryDirectory(prefix="opencode-server-test-"))
+ self.enterContext(patch.dict(os.environ, {"AVIBE_HOME": config_home}))
+ default_config().save()
+
def test_managed_runtime_config_accepts_jsonc_and_disables_native_skill(self):
content = SERVER_MODULE._managed_runtime_config_content(
b'''\xef\xbb\xbf{
@@ -489,20 +496,12 @@ class OpenCodeServerTests(unittest.IsolatedAsyncioTestCase):
async def test_hub_mode_refuses_unconfigured_launch_and_logs_once(self):
manager = OpenCodeServerManager(binary="opencode", port=4096)
manager._start_server = AsyncMock() # type: ignore[method-assign]
+ config = SERVER_MODULE.V2Config.load()
+ config.model_hub.agents["opencode"].mode = "hub"
+ config.save()
with (
- patch.object(SERVER_MODULE, "is_model_hub_enabled", return_value=True),
- patch.object(
- SERVER_MODULE.V2Config,
- "load",
- return_value=types.SimpleNamespace(
- model_hub=types.SimpleNamespace(
- agents={
- "opencode": types.SimpleNamespace(mode="hub"),
- }
- )
- ),
- ),
+ patch.dict(os.environ),
patch.object(SERVER_MODULE.logger, "error") as log_error,
patch.object(
SERVER_MODULE,
@@ -510,6 +509,7 @@ class OpenCodeServerTests(unittest.IsolatedAsyncioTestCase):
side_effect=AssertionError("Hub refusal must precede server setup"),
),
):
+ os.environ.pop("VIBE_MODEL_HUB_ENABLED", None)
for _attempt in range(2):
with self.assertRaises(OpenCodeModelHubOverlayRequiredError):
await manager.ensure_running()