3ec601d4da
The clone's opencode.json inherited the main repo's top-level 'model' field (zai/glm-5) via 'git clone'. The tier2-autonomous agent has its own 'model: minimax-coding-plan/MiniMax-M3' override, so the default agent path was technically correct, but any other agent spawned without an explicit model (or if the user manually switched to build/plan) would have used zai/glm-5 instead of MiniMax-M3. Fix: 1. Add top-level 'model: minimax-coding-plan/MiniMax-M3' to conductor/tier2/opencode.json.fragment. 2. setup_tier2_clone.ps1 merge now overrides 'model' from the fragment (was only overriding agent, permission, default_agent). 3. Added test_config_fragment_has_top_level_model (default-on) to assert the fragment's model field. 4. Added test_setup_script_overrides_model (opt-in TIER2_SANDBOX_TESTS=1) to assert the merge code. All 17 tests pass (14 default-on + 3 opt-in). Verified: re-ran setup against the live clone; opencode.json's top-level 'model' is now minimax-coding-plan/MiniMax-M3.
64 lines
2.6 KiB
Python
64 lines
2.6 KiB
Python
"""Opt-in integration test for the setup_tier2_clone.ps1 bootstrap.
|
|
|
|
Runs the script in -WhatIf mode against a fixture workspace. The full
|
|
non-WhatIf run is a manual verification (the user runs it once and
|
|
inspects the result).
|
|
"""
|
|
import os
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
pytestmark = [
|
|
pytest.mark.skipif(
|
|
not os.environ.get("TIER2_SANDBOX_TESTS"),
|
|
reason="opt-in: bootstrap test off by default; set TIER2_SANDBOX_TESTS=1",
|
|
),
|
|
pytest.mark.tier2_sandbox,
|
|
]
|
|
|
|
|
|
def test_bootstrap_whatif_does_not_create_clone(tmp_path: Path) -> None:
|
|
"""pwsh -WhatIf should print the steps but not actually clone."""
|
|
fake_main = tmp_path / "fake_main"
|
|
fake_main.mkdir()
|
|
fake_clone = tmp_path / "fake_clone"
|
|
script = Path("scripts/tier2/setup_tier2_clone.ps1").resolve()
|
|
result = subprocess.run(
|
|
[
|
|
"pwsh", "-NoProfile", "-File", str(script),
|
|
"-MainRepoPath", str(fake_main),
|
|
"-Tier2ClonePath", str(fake_clone),
|
|
"-WhatIf",
|
|
],
|
|
capture_output=True, text=True, timeout=60,
|
|
)
|
|
assert result.returncode == 0, f"pwsh exit {result.returncode}\nstdout={result.stdout}\nstderr={result.stderr}"
|
|
assert "What if" in result.stdout or "starting bootstrap" in result.stdout or "Bootstrap Tier 2 clone" in result.stdout
|
|
assert not fake_clone.exists(), "-WhatIf should not have created the clone"
|
|
|
|
|
|
def test_setup_script_overrides_mcp_server() -> None:
|
|
"""Regression test: setup_tier2_clone.ps1 MUST override the MCP server's
|
|
command and PYTHONPATH to point at the Tier 2 clone, AND reset the
|
|
clone's mcp_paths.toml to empty extra_dirs. Otherwise the clone inherits
|
|
the main repo's MCP config (which has manual_slop's path and an
|
|
mcp_paths.toml allowlisting gencpp), leading to 'ACCESS DENIED' on clone
|
|
paths (2026-06-17 bug)."""
|
|
script = Path("scripts/tier2/setup_tier2_clone.ps1").resolve()
|
|
content = script.read_text(encoding="utf-8")
|
|
assert "mcp.'manual-slop'.command" in content, "script must override MCP server command"
|
|
assert "mcp.'manual-slop'.environment.PYTHONPATH" in content, "script must override MCP server PYTHONPATH"
|
|
assert "mcp_paths.toml" in content, "script must reset mcp_paths.toml"
|
|
assert "extra_dirs = []" in content, "script must set extra_dirs to empty"
|
|
|
|
|
|
def test_setup_script_overrides_model() -> None:
|
|
"""Regression test: setup_tier2_clone.ps1 MUST override the top-level
|
|
'model' field in the clone's opencode.json to the Tier 2 model
|
|
(minimax-coding-plan/MiniMax-M3), not the main repo's zai/glm-5."""
|
|
script = Path("scripts/tier2/setup_tier2_clone.ps1").resolve()
|
|
content = script.read_text(encoding="utf-8")
|
|
assert 'Name model -Value $fragment.model' in content, "script must override top-level model from fragment"
|