fix(cli): preserve reserved workstream id

This commit is contained in:
Patrick Buckley
2026-08-25 12:06:54 -07:00
parent 84f24a1909
commit 8ae8e3067f
2 changed files with 52 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
"""End-to-end startup coverage for the interactive CLI entry point."""
from __future__ import annotations
import os
import subprocess
import sys
from pathlib import Path
def test_cli_starts_with_fresh_database(tmp_path: Path) -> None:
"""A fresh CLI session must reach the prompt and shut down cleanly."""
config_path = tmp_path / "config.toml"
config_path.write_text("", encoding="utf-8")
config_path.chmod(0o600)
env = {key: value for key, value in os.environ.items() if not key.startswith("TURNSTONE_")}
env.update(
{
"OPENAI_API_KEY": "dummy",
"TURNSTONE_DB_BACKEND": "sqlite",
"TURNSTONE_DB_PATH": str(tmp_path / "turnstone.db"),
}
)
result = subprocess.run(
[
sys.executable,
"-m",
"turnstone.cli",
"--config",
str(config_path),
"--model",
"startup-test-model",
"--retention-days",
"0",
"--no-judge",
],
input="/exit\n",
text=True,
capture_output=True,
cwd=Path(__file__).resolve().parents[1],
env=env,
timeout=60,
check=False,
)
output = result.stdout + result.stderr
assert result.returncode == 0, output
assert "Type /help for commands" in result.stdout
assert "Goodbye." in result.stdout
+1
View File
@@ -1425,6 +1425,7 @@ def main() -> None:
registry_generation=registry_generation,
model_alias=effective_alias,
model_binding=model_binding,
ws_id=ws_id,
tool_search=args.tool_search,
tool_search_threshold=args.tool_search_threshold,
tool_search_max_results=args.tool_search_max_results,