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.

refactor(show-runtime): retire managed GitHub source (#1662)

Call White0cd65b5069f8
diff --git a/.env.regression.example b/.env.regression.example
index 71201d0af..07700ec12 100644
--- a/.env.regression.example
+++ b/.env.regression.example
@@ -43,12 +43,10 @@ REGRESSION_DEFAULT_CWD=/home/avibe/.avibe/workdir
REGRESSION_DEFAULT_BACKEND=opencode
REGRESSION_LOG_LEVEL=INFO
REGRESSION_LANGUAGE=en
-# Master/worktree regression does not necessarily carry a packaged release
-# manifest, so the regression script prepares Show Runtime from source by
-# default. Release/pre-release installs should use the packaged manifest path.
-REGRESSION_SHOW_RUNTIME_SOURCE=github-source
-REGRESSION_SHOW_RUNTIME_GITHUB_REPO=https://github.com/avibe-bot/vibe-show-runtime.git
-REGRESSION_SHOW_RUNTIME_GITHUB_REF=main
+# Master/worktree regression builds a local archive because it does not
+# necessarily carry a packaged release manifest. Release/pre-release installs
+# should use the packaged manifest path.
+REGRESSION_SHOW_RUNTIME_SOURCE=archive
# -----------------------------------------------------------------------------
# Slack
diff --git a/AGENTS.md b/AGENTS.md
index 5d446287b..e5f2b5f9c 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -148,7 +148,7 @@ State and lookup notes:
- metadata lives under the primary checkout's `.runtime/incus-regression/`, even
when the runner is invoked from a task worktree
- `.env.regression` is read from the current worktree first, then the primary checkout
-- branch/master source checkouts default `REGRESSION_SHOW_RUNTIME_SOURCE=github-source`; packaged release installs should use the packaged manifest path
+- branch/master regression defaults to a locally built Show Runtime archive; packaged release installs use the packaged manifest path
## 4. Configuration and Routing Model
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index ffbdb43f3..596fb23f2 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -10,9 +10,11 @@ Thanks for your interest in contributing!
## Development
-- Run locally: `python main.py`. A source checkout without a packaged Show
- Runtime manifest uses the GitHub source provider for development; installed
- wheels still require their pinned manifest.
+- Run locally: build and maintain Show Runtime separately, point
+ `VIBE_SHOW_RUNTIME_BIN` at that build's entry point, then run `python main.py`.
+- Retired managed GitHub-source checkouts under `<runtime_dir>/source/github/`
+ are no longer used after an upgrade. They can be removed manually after
+ confirming that `VIBE_SHOW_RUNTIME_BIN` does not point inside that directory.
- Build an installable local wheel: build `ui/`, run
`python scripts/prepare_local_show_runtime_manifest.py`, then run
`uv build --wheel`. The preparation step inherits the latest official
diff --git a/core/show_runtime.py b/core/show_runtime.py
index cce5d7f13..1fa6f353d 100644
--- a/core/show_runtime.py
+++ b/core/show_runtime.py
@@ -52,6 +52,7 @@ from core.show_runtime_failures import (
classify_show_runtime_failure,
show_runtime_recovery_action,
)
+from core.show_runtime_source import retired_show_runtime_source
logger = logging.getLogger(__name__)
@@ -59,12 +60,10 @@ _RUNTIME_BIN = "avibe-show-runtime"
_RUNTIME_PACKAGE = "@avibe/show-runtime"
_RUNTIME_ARCHIVE_PREFIX = "vibe-show-runtime-node"
_RUNTIME_ARCHIVE_RELEASE_BASE_URL = "https://github.com/avibe-bot/vibe-show-runtime/releases/latest/download"
-_RUNTIME_GITHUB_REPO = "https://github.com/avibe-bot/vibe-show-runtime.git"
-_RUNTIME_GITHUB_REF = "main"
_RUNTIME_SOURCE_MANIFEST = "manifest-cache"
_RUNTIME_SOURCE_ARCHIVE = "archive"
-_RUNTIME_SOURCE_GITHUB = "github"
_RUNTIME_SOURCE_NPM = "npm"
+_WARNED_RETIRED_RUNTIME_SOURCES: set[str] = set()
_RUNTIME_MANIFEST_RESOURCE = "show_runtime_manifest.json"
_PACKAGED_RUNTIME_MANIFEST_SOURCE = f"package:{_RUNTIME_MANIFEST_RESOURCE}"
_CUSTOM_MANIFEST_LINEAGE = "*custom*"
@@ -443,8 +442,6 @@ class ShowRuntimeManager:
runtime_source: str | None = None,
archive_path: Path | str | None = None,
archive_url: str | None = None,
- github_repo: str | None = None,
- github_ref: str | None = None,
manifest_path: Path | str | None = None,
manifest_url: str | None = None,
offline: bool | None = None,
@@ -464,22 +461,12 @@ class ShowRuntimeManager:
source_value = runtime_source or os.environ.get("VIBE_SHOW_RUNTIME_SOURCE")
if source_value is None and (archive_path_value or archive_url is not None or archive_url_env):
source_value = _RUNTIME_SOURCE_ARCHIVE
- if (
- source_value is None
- and not self.manifest_path
- and not self.manifest_url
- and not _packaged_runtime_manifest_exists()
- and _running_from_development_checkout()
- ):
- source_value = _RUNTIME_SOURCE_GITHUB
self.auto_install = _auto_install_enabled() if auto_install is None else auto_install
self.package_spec = package_spec or os.environ.get("VIBE_SHOW_RUNTIME_PACKAGE_SPEC") or _RUNTIME_PACKAGE
self.runtime_source = _normalize_runtime_source(source_value)
configured_archive_url = archive_url if archive_url is not None else archive_url_env
self.archive_url = configured_archive_url if configured_archive_url is not None else _default_runtime_archive_url()
self._archive_url_provenance = "configured" if configured_archive_url is not None else "packaged"
- self.github_repo = github_repo or os.environ.get("VIBE_SHOW_RUNTIME_GITHUB_REPO") or _RUNTIME_GITHUB_REPO
- self.github_ref = github_ref or os.environ.get("VIBE_SHOW_RUNTIME_GITHUB_REF") or _RUNTIME_GITHUB_REF
self.offline = _env_flag_enabled("VIBE_SHOW_RUNTIME_OFFLINE", default=False) if offline is None else offline
self.force_install = force_install
self.stdout_path = self.runtime_dir / "stdout.log"
@@ -1470,12 +1457,6 @@ class ShowRuntimeManager:
command = self._install_manifest_runtime_locked(force=force, offline=offline)
elif self.runtime_source == _RUNTIME_SOURCE_ARCHIVE:
command = self._install_archive_runtime(force=force, offline=offline)
- elif self.runtime_source == _RUNTIME_SOURCE_GITHUB:
- attempt = self._install_github_runtime(force=force)
- if attempt.command:
- self._download_error = None
- self._clean_after_managed_install(attempt.command)
- return attempt
elif self.runtime_source == _RUNTIME_SOURCE_NPM:
command = self._install_npm_runtime(force=force)
else:
@@ -1492,8 +1473,6 @@ class ShowRuntimeManager:
return self._installed_manifest_runtime_command(offline=offline)
if self.runtime_source == _RUNTIME_SOURCE_ARCHIVE:
return self._installed_archive_runtime_command()
- if self.runtime_source == _RUNTIME_SOURCE_GITHUB:
- return self._installed_github_runtime_command()
if self.runtime_source == _RUNTIME_SOURCE_NPM:
resolved = _resolve_executable_path(self._managed_bin_path())
return [resolved] if resolved else None
@@ -1560,7 +1539,6 @@ class ShowRuntimeManager:
archive_status: dict[str, Any] | None = None
installed_runtime_version: str | None = None
installed_matches: bool | None = None
- github_source_status: dict[str, Any] | None = None
installed = (
explicit_availability is not None
and explicit_availability.install is ShowRuntimeInstallState.INSTALLED
@@ -1601,11 +1579,6 @@ class ShowRuntimeManager:
"sha256": None,
"size": None,
}
- elif explicit_availability is None and self.runtime_source == _RUNTIME_SOURCE_GITHUB:
- installed_dir = self._github_source_dir()
- installed_command = self._github_runtime_command(installed_dir, node or ["node"])
- installed = installed_command is not None
- github_source_status = self._github_source_status(installed_dir)
elif explicit_availability is None and self.runtime_source == _RUNTIME_SOURCE_NPM:
managed = _resolve_executable_path(self._managed_bin_path())
installed_command = [managed] if managed else None
@@ -1634,7 +1607,6 @@ class ShowRuntimeManager:
"node_supported": node_supported,
"manifest": manifest_status,
"archive": archive_status or _archive_status_payload(archive),
- "github_source": github_source_status,
"install": install_payload,
"runtime": runtime_payload,
"command": installed_command,
@@ -3294,200 +3266,6 @@ class ShowRuntimeManager:
return None
return [*node, str(cli_path)]
- def _installed_github_runtime_command(self) -> list[str] | None:
- node = _resolve_node_command()
- if not node:
- return None
- return self._github_runtime_command(self._github_source_dir(), node)
-
- def _github_install_attempt(
- self,
- command: list[str] | None,
- *,
- replacement_required: bool,
- replacement_completed: bool = False,
- operation_reason: str | None = None,
- ) -> _ManagedInstallAttempt:
- resolved = self._managed_install_operation_command(
- command,
- replacement_required=replacement_required,
- replacement_completed=replacement_completed,
- )
- if resolved:
- return _ManagedInstallAttempt(resolved)
- reason = operation_reason or self._install_reason or "runtime_install_failed"
- self._install_reason = None
- return _ManagedInstallAttempt(None, reason)
-
- def _install_github_runtime(
- self,
- *,
- force: bool | None = None,
- ) -> _ManagedInstallAttempt:
- replacement_required = self.force_install if force is None else force
- node = _resolve_node_command()
- if not node:
- self._install_reason = "runtime_node_missing"
- return self._github_install_attempt(None, replacement_required=replacement_required)
- self.runtime_dir.mkdir(parents=True, exist_ok=True)
- source_dir = self._github_source_dir()
- existing_command = self._github_runtime_command(source_dir, node)
- try:
- git = _resolve_command("git")
- npm = _resolve_command("npm")
- except (OSError, ValueError):
- git = None
- npm = None
- if not git:
- self._install_reason = "runtime_git_missing"
- return self._github_install_attempt(
- existing_command,
- replacement_required=replacement_required,
- )
- if not npm:
- self._install_reason = "runtime_npm_missing"
- return self._github_install_attempt(
- existing_command,
- replacement_required=replacement_required,
- )
- if not source_dir.exists():
- source_dir.parent.mkdir(parents=True, exist_ok=True)
- if not self._run_install_command(
- [*git, "clone", "--depth", "1", "--branch", self.github_ref, self.github_repo, str(source_dir)]
- ):
- return self._github_install_attempt(
- None,
- replacement_required=replacement_required,
- )
- else:
- if not self._run_install_command([*git, "-C", str(source_dir), "fetch", "--depth", "1", "origin", self.github_ref]):
- self._install_reason = None
- update_failure_reason = "runtime_github_source_update_failed"
- return self._github_install_attempt(
- existing_command,
- replacement_required=replacement_required,
- operation_reason=update_failure_reason,
- )
- fetched = self._git_revision(git, source_dir, "FETCH_HEAD")
- if not fetched:
- update_failure_reason = "runtime_github_source_update_failed"
- return self._github_install_attempt(
- existing_command,
- replacement_required=replacement_required,
- operation_reason=update_failure_reason,
- )
- if (
- not replacement_required
- and existing_command
- and fetched
- and self._read_github_build_marker(source_dir) == fetched
- ):
- # The runtime already on disk was built from exactly this
- # commit, so `npm ci` and `npm run build` would spend a minute
- # reproducing it byte for byte.
- return self._github_install_attempt(
- existing_command,
- replacement_required=False,
- )
- if not self._run_install_command([*git, "-C", str(source_dir), "checkout", "FETCH_HEAD"]):
- self._install_reason = None
- return self._github_install_attempt(
- existing_command,
- replacement_required=replacement_required,
- operation_reason="runtime_github_source_update_failed",
- )
- # From here on the artifact the marker describes is being replaced:
- # ``npm ci`` empties node_modules and the build writes into dist. Drop
- # the marker first so a failure anywhere below leaves "unknown" rather
- # than a commit that no longer describes what is on disk.
- self._write_github_build_marker(source_dir, None)
- if replacement_required:
- build_output = source_dir / "packages" / "runtime" / "dist"
- if not self._remove_managed_runtime_tree_for_replacement(build_output, label="GitHub"):
- return self._github_install_attempt(
- None,
- replacement_required=True,
- )
- existing_command = None
- if not self._run_install_command([*npm, "ci"], cwd=source_dir):
- return self._github_install_attempt(
- existing_command,
- replacement_required=replacement_required,
- )
- if not self._run_install_command([*npm, "run", "build"], cwd=source_dir):
- return self._github_install_attempt(
- existing_command,
- replacement_required=replacement_required,
- )
- command = self._github_runtime_command(source_dir, node)
- if not command:
- self._install_reason = "runtime_install_missing_bin"
- return self._github_install_attempt(
- None,
- replacement_required=replacement_required,
- )
- self._write_github_build_marker(source_dir, self._git_revision(git, source_dir, "HEAD"))
- # A forced build starts with no dist tree, so resolving this command proves replacement.
- return self._github_install_attempt(
- command,
- replacement_required=replacement_required,
- replacement_completed=replacement_required,
- )
-
- def _github_build_marker_path(self, source_dir: Path) -> Path:
- return source_dir / ".avibe-runtime-build"
-
- def _read_github_build_marker(self, source_dir: Path) -> str | None:
- """The commit that produced the runtime build currently on disk.
-
- The marker describes the artifact that exists now, not whatever the
- working tree happens to be checked out at. Both halves of that are
- enforced by when it moves: it is cleared before a rebuild starts
- replacing the artifact, and written again only once the build finished
- and its entry point resolved. So a failed, interrupted, or partial
- rebuild leaves no marker, and the next prepare rebuilds.
- """
- try:
- revision = self._github_build_marker_path(source_dir).read_text(encoding="utf-8").strip()
- except OSError:
- return None
- return revision or None
-
- def _write_github_build_marker(self, source_dir: Path, revision: str | None) -> None:
- marker = self._github_build_marker_path(source_dir)
- try:
- if revision:
- marker.write_text(f"{revision}\n", encoding="utf-8")
- else:
- marker.unlink(missing_ok=True)
- except OSError:
- pass
-
- def _github_source_status(self, source_dir: Path) -> dict[str, Any]:
- return {"built_revision": self._read_github_build_marker(source_dir)}
-
- def _git_revision(self, git: list[str], source_dir: Path, ref: str) -> str | None:
- try:
- result = subprocess.run(
- [*git, "-C", str(source_dir), "rev-parse", ref],
- capture_output=True,
- text=True,
- timeout=30,
- check=False,
- **isolated_subprocess_kwargs(),
- )
- except (OSError, subprocess.SubprocessError):
- return None
- if result.returncode != 0:
- return None
- return result.stdout.strip() or None
-
- def _github_runtime_command(self, source_dir: Path, node: list[str]) -> list[str] | None:
- cli_path = source_dir / "packages" / "runtime" / "dist" / "cli.js"
- if not cli_path.exists():
- return None
- return [*node, str(cli_path)]
-
def _install_npm_runtime(self, *, force: bool | None = None) -> list[str] | None:
replacement_required = self.force_install if force is None else force
try:
@@ -3563,35 +3341,6 @@ class ShowRuntimeManager:
suffix = ".cmd" if os.name == "nt" else ""
return self.runtime_dir / "package" / "node_modules" / ".bin" / f"{_RUNTIME_BIN}{suffix}"
- def _github_source_dir(self) -> Path:
- repo_slug = self.github_repo.removesuffix(".git").rstrip("/").rsplit("/", 2)[-2:]
- repo_part = "_".join(repo_slug) if len(repo_slug) == 2 else "vibe-show-runtime"
- ref_part = _safe_path_part(self.github_ref)
- return self.runtime_dir / "source" / "github" / repo_part / ref_part
-
- def _run_install_command(self, command: list[str], *, cwd: Path | None = None) -> bool:
- try:
- with self.install_log_path.open("a", encoding="utf-8") as log:
- log.write(f"$ {' '.join(command)}\n")
- result = subprocess.run(
- command,
- cwd=str(cwd) if cwd else None,
- stdout=log,
- stderr=subprocess.STDOUT,
- text=True,
- timeout=300,
- check=False,
- **isolated_subprocess_kwargs(),
- )
- except (OSError, subprocess.SubprocessError):
- logger.warning("Show Runtime install command failed", exc_info=True)
- self._install_reason = "runtime_install_failed"
- return False
- if result.returncode != 0:
- self._install_reason = "runtime_install_failed"
- return False
- return True
-
_manager: ShowRuntimeManager | None = None
@@ -3832,22 +3581,25 @@ def _packaged_runtime_manifest_exists() -> bool:
return resource.is_file()
-def _running_from_development_checkout() -> bool:
- source_root = Path(__file__).resolve().parents[1]
- return (source_root / "pyproject.toml").is_file() and (source_root / "main.py").is_file()
-
-
def _normalize_runtime_source(value: str | None) -> str:
- normalized = (value or _RUNTIME_SOURCE_MANIFEST).strip().lower()
+ retired_source = retired_show_runtime_source(value)
+ normalized = retired_source or (value or _RUNTIME_SOURCE_MANIFEST).strip().lower()
aliases = {
"manifest": _RUNTIME_SOURCE_MANIFEST,
"manifest-cache": _RUNTIME_SOURCE_MANIFEST,
"archive": _RUNTIME_SOURCE_ARCHIVE,
"prebuilt": _RUNTIME_SOURCE_ARCHIVE,
- "github": _RUNTIME_SOURCE_GITHUB,
- "github-source": _RUNTIME_SOURCE_GITHUB,
"npm": _RUNTIME_SOURCE_NPM,
}
+ if retired_source is not None and retired_source not in _WARNED_RETIRED_RUNTIME_SOURCES:
+ _WARNED_RETIRED_RUNTIME_SOURCES.add(retired_source)
+ logger.warning(
+ "VIBE_SHOW_RUNTIME_SOURCE=%s is retired; using %s instead",
+ retired_source,
+ _RUNTIME_SOURCE_MANIFEST,
+ )
+ if retired_source is not None:
+ return _RUNTIME_SOURCE_MANIFEST
return aliases.get(normalized, normalized or _RUNTIME_SOURCE_MANIFEST)
diff --git a/core/show_runtime_failures.py b/core/show_runtime_failures.py
index 873f50ccb..35e376cbd 100644
--- a/core/show_runtime_failures.py
+++ b/core/show_runtime_failures.py
@@ -358,13 +358,6 @@ _FAILURE_DECLARATION_ROWS = (
ShowRuntimeFailureClass.CHECKSUM,
ShowRuntimeRecoveryAction.REPAIR,
),
- ShowRuntimeFailureDeclaration(
- "runtime_github_source_update_failed",
- ShowRuntimeFailureDimension.INSTALL,
- "github-provider",
- ShowRuntimeFailureClass.UNCLASSIFIED,
- ShowRuntimeRecoveryAction.REPAIR,
- ),
ShowRuntimeFailureDeclaration(
"runtime_source_unsupported",
ShowRuntimeFailureDimension.INSTALL,
diff --git a/core/show_runtime_source.py b/core/show_runtime_source.py
new file mode 100644
index 000000000..803d3138e
--- /dev/null
+++ b/core/show_runtime_source.py
@@ -0,0 +1,10 @@
+from __future__ import annotations
+
+
+RETIRED_SHOW_RUNTIME_SOURCES = frozenset({"github", "github-source"})
+
+
+def retired_show_runtime_source(value: str | None) -> str | None:
+ """Return the canonical retired source alias, if value names one."""
+ normalized = (value or "").strip().lower()
+ return normalized if normalized in RETIRED_SHOW_RUNTIME_SOURCES else None
diff --git a/docs/plans/show-page-annotation-phase1.md b/docs/plans/show-page-annotation-phase1.md
index 7fe2bd6df..53752ed45 100644
--- a/docs/plans/show-page-annotation-phase1.md
+++ b/docs/plans/show-page-annotation-phase1.md
@@ -303,7 +303,7 @@ Do not touch `vibe/**`, `core/**`, `tests/**`.
3. Merge order: R (runtime main) → A → C (A/C independent; R first so the
bootstrap asset exists for regression source builds).
4. End-to-end verification by the orchestrator in the local Incus regression
- environment (github-source runtime) against the acceptance list below.
+ environment (locally built runtime archive) against the acceptance list below.
## Acceptance Criteria
diff --git a/docs/plans/show-runtime-manifest-cache.md b/docs/plans/show-runtime-manifest-cache.md
index 6a44c9244..9b626749d 100644
--- a/docs/plans/show-runtime-manifest-cache.md
+++ b/docs/plans/show-runtime-manifest-cache.md
@@ -144,7 +144,6 @@ Initial providers:
- `manifest-cache`: default for packaged Vibe Remote releases
- `local-bin`: explicit `VIBE_SHOW_RUNTIME_BIN` override for development
- `archive-path`: explicit local archive override for testing and emergency use
-- `github-source`: development-only fallback for fast iteration
- `npm`: future stable-channel provider, not the first default
Resolution order:
diff --git a/docs/plans/show-service-runtime.md b/docs/plans/show-service-runtime.md
index 966072877..2dc40af54 100644
--- a/docs/plans/show-service-runtime.md
+++ b/docs/plans/show-service-runtime.md
@@ -209,27 +209,17 @@ Vibe Remote resolution order:
1. `VIBE_SHOW_RUNTIME_BIN`, for local development or pinned custom runtime.
2. `avibe-show-runtime` on PATH.
-3. Managed GitHub source install under Vibe Remote runtime state.
+3. The packaged manifest cache and its verified platform archive.
-Managed GitHub source install:
-
-```text
-~/.vibe_remote/runtime/show-runtime/source/github/avibe-bot_vibe-show-runtime/main/
- package.json
- node_modules/
- packages/runtime/dist/cli.js
-```
-
-The default managed source is GitHub, so early runtime iteration does not
-require publishing npm packages for every change:
+Developers build and maintain their own Show Runtime, then point Avibe at its
+entry point explicitly:
```bash
-VIBE_SHOW_RUNTIME_SOURCE=github
-VIBE_SHOW_RUNTIME_GITHUB_REPO=https://github.com/avibe-bot/vibe-show-runtime.git
-VIBE_SHOW_RUNTIME_GITHUB_REF=main
+VIBE_SHOW_RUNTIME_BIN=/path/to/vibe-show-runtime
```
-For stable releases, the same manager can use npm explicitly:
+Stable releases use the packaged manifest cache by default. The same manager
+can use npm explicitly:
```bash
VIBE_SHOW_RUNTIME_SOURCE=npm
@@ -261,8 +251,8 @@ context TTL/LRU enforcement belongs in `@avibe/show-runtime`.
Vibe Remote can update the Show Runtime independently if the sidecar API stays
compatible:
-- runtime releases can be GitHub refs during fast iteration and npm package
- versions for stable channels
+- developers can point Avibe at a locally built runtime with
+ `VIBE_SHOW_RUNTIME_BIN`; stable channels use packaged manifest archives
- Vibe Remote installs them under managed runtime state
- active sessions keep their current process until idle or restart
- new sessions use the currently installed package
diff --git a/docs/regression/README.md b/docs/regression/README.md
index ed7cfdb39..333b691aa 100644
--- a/docs/regression/README.md
+++ b/docs/regression/README.md
@@ -286,7 +286,7 @@ Incus regression environment is ready:
Target: master
Project: avr-master
Instance: avibe-master
- Show Runtime source: github-source
+ Show Runtime source: archive
```
Default names:
diff --git a/scripts/incus_regression.py b/scripts/incus_regression.py
index f77b5882c..0853dc40b 100644
--- a/scripts/incus_regression.py
+++ b/scripts/incus_regression.py
@@ -28,6 +28,12 @@ from datetime import datetime, timezone
from pathlib import Path
from typing import Callable, Container, Iterable, Iterator, Sequence
+REPO_ROOT = Path(__file__).resolve().parents[1]
+if str(REPO_ROOT) not in sys.path:
+ sys.path.insert(0, str(REPO_ROOT))
+
+from core.show_runtime_source import retired_show_runtime_source
+
try:
import fcntl
except ImportError: # pragma: no cover - Incus runner is not used on Windows.
@@ -67,6 +73,7 @@ DEFAULT_WORKTREE_PORT_START = 15200
DEFAULT_WORKTREE_PORT_END = 15399
ENV_FILE_NAME = ".env.regression"
ENV_PREFIX = "REGRESSION_"
+SHOW_RUNTIME_BUILD_TIMEOUT_SECONDS = 300
SLUG_RE = re.compile(r"^[a-z][a-z0-9-]{1,38}[a-z0-9]$")
DAEMON_UNREACHABLE_HINT = (
"The daemon did not answer, so whether the environment already exists is unknown and the "
@@ -104,6 +111,7 @@ class Runner:
input_text: str | None = None,
check: bool = True,
capture: bool = False,
+ timeout: float | None = None,
) -> subprocess.CompletedProcess[str]:
print("+ " + shlex.join(command))
if self.dry_run:
@@ -117,7 +125,14 @@ class Runner:
kwargs["input"] = input_bytes
elif input_text is not None:
kwargs["input"] = input_text
- return subprocess.run(list(command), **kwargs)
+ if timeout is not None:
+ kwargs["timeout"] = timeout
+ try:
+ return subprocess.run(list(command), **kwargs)
+ except subprocess.TimeoutExpired as exc:
+ detail = f"Command timed out after {timeout:g} seconds: {shlex.join(command)}"
+ print(detail, file=sys.stderr)
+ raise RegressionError(detail) from exc
def records(self, command: Sequence[str], *, what: str) -> list[dict]:
"""Return the objects the daemon enumerated, or raise if it could not answer.
@@ -246,6 +261,25 @@ def regression_env(suffix: str, default: str = "") -> str:
return value.strip()
+def regression_show_runtime_source(source: str | None = None) -> str:
+ source = regression_env("SHOW_RUNTIME_SOURCE", "archive") if source is None else source.strip()
+ source = source or "archive"
+ return "archive" if retired_show_runtime_source(source) is not None else source
+
+
+def regression_show_runtime_env(
+ source: str | None,
+ service_home: str,
+) -> dict[str, str]:
+ resolved = regression_show_runtime_source(source)
+ env = {"VIBE_SHOW_RUNTIME_SOURCE": resolved}
+ if resolved == "archive":
+ env["VIBE_SHOW_RUNTIME_ARCHIVE_PATH"] = (
+ f"{service_home}/.cache/avibe-regression/vibe-show-runtime-node.tgz"
+ )
+ return env
+
+
def host_bind_env(default: str = "127.0.0.1") -> str:
return (
regression_env("PORT_BIND_HOST")
@@ -1775,15 +1809,15 @@ def compute_fingerprints(repo_root: Path) -> dict:
# ``postcss.config.js``, ``eslint.config.js`` and ``ui/scripts/``; a build
# input added tomorrow is covered without anyone remembering to extend a
# literal, including the ones that live outside ``ui/``.
+ show_runtime_env = regression_show_runtime_env(None, SERVICE_HOME)
return {
"python": file_hash(repo_root, ["pyproject.toml", "uv.lock"]),
"ui_deps": file_hash(repo_root, ["ui/package.json", "ui/package-lock.json"]),
"ui_source": ui_source_hash(repo_root),
"show_runtime": "|".join(
[
- regression_env("SHOW_RUNTIME_SOURCE", "github-source"),
- regression_env("SHOW_RUNTIME_GITHUB_REPO", "https://github.com/avibe-bot/vibe-show-runtime.git"),
- regression_env("SHOW_RUNTIME_GITHUB_REF", "main"),
+ show_runtime_env["VIBE_SHOW_RUNTIME_SOURCE"],
+ show_runtime_env.get("VIBE_SHOW_RUNTIME_ARCHIVE_PATH", ""),
]
),
}
@@ -1944,9 +1978,7 @@ def runtime_env_payload(repo_root: Path | None = None) -> bytes:
"SETUPTOOLS_SCM_PRETEND_VERSION_FOR_AVIBE_OS": scm_version,
"REGRESSION_UI_HOST": CONTAINER_UI_HOST,
"AVIBE_ALLOW_DEV_STATE_MIGRATION": "1",
- "VIBE_SHOW_RUNTIME_SOURCE": regression_env("SHOW_RUNTIME_SOURCE", "github-source"),
- "VIBE_SHOW_RUNTIME_GITHUB_REPO": regression_env("SHOW_RUNTIME_GITHUB_REPO", "https://github.com/avibe-bot/vibe-show-runtime.git"),
- "VIBE_SHOW_RUNTIME_GITHUB_REF": regression_env("SHOW_RUNTIME_GITHUB_REF", "main"),
+ **regression_show_runtime_env(None, SERVICE_HOME),
"ANTHROPIC_API_KEY": os.environ.get("ANTHROPIC_API_KEY", ""),
"ANTHROPIC_BASE_URL": os.environ.get("ANTHROPIC_BASE_URL", ""),
"OPENAI_API_KEY": os.environ.get("OPENAI_API_KEY", ""),
@@ -2317,15 +2349,47 @@ def restart_and_verify(runner: Runner, target: RegressionTarget, *, remote: str
def prepare_show_runtime(runner: Runner, target: RegressionTarget, *, remote: str | None) -> None:
- result = runner.run(tenant_exec(target, f"{VENV_DIR}/bin/vibe runtime prepare --strict", remote=remote), check=False)
+ source_result = runner.run(
+ tenant_exec(target, 'printf "%s" "${VIBE_SHOW_RUNTIME_SOURCE:-}"', remote=remote),
+ capture=True,
+ )
+ runtime_env = regression_show_runtime_env(source_result.stdout or "", SERVICE_HOME)
+ runtime_env_prefix = " ".join(f"{key}={shlex.quote(value)}" for key, value in runtime_env.items())
+ runtime_env_exports = "\n".join(f"export {key}={shlex.quote(value)}" for key, value in runtime_env.items())
+ runner.run(
+ tenant_exec(
+ target,
+ f"""
+set -euo pipefail
+{runtime_env_exports}
+if [ "${{VIBE_SHOW_RUNTIME_SOURCE:-}}" = "archive" ]; then
+ : "${{VIBE_SHOW_RUNTIME_ARCHIVE_PATH:?VIBE_SHOW_RUNTIME_ARCHIVE_PATH is required for archive runtime source}}"
+ build_dir=$(mktemp -d)
+ trap 'rm -rf "$build_dir"' EXIT
+ git clone --depth 1 https://github.com/avibe-bot/vibe-show-runtime.git "$build_dir/runtime"
+ (
+ cd "$build_dir/runtime"
+ npm ci
+ npm run build
+ npm run bundle:vibe-remote
+ )
+ set -- "$build_dir"/runtime/dist/vibe-show-runtime-node-*.tgz
+ [ "$#" -eq 1 ] && [ -f "$1" ]
+ install -D -m 0644 "$1" "$VIBE_SHOW_RUNTIME_ARCHIVE_PATH"
+fi
+""".strip(),
+ remote=remote,
+ ),
+ timeout=SHOW_RUNTIME_BUILD_TIMEOUT_SECONDS,
+ )
+ result = runner.run(
+ tenant_exec(target, f"{runtime_env_prefix} {VENV_DIR}/bin/vibe runtime prepare --strict", remote=remote),
+ check=False,
+ )
if result.returncode != 0:
- # Retry from a fresh checkout. The npm cache is verified rather than
- # deleted: it grows past a gigabyte, refilling it costs more than the
- # rest of an update put together, and `npm cache verify` already
- # discards exactly the corrupt entries that made deleting it tempting.
- runner.run(tenant_exec(target, "rm -rf ~/.avibe/runtime/show-runtime/source && npm cache verify", remote=remote), check=False)
- runner.run(tenant_exec(target, f"{VENV_DIR}/bin/vibe runtime prepare --strict", remote=remote))
- runner.run(tenant_exec(target, f"{VENV_DIR}/bin/vibe runtime status --json", remote=remote))
+ runner.run(tenant_exec(target, "rm -rf ~/.avibe/runtime/show-runtime/prebuilt/current", remote=remote), check=False)
+ runner.run(tenant_exec(target, f"{runtime_env_prefix} {VENV_DIR}/bin/vibe runtime prepare --strict", remote=remote))
+ runner.run(tenant_exec(target, f"{runtime_env_prefix} {VENV_DIR}/bin/vibe runtime status --json", remote=remote))
def cmd_doctor(args: argparse.Namespace) -> int:
@@ -2563,7 +2627,7 @@ def print_summary(target: RegressionTarget) -> None:
print(f" Target: {target.target}")
print(f" Project: {target.project}")
print(f" Instance: {target.instance}")
- print(f" Show Runtime source: {regression_env('SHOW_RUNTIME_SOURCE', 'github-source')}")
+ print(f" Show Runtime source: {regression_show_runtime_source()}")
def cmd_status(args: argparse.Namespace) -> int:
diff --git a/scripts/incus_regression_supervisor.py b/scripts/incus_regression_supervisor.py
index c4cbc5bdd..a62246c7b 100644
--- a/scripts/incus_regression_supervisor.py
+++ b/scripts/incus_regression_supervisor.py
@@ -12,6 +12,7 @@ from pathlib import Path
from config import paths
from config.v2_config import V2Config
from core.memory.ui_access import generate_ui_read_secret
+from scripts.incus_regression import SERVICE_HOME, regression_show_runtime_env
from vibe import runtime
@@ -90,6 +91,15 @@ def _config() -> V2Config:
return runtime.ensure_config()
+def _normalize_show_runtime_source_environment() -> None:
+ os.environ.update(
+ regression_show_runtime_env(
+ os.environ.get("VIBE_SHOW_RUNTIME_SOURCE"),
+ SERVICE_HOME,
+ )
+ )
+
+
def main() -> int:
stopping = False
@@ -100,6 +110,7 @@ def main() -> int:
signal.signal(signal.SIGTERM, request_stop)
signal.signal(signal.SIGINT, request_stop)
+ _normalize_show_runtime_source_environment()
config = _config()
memory_ui_secret = generate_ui_read_secret()
service_pid = runtime.start_service(
diff --git a/tests/test_incus_regression.py b/tests/test_incus_regression.py
index 53470fc7c..96ceaa0d6 100644
--- a/tests/test_incus_regression.py
+++ b/tests/test_incus_regression.py
@@ -426,6 +426,24 @@ def test_require_incus_reports_missing_override(monkeypatch: pytest.MonkeyPatch)
incus_regression.require_incus()
+def test_runner_reports_command_timeout(monkeypatch: pytest.MonkeyPatch, capsys: pytest.CaptureFixture[str]) -> None:
+ command = ["incus", "exec", "avibe-master"]
+
+ def time_out(actual_command, **kwargs):
+ assert kwargs["timeout"] == incus_regression.SHOW_RUNTIME_BUILD_TIMEOUT_SECONDS
+ raise subprocess.TimeoutExpired(actual_command, kwargs["timeout"])
+
+ monkeypatch.setattr(incus_regression.subprocess, "run", time_out)
+
+ with pytest.raises(incus_regression.RegressionError, match="timed out after 300 seconds"):
+ incus_regression.Runner().run(
+ command,
+ timeout=incus_regression.SHOW_RUNTIME_BUILD_TIMEOUT_SECONDS,
+ )
+
+ assert "Command timed out after 300 seconds" in capsys.readouterr().err
+
+
def test_existence_comes_from_the_names_the_daemon_listed(monkeypatch: pytest.MonkeyPatch) -> None:
listing = json.dumps([{"name": "avr-master"}, {"name": "avr-wt-demo-branch"}])
monkeypatch.setattr(incus_regression.subprocess, "run", stub_incus_result(0, stdout=listing))
@@ -1154,7 +1172,7 @@ def test_legacy_voice_realtime_build_flag_does_not_change_ui_fingerprint(
def test_runtime_env_payload_maps_show_runtime_and_llm_env(monkeypatch: pytest.MonkeyPatch) -> None:
- monkeypatch.setenv("REGRESSION_SHOW_RUNTIME_GITHUB_REF", "main")
+ monkeypatch.setenv("REGRESSION_SHOW_RUNTIME_ARCHIVE_PATH", "/tmp/show-runtime.tgz")
monkeypatch.setenv("REGRESSION_SLACK_CHANNEL", "C123")
monkeypatch.setenv("REGRESSION_VOICE_REALTIME_ENABLED", "false")
monkeypatch.setenv("OPENAI_API_KEY", "sk-test")
@@ -1164,23 +1182,37 @@ def test_runtime_env_payload_maps_show_runtime_and_llm_env(monkeypatch: pytest.M
assert "SETUPTOOLS_SCM_PRETEND_VERSION=0.0.0.dev0" in payload
assert "SETUPTOOLS_SCM_PRETEND_VERSION_FOR_AVIBE_OS=0.0.0.dev0" in payload
assert "AVIBE_ALLOW_DEV_STATE_MIGRATION=1" in payload
- assert "VIBE_SHOW_RUNTIME_SOURCE=github-source" in payload
- assert "VIBE_SHOW_RUNTIME_GITHUB_REF=main" in payload
+ assert "VIBE_SHOW_RUNTIME_SOURCE=archive" in payload
+ assert "VIBE_SHOW_RUNTIME_ARCHIVE_PATH=/home/avibe/.cache/avibe-regression/vibe-show-runtime-node.tgz" in payload
+ assert "VIBE_SHOW_RUNTIME_ARCHIVE_PATH=/tmp/show-runtime.tgz" not in payload
assert "REGRESSION_SLACK_CHANNEL=C123" in payload
assert "VITE_VOICE_REALTIME_ENABLED" not in payload
assert "REGRESSION_VOICE_REALTIME_ENABLED" not in payload
assert "OPENAI_API_KEY=sk-test" in payload
[email protected]("legacy_source", ["github", "github-source"])
+def test_runtime_env_payload_migrates_legacy_github_source(
+ monkeypatch: pytest.MonkeyPatch,
+ legacy_source: str,
+) -> None:
+ monkeypatch.setenv("REGRESSION_SHOW_RUNTIME_SOURCE", legacy_source)
+
+ payload = incus_regression.runtime_env_payload().decode()
+
+ assert "VIBE_SHOW_RUNTIME_SOURCE=archive" in payload
+ assert f"VIBE_SHOW_RUNTIME_SOURCE={legacy_source}" not in payload
+
+
def test_runtime_env_payload_ignores_legacy_regression_env(monkeypatch: pytest.MonkeyPatch) -> None:
- monkeypatch.delenv("REGRESSION_SHOW_RUNTIME_GITHUB_REF", raising=False)
+ monkeypatch.delenv("REGRESSION_SHOW_RUNTIME_ARCHIVE_PATH", raising=False)
monkeypatch.delenv("REGRESSION_SLACK_CHANNEL", raising=False)
- monkeypatch.setenv("THREE_REGRESSION_SHOW_RUNTIME_GITHUB_REF", "legacy-ref")
+ monkeypatch.setenv("THREE_REGRESSION_SHOW_RUNTIME_ARCHIVE_PATH", "/tmp/legacy.tgz")
monkeypatch.setenv("THREE_REGRESSION_SLACK_CHANNEL", "CLEGACY")
payload = incus_regression.runtime_env_payload().decode()
- assert "VIBE_SHOW_RUNTIME_GITHUB_REF=main" in payload
+ assert "VIBE_SHOW_RUNTIME_ARCHIVE_PATH=/home/avibe/.cache/avibe-regression/vibe-show-runtime-node.tgz" in payload
assert "REGRESSION_SLACK_CHANNEL=CLEGACY" not in payload
assert "THREE_REGRESSION_SLACK_CHANNEL" not in payload
@@ -4486,8 +4518,9 @@ def test_missing_ui_dist_rebuilds_even_when_python_is_unchanged() -> None:
assert "pip install -e ." not in joined
-def test_prepare_show_runtime_cleans_partial_source_and_retries_once() -> None:
+def test_prepare_show_runtime_builds_archive_and_retries_from_fresh_install() -> None:
commands = []
+ build_timeouts = []
class RecordingRunner:
def __init__(self) -> None:
@@ -4496,6 +4529,8 @@ def test_prepare_show_runtime_cleans_partial_source_and_retries_once() -> None:
def run(self, command, **kwargs):
joined = " ".join(command)
commands.append(joined)
+ if "git clone --depth 1" in joined:
+ build_timeouts.append(kwargs.get("timeout"))
if "vibe runtime prepare --strict" in joined:
self.prepare_attempts += 1
return subprocess.CompletedProcess(command, 1 if self.prepare_attempts == 1 else 0)
@@ -4514,17 +4549,18 @@ def test_prepare_show_runtime_cleans_partial_source_and_retries_once() -> None:
incus_regression.prepare_show_runtime(RecordingRunner(), target, remote=None)
joined = "\n".join(commands)
+ assert "git clone --depth 1 https://github.com/avibe-bot/vibe-show-runtime.git" in joined
+ assert "npm run bundle:vibe-remote" in joined
+ assert 'install -D -m 0644 "$1" "$VIBE_SHOW_RUNTIME_ARCHIVE_PATH"' in joined
+ assert build_timeouts == [incus_regression.SHOW_RUNTIME_BUILD_TIMEOUT_SECONDS]
+ build_command = next(command for command in commands if "git clone --depth 1" in command)
+ assert build_command.index("VIBE_SHOW_RUNTIME_ARCHIVE_PATH is required") < build_command.index("git clone")
assert joined.count("vibe runtime prepare --strict") == 2
- assert "rm -rf ~/.avibe/runtime/show-runtime/source" in joined
+ assert "rm -rf ~/.avibe/runtime/show-runtime/prebuilt/current" in joined
assert "vibe runtime status --json" in joined
-def test_prepare_show_runtime_retry_verifies_the_npm_cache_instead_of_deleting_it() -> None:
- """The npm cache is a gigabyte of downloads shared by every later build.
-
- Deleting it turns one failed prepare into a cold rebuild of everything;
- `npm cache verify` drops the corrupt entries and keeps the rest.
- """
+def test_prepare_show_runtime_retry_keeps_the_npm_cache() -> None:
commands = []
class RecordingRunner:
@@ -4552,8 +4588,54 @@ def test_prepare_show_runtime_retry_verifies_the_npm_cache_instead_of_deleting_i
incus_regression.prepare_show_runtime(RecordingRunner(), target, remote=None)
joined = "\n".join(commands)
- assert "npm cache verify" in joined
assert "_cacache" not in joined
+ assert "npm cache clean" not in joined
+
+
[email protected]("legacy_source", ["github", "github-source", "GitHub-Source"])
+def test_retired_runtime_source_is_recognized_by_product_and_regression(
+ legacy_source: str,
+) -> None:
+ from core.show_runtime import _normalize_runtime_source
+
+ assert incus_regression.regression_show_runtime_source(legacy_source) == "archive"
+ assert _normalize_runtime_source(legacy_source) == "manifest-cache"
+
+ commands = []
+
+ class RecordingRunner:
+ def __init__(self) -> None:
+ self.prepare_attempts = 0
+
+ def run(self, command, **kwargs):
+ joined = " ".join(command)
+ commands.append(joined)
+ if 'printf "%s" "${VIBE_SHOW_RUNTIME_SOURCE:-}"' in joined:
+ return subprocess.CompletedProcess(command, 0, stdout=legacy_source)
+ if "vibe runtime prepare --strict" in joined:
+ self.prepare_attempts += 1
+ return subprocess.CompletedProcess(command, 1 if self.prepare_attempts == 1 else 0)
+ return subprocess.CompletedProcess(command, 0)
+
+ target = incus_regression.RegressionTarget(
+ target="master",
+ slug="master",
+ project="avr-master",
+ instance="avibe-master",
+ host_port=15130,
+ ui_host="127.0.0.1",
+ ui_port=5123,
+ )
+
+ incus_regression.prepare_show_runtime(RecordingRunner(), target, remote=None)
+
+ joined = "\n".join(commands)
+ assert "cat > /etc/avibe-regression.env" not in joined
+ assert "git clone --depth 1 https://github.com/avibe-bot/vibe-show-runtime.git" in joined
+ assert joined.count("VIBE_SHOW_RUNTIME_SOURCE=archive") == 4
+ archive_path = f"{incus_regression.SERVICE_HOME}/.cache/avibe-regression/vibe-show-runtime-node.tgz"
+ assert joined.count(f"VIBE_SHOW_RUNTIME_ARCHIVE_PATH={archive_path}") == 4
+ assert f"VIBE_SHOW_RUNTIME_SOURCE={legacy_source}" not in joined
def test_restart_waits_for_service_and_status_running() -> None:
diff --git a/tests/test_incus_regression_supervisor.py b/tests/test_incus_regression_supervisor.py
index ff8f42d82..425d8b348 100644
--- a/tests/test_incus_regression_supervisor.py
+++ b/tests/test_incus_regression_supervisor.py
@@ -1,6 +1,8 @@
from __future__ import annotations
import importlib.util
+import os
+import subprocess
import sys
from pathlib import Path
from types import SimpleNamespace
@@ -8,6 +10,7 @@ from types import SimpleNamespace
import pytest
from config import paths
+from scripts import incus_regression
from vibe import runtime
# The supervisor lives in scripts/ (not an installed package); load it the same
@@ -26,6 +29,75 @@ def _write_restart_status(status: dict) -> None:
runtime.write_json(path, status)
+ ("configured", "expected"),
+ [
+ ("github", "archive"),
+ ("github-source", "archive"),
+ ("archive", "archive"),
+ ("manifest-cache", "manifest-cache"),
+ ("npm", "npm"),
+ ],
+)
+def test_supervisor_normalizes_preserved_runtime_source_without_touching_other_env(
+ monkeypatch,
+ configured,
+ expected,
+):
+ monkeypatch.setenv("VIBE_SHOW_RUNTIME_SOURCE", configured)
+ monkeypatch.delenv("VIBE_SHOW_RUNTIME_ARCHIVE_PATH", raising=False)
+ monkeypatch.setenv("REGRESSION_UNRELATED_SETTING", "preserved")
+
+ supervisor._normalize_show_runtime_source_environment()
+
+ assert os.environ["VIBE_SHOW_RUNTIME_SOURCE"] == expected
+ if expected == "archive":
+ assert os.environ["VIBE_SHOW_RUNTIME_ARCHIVE_PATH"] == (
+ "/home/avibe/.cache/avibe-regression/vibe-show-runtime-node.tgz"
+ )
+ else:
+ assert "VIBE_SHOW_RUNTIME_ARCHIVE_PATH" not in os.environ
+ assert os.environ["REGRESSION_UNRELATED_SETTING"] == "preserved"
+
+
+def test_preserved_custom_archive_path_cannot_split_build_and_supervisor(
+ monkeypatch,
+):
+ custom_path = "/srv/custom/show-runtime.tgz"
+ monkeypatch.setenv("VIBE_SHOW_RUNTIME_SOURCE", "archive")
+ monkeypatch.setenv("VIBE_SHOW_RUNTIME_ARCHIVE_PATH", custom_path)
+ monkeypatch.setenv("REGRESSION_SHOW_RUNTIME_ARCHIVE_PATH", custom_path)
+
+ supervisor._normalize_show_runtime_source_environment()
+ supervisor_path = os.environ["VIBE_SHOW_RUNTIME_ARCHIVE_PATH"]
+
+ commands = []
+
+ class RecordingRunner:
+ def run(self, command, **kwargs):
+ joined = " ".join(command)
+ commands.append(joined)
+ if 'printf "%s" "${VIBE_SHOW_RUNTIME_SOURCE:-}"' in joined:
+ return subprocess.CompletedProcess(command, 0, stdout="archive")
+ return subprocess.CompletedProcess(command, 0)
+
+ target = incus_regression.RegressionTarget(
+ target="master",
+ slug="master",
+ project="avr-master",
+ instance="avibe-master",
+ host_port=15130,
+ ui_host="127.0.0.1",
+ ui_port=5123,
+ )
+
+ incus_regression.prepare_show_runtime(RecordingRunner(), target, remote=None)
+
+ build_command = next(command for command in commands if "git clone --depth 1" in command)
+ assert custom_path not in build_command
+ assert f"export VIBE_SHOW_RUNTIME_ARCHIVE_PATH={supervisor_path}" in build_command
+
+
def test_restart_in_progress_true_while_job_pid_alive(monkeypatch, tmp_path):
monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
paths.ensure_data_dirs()
diff --git a/tests/test_local_deps.py b/tests/test_local_deps.py
index d5cc5851e..01606f111 100644
--- a/tests/test_local_deps.py
+++ b/tests/test_local_deps.py
@@ -1240,7 +1240,7 @@ def test_dependencies_status_shape(monkeypatch):
),
pytest.param(
{
- "provider": "github-source",
+ "provider": "npm",
"install": {"state": "installed", "runtime_version": None, "matches_manifest": None},
"manifest": None,
"node_available": True,
@@ -1248,7 +1248,7 @@ def test_dependencies_status_shape(monkeypatch):
"node_version": "22.12.0",
},
{"version": None, "latest_version": None, "has_update": False},
- id="github-source-not-comparable",
+ id="npm-not-comparable",
),
),
)
diff --git a/tests/test_show_runtime_github_source.py b/tests/test_show_runtime_github_source.py
deleted file mode 100644
index 39c892b7f..000000000
--- a/tests/test_show_runtime_github_source.py
+++ /dev/null
@@ -1,348 +0,0 @@
-"""The github-source provider must not rebuild a commit it already built.
-
-Every ``vibe runtime prepare`` used to re-run ``npm ci`` and ``npm run build``
-against a checkout that ``git fetch`` had just confirmed was unchanged, which
-is around forty seconds on each regression update. A marker recording the
-commit that produced the artifacts on disk turns that into one shallow fetch.
-"""
-
-from __future__ import annotations
-
-import subprocess
-from pathlib import Path
-
-import pytest
-
-from core import show_runtime
-
-
-def git(*args: str, cwd: Path) -> str:
- result = subprocess.run(
- ["git", *args],
- cwd=cwd,
- capture_output=True,
- text=True,
- check=True,
- env={
- "PATH": "/usr/bin:/bin:/usr/local/bin",
- "HOME": str(cwd),
- "GIT_AUTHOR_NAME": "t",
- "GIT_AUTHOR_EMAIL": "[email protected]",
- "GIT_COMMITTER_NAME": "t",
- "GIT_COMMITTER_EMAIL": "[email protected]",
- "GIT_CONFIG_GLOBAL": "/dev/null",
- "GIT_CONFIG_SYSTEM": "/dev/null",
- },
- )
- return result.stdout.strip()
-
-
-def make_upstream(tmp_path: Path) -> Path:
- upstream = tmp_path / "upstream"
- upstream.mkdir()
- git("init", "-b", "main", cwd=upstream)
- (upstream / "package.json").write_text('{"name": "runtime"}\n', encoding="utf-8")
- (upstream / ".gitignore").write_text("node_modules\npackages/runtime/dist\n", encoding="utf-8")
- git("add", "-A", cwd=upstream)
- git("commit", "-m", "one", cwd=upstream)
- return upstream
-
-
-class Harness:
- """A manager wired to a local upstream, with npm simulated and git real."""
-
- def __init__(self, tmp_path: Path, upstream: Path, *, force_install: bool = False) -> None:
- self.npm_commands: list[list[str]] = []
- self.manager = show_runtime.ShowRuntimeManager(
- runtime_dir=tmp_path / "runtime",
- runtime_source="github-source",
- github_repo=str(upstream),
- github_ref="main",
- force_install=force_install,
- )
- self.manager._run_install_command = self._run # type: ignore[method-assign]
-
- def _run(self, command: list[str], *, cwd: Path | None = None) -> bool:
- if Path(command[0]).name == "npm":
- self.npm_commands.append(command)
- if command[1:] == ["run", "build"]:
- cli = Path(cwd or ".") / "packages" / "runtime" / "dist" / "cli.js"
- cli.parent.mkdir(parents=True, exist_ok=True)
- cli.write_text("#!/usr/bin/env node\n", encoding="utf-8")
- return True
- return subprocess.run(command, cwd=cwd, capture_output=True).returncode == 0
-
-
[email protected](autouse=True)
-def resolvable_toolchain(monkeypatch: pytest.MonkeyPatch) -> None:
- real_resolve = show_runtime._resolve_command
- monkeypatch.setattr(show_runtime, "_resolve_node_command", lambda: ["/usr/bin/node"])
- monkeypatch.setattr(
- show_runtime,
- "_resolve_command",
- lambda name: ["/usr/bin/npm"] if name == "npm" else real_resolve(name),
- )
-
-
-def test_first_install_builds_and_records_the_commit_it_built(tmp_path: Path) -> None:
- upstream = make_upstream(tmp_path)
- harness = Harness(tmp_path, upstream)
-
- assert harness.manager._install_github_runtime().command
-
- assert [command[1:] for command in harness.npm_commands] == [["ci"], ["run", "build"]]
- source_dir = harness.manager._github_source_dir()
- expected_revision = git("rev-parse", "HEAD", cwd=upstream)
- assert harness.manager._read_github_build_marker(source_dir) == expected_revision
- assert harness.manager.status()["github_source"] == {"built_revision": expected_revision}
-
-
-def test_unchanged_upstream_reuses_the_build_instead_of_repeating_it(tmp_path: Path) -> None:
- upstream = make_upstream(tmp_path)
- harness = Harness(tmp_path, upstream)
- assert harness.manager._install_github_runtime().command
- harness.npm_commands.clear()
-
- command = harness.manager._install_github_runtime().command
-
- assert command # the runtime is still usable
- assert harness.npm_commands == []
- assert harness.manager._install_reason is None
-
-
-def test_a_new_upstream_commit_is_still_picked_up(tmp_path: Path) -> None:
- upstream = make_upstream(tmp_path)
- harness = Harness(tmp_path, upstream)
- assert harness.manager._install_github_runtime().command
- harness.npm_commands.clear()
-
- (upstream / "package.json").write_text('{"name": "runtime", "version": "2"}\n', encoding="utf-8")
- git("commit", "-am", "two", cwd=upstream)
-
- assert harness.manager._install_github_runtime().command
-
- assert [command[1:] for command in harness.npm_commands] == [["ci"], ["run", "build"]]
- source_dir = harness.manager._github_source_dir()
- assert harness.manager._read_github_build_marker(source_dir) == git("rev-parse", "HEAD", cwd=upstream)
-
-
-def test_force_install_rebuilds_even_when_the_commit_matches(tmp_path: Path) -> None:
- upstream = make_upstream(tmp_path)
- harness = Harness(tmp_path, upstream)
- assert harness.manager._install_github_runtime().command
- harness.npm_commands.clear()
-
- assert harness.manager._install_github_runtime(force=True).command
-
- assert [command[1:] for command in harness.npm_commands] == [["ci"], ["run", "build"]]
-
-
-def test_force_install_fails_before_build_when_old_output_remains(
- monkeypatch: pytest.MonkeyPatch,
- tmp_path: Path,
-) -> None:
- upstream = make_upstream(tmp_path)
- harness = Harness(tmp_path, upstream)
- assert harness.manager._install_github_runtime().command
- harness.npm_commands.clear()
- monkeypatch.setattr(show_runtime.shutil, "rmtree", lambda _path: None)
-
- attempt = harness.manager._install_github_runtime(force=True)
-
- assert attempt.command is None
- assert attempt.operation_reason == "runtime_install_failed"
- assert harness.manager._install_reason is None
- assert harness.npm_commands == []
-
-
-def test_forced_update_failure_reports_failed_operation_and_installed_state(tmp_path: Path) -> None:
- upstream = make_upstream(tmp_path)
- harness = Harness(tmp_path, upstream)
- installed = harness.manager.prepare()
- assert installed["ok"] is True
-
- def fail_update(_command: list[str], *, cwd: Path | None = None) -> bool:
- del cwd
- harness.manager._install_reason = "runtime_install_failed"
- return False
-
- harness.manager._run_install_command = fail_update # type: ignore[method-assign]
-
- result = harness.manager.prepare(force=True)
-
- assert result["ok"] is False
- assert result["reason"] == "runtime_github_source_update_failed"
- assert result["command"] == installed["command"]
- assert result["install"]["state"] == "installed"
- assert result["install"]["reason"] is None
- assert result["status"]["install"]["state"] == "installed"
- assert result["status"]["reason"] is None
- assert result["status"]["command"] == installed["command"]
-
-
-def test_failed_github_build_does_not_publish_checkout_revision_as_artifact_provenance(
- monkeypatch: pytest.MonkeyPatch,
- tmp_path: Path,
- capsys: pytest.CaptureFixture[str],
-) -> None:
- from vibe import cli
-
- upstream = make_upstream(tmp_path)
- installed = Harness(tmp_path, upstream)
- first = installed.manager.prepare()
- source_dir = installed.manager._github_source_dir()
- old_command = first["command"]
- (upstream / "package.json").write_text('{"name": "runtime", "version": "2"}\n', encoding="utf-8")
- git("commit", "-am", "upstream update", cwd=upstream)
- target_revision = git("rev-parse", "HEAD", cwd=upstream)
- attempt = Harness(tmp_path, upstream)
- real_run = attempt._run
-
- def fail_npm_ci(command: list[str], *, cwd: Path | None = None) -> bool:
- if Path(command[0]).name == "npm" and command[1:] == ["ci"]:
- attempt.npm_commands.append(command)
- return False
- return real_run(command, cwd=cwd)
-
- attempt.manager._run_install_command = fail_npm_ci # type: ignore[method-assign]
- result = attempt.manager.prepare(automatic=True)
-
- assert result["ok"] is True
- assert result["command"] == old_command
- assert attempt.manager._read_github_build_marker(source_dir) is None
- assert result["status"]["github_source"]["built_revision"] is None
- monkeypatch.setattr(cli, "_configured_cli_language", lambda: "en")
- cli._print_runtime_status(result["status"])
- output = capsys.readouterr().out
- assert target_revision not in output
- assert "prepared from" not in output
- assert "serving local revision" not in output
-
-
-def test_failed_forced_build_invalidates_the_cached_command_before_retry(tmp_path: Path) -> None:
- upstream = make_upstream(tmp_path)
- harness = Harness(tmp_path, upstream)
- installed = harness.manager.prepare()
- assert installed["ok"] is True
- real_run = harness._run
-
- def fail_the_build(command: list[str], *, cwd: Path | None = None) -> bool:
- if command[1:] == ["run", "build"]:
- harness.npm_commands.append(command)
- harness.manager._install_reason = "runtime_install_failed"
- return False
- return real_run(command, cwd=cwd)
-
- harness.manager._run_install_command = fail_the_build # type: ignore[method-assign]
- harness.npm_commands.clear()
-
- forced = harness.manager.prepare(force=True)
- retried = harness.manager.prepare()
-
- assert forced["ok"] is False
- assert forced["status"]["install"]["state"] == "absent"
- assert retried["ok"] is False
- assert retried["reason"] == "runtime_install_failed"
- assert harness.manager._managed_command is None
- assert [command[1:] for command in harness.npm_commands] == [
- ["ci"],
- ["run", "build"],
- ["ci"],
- ["run", "build"],
- ]
-
-
- "delegate_outcome",
- (
- subprocess.CompletedProcess(args=["git", "fetch"], returncode=1),
- OSError("git spawn failed"),
- subprocess.TimeoutExpired(cmd=["git", "fetch"], timeout=300),
- ),
-)
-def test_github_delegate_failures_are_structured(
- monkeypatch: pytest.MonkeyPatch,
- tmp_path: Path,
- delegate_outcome: subprocess.CompletedProcess | Exception,
-) -> None:
- manager = show_runtime.ShowRuntimeManager(runtime_dir=tmp_path / "runtime")
- manager.runtime_dir.mkdir(parents=True)
-
- def run_delegate(*_args, **_kwargs):
- if isinstance(delegate_outcome, Exception):
- raise delegate_outcome
- return delegate_outcome
-
- monkeypatch.setattr(show_runtime.subprocess, "run", run_delegate)
-
- assert manager._run_install_command(["git", "fetch"]) is False
- assert manager._install_reason == "runtime_install_failed"
-
-
-def test_a_failed_build_leaves_no_marker_licensing_a_skip(tmp_path: Path) -> None:
- """A marker may only ever describe artifacts that exist right now.
-
- Otherwise a build that died halfway would make every later prepare skip the
- repair it needs.
- """
- upstream = make_upstream(tmp_path)
- harness = Harness(tmp_path, upstream)
- real_run = harness._run
-
- def fail_the_build(command: list[str], *, cwd: Path | None = None) -> bool:
- if command[1:] == ["run", "build"]:
- harness.npm_commands.append(command)
- return False
- return real_run(command, cwd=cwd)
-
- harness.manager._run_install_command = fail_the_build # type: ignore[method-assign]
- assert harness.manager._install_github_runtime().command is None
-
- source_dir = harness.manager._github_source_dir()
- assert harness.manager._read_github_build_marker(source_dir) is None
-
- harness.manager._run_install_command = real_run # type: ignore[method-assign]
- harness.npm_commands.clear()
- assert harness.manager._install_github_runtime().command
- assert [command[1:] for command in harness.npm_commands] == [["ci"], ["run", "build"]]
-
-
-# The complete rebuild sequence, asserted by
-# ``test_first_install_builds_and_records_the_commit_it_built``. Each step
-# replaces part of the artifact the marker describes, so each one failing must
-# leave the marker gone.
[email protected]("failing_step", [["ci"], ["run", "build"]])
-def test_a_failed_rebuild_retracts_the_marker_it_had_already_earned(tmp_path: Path, failing_step: list[str]) -> None:
- """The marker describes the artifact on disk, and a rebuild replaces it.
-
- A rebuild at the commit already recorded is the case that bites: the marker
- still names that commit while ``npm ci`` has emptied node_modules, so the
- next ordinary prepare would fetch the same commit, match the marker, find
- the stale entry point still resolving, and skip the repair forever.
- """
- upstream = make_upstream(tmp_path)
- harness = Harness(tmp_path, upstream)
- assert harness.manager._install_github_runtime().command
- built = harness.manager._read_github_build_marker(harness.manager._github_source_dir())
- assert built
-
- real_run = harness._run
-
- def fail_one_step(command: list[str], *, cwd: Path | None = None) -> bool:
- if command[1:] == failing_step:
- harness.npm_commands.append(command)
- return False
- return real_run(command, cwd=cwd)
-
- harness.manager._run_install_command = fail_one_step # type: ignore[method-assign]
- harness.manager.force_install = True
- harness.npm_commands.clear()
- harness.manager._install_github_runtime()
-
- assert harness.manager._read_github_build_marker(harness.manager._github_source_dir()) is None
-
- harness.manager._run_install_command = real_run # type: ignore[method-assign]
- harness.manager.force_install = False
- harness.npm_commands.clear()
- assert harness.manager._install_github_runtime().command
- assert [command[1:] for command in harness.npm_commands] == [["ci"], ["run", "build"]]
diff --git a/tests/test_ui_show_pages.py b/tests/test_ui_show_pages.py
index 081951960..924f172a2 100644
--- a/tests/test_ui_show_pages.py
+++ b/tests/test_ui_show_pages.py
@@ -7194,7 +7194,6 @@ def test_managed_status_runtime_dimension_uses_availability_schema(monkeypatch,
("provider", "resolver_name"),
(
("manifest-cache", "_installed_manifest_runtime_command"),
- ("github-source", "_installed_github_runtime_command"),
("npm", None),
),
)
@@ -7651,7 +7650,6 @@ def test_provider_install_entrypoints_converge_on_single_admission_owner():
provider_methods = {
"_install_manifest_runtime_locked",
"_install_archive_runtime",
- "_install_github_runtime",
"_install_npm_runtime",
}
direct_provider_callers = {
@@ -9213,9 +9211,9 @@ def test_show_runtime_prepare_prunes_old_packaged_installs_and_keeps_rollback(mo
manifest_source=str(tmp_path / "development-manifest.json"),
mtime=50,
)
- github_source = runtime_dir / "source" / "github" / "avibe-bot_vibe-show-runtime" / "main"
- github_source.mkdir(parents=True)
- (github_source / "README.md").write_text("development checkout\n", encoding="utf-8")
+ unrelated_source = runtime_dir / "source" / "custom" / "runtime"
+ unrelated_source.mkdir(parents=True)
+ (unrelated_source / "README.md").write_text("custom runtime\n", encoding="utf-8")
local_bin = runtime_dir / "package" / "node_modules" / ".bin" / "avibe-show-runtime"
local_bin.parent.mkdir(parents=True)
local_bin.write_text("#!/bin/sh\n", encoding="utf-8")
@@ -9239,7 +9237,7 @@ def test_show_runtime_prepare_prunes_old_packaged_installs_and_keeps_rollback(mo
assert previous_install.exists() is True
assert old_install.exists() is False
assert custom_install.exists() is True
- assert github_source.exists() is True
+ assert unrelated_source.exists() is True
assert local_bin.exists() is True
@@ -10035,9 +10033,7 @@ def test_show_runtime_manager_fails_closed_when_manifest_is_absent(tmp_path):
assert manager.status()["reason"] == "runtime_manifest_missing"
-def test_show_runtime_manager_defaults_to_manifest_provider_outside_development_checkout(monkeypatch, tmp_path):
- monkeypatch.setattr("core.show_runtime._packaged_runtime_manifest_exists", lambda: False)
- monkeypatch.setattr("core.show_runtime._running_from_development_checkout", lambda: False)
+def test_show_runtime_manager_defaults_to_manifest_provider(tmp_path):
manager = ShowRuntimeManager(
workspace_root=tmp_path / "show",
runtime_dir=tmp_path / "runtime",
@@ -10046,132 +10042,6 @@ def test_show_runtime_manager_defaults_to_manifest_provider_outside_development_
assert manager.runtime_source == "manifest-cache"
-def test_show_runtime_manager_uses_github_source_in_development_checkout_without_manifest(monkeypatch, tmp_path):
- monkeypatch.setattr("core.show_runtime._packaged_runtime_manifest_exists", lambda: False)
- monkeypatch.setattr("core.show_runtime._running_from_development_checkout", lambda: True)
- manager = ShowRuntimeManager(
- workspace_root=tmp_path / "show",
- runtime_dir=tmp_path / "runtime",
- )
-
- assert manager.runtime_source == "github"
-
-
-def test_show_runtime_manager_installs_from_github_source(monkeypatch, tmp_path):
- runtime_dir = tmp_path / "runtime"
- source_dir = runtime_dir / "source" / "github" / "avibe-bot_vibe-show-runtime" / "main"
- commands = []
-
- manager = ShowRuntimeManager(
- workspace_root=tmp_path / "show",
- runtime_dir=runtime_dir,
- runtime_source="github",
- github_repo="https://github.com/avibe-bot/vibe-show-runtime.git",
- github_ref="main",
- )
-
- monkeypatch.setattr(
- "core.show_runtime._resolve_command",
- lambda command: [f"/bin/{command}"] if command in {"git", "npm", "node"} else None,
- )
-
- def fake_run(command, *, cwd=None):
- commands.append((command, cwd))
- if command[:2] == ["/bin/npm", "run"]:
- cli_path = source_dir / "packages" / "runtime" / "dist" / "cli.js"
- cli_path.parent.mkdir(parents=True, exist_ok=True)
- cli_path.write_text("#!/usr/bin/env node\n", encoding="utf-8")
- return True
-
- monkeypatch.setattr(manager, "_run_install_command", fake_run)
- monkeypatch.setattr(manager, "_git_revision", lambda *_args: "0123456789abcdef")
-
- attempt = manager._install_managed_runtime_locked(force=False, offline=False)
-
- assert attempt.command == [
- "/bin/node",
- str(source_dir / "packages" / "runtime" / "dist" / "cli.js"),
- ]
- clone_command, clone_cwd = commands[0]
- assert clone_command[:-1] == [
- "/bin/git",
- "clone",
- "--depth",
- "1",
- "--branch",
- "main",
- "https://github.com/avibe-bot/vibe-show-runtime.git",
- ]
- assert clone_cwd is None
- assert Path(clone_command[-1]) == source_dir
- assert commands[1:] == [
- (["/bin/npm", "ci"], source_dir),
- (["/bin/npm", "run", "build"], source_dir),
- ]
- assert manager.status()["github_source"] == {"built_revision": "0123456789abcdef"}
-
-
-def test_show_runtime_manager_reuses_installed_github_runtime_when_update_fails(monkeypatch, tmp_path):
- runtime_dir = tmp_path / "runtime"
- source_dir = runtime_dir / "source" / "github" / "avibe-bot_vibe-show-runtime" / "main"
- cli_path = source_dir / "packages" / "runtime" / "dist" / "cli.js"
- cli_path.parent.mkdir(parents=True)
- cli_path.write_text("#!/usr/bin/env node\n", encoding="utf-8")
- commands = []
-
- manager = ShowRuntimeManager(
- workspace_root=tmp_path / "show",
- runtime_dir=runtime_dir,
- runtime_source="github",
- github_repo="https://github.com/avibe-bot/vibe-show-runtime.git",
- github_ref="main",
- )
-
- monkeypatch.setattr(
- "core.show_runtime._resolve_command",
- lambda command: [f"/bin/{command}"] if command in {"git", "npm", "node"} else None,
- )
-
- def fake_run(command, *, cwd=None):
- commands.append((command, cwd))
- return False
-
- monkeypatch.setattr(manager, "_run_install_command", fake_run)
-
- assert manager._install_managed_runtime_locked(force=False, offline=False).command == ["/bin/node", str(cli_path)]
- assert manager._install_reason is None
- assert commands == [
- (
- ["/bin/git", "-C", str(source_dir), "fetch", "--depth", "1", "origin", "main"],
- None,
- )
- ]
-
-
-def test_show_runtime_manager_reuses_installed_github_runtime_without_git(monkeypatch, tmp_path):
- runtime_dir = tmp_path / "runtime"
- source_dir = runtime_dir / "source" / "github" / "avibe-bot_vibe-show-runtime" / "main"
- cli_path = source_dir / "packages" / "runtime" / "dist" / "cli.js"
- cli_path.parent.mkdir(parents=True)
- cli_path.write_text("#!/usr/bin/env node\n", encoding="utf-8")
-
- manager = ShowRuntimeManager(
- workspace_root=tmp_path / "show",
- runtime_dir=runtime_dir,
- runtime_source="github",
- github_repo="https://github.com/avibe-bot/vibe-show-runtime.git",
- github_ref="main",
- )
-
- monkeypatch.setattr(
- "core.show_runtime._resolve_command",
- lambda command: ["/bin/node"] if command == "node" else None,
- )
-
- assert manager._install_managed_runtime_locked(force=False, offline=False).command == ["/bin/node", str(cli_path)]
- assert manager._install_reason is None
-
-
def test_show_runtime_manager_can_use_npm_source(monkeypatch, tmp_path):
manager = ShowRuntimeManager(
workspace_root=tmp_path / "show",
diff --git a/tests/test_vibe_cli.py b/tests/test_vibe_cli.py
index be1c247be..79a9f50ab 100644
--- a/tests/test_vibe_cli.py
+++ b/tests/test_vibe_cli.py
@@ -1801,6 +1801,32 @@ def test_show_runtime_doctor_fast_mode_reports_local_state_without_network(monke
assert next(item for item in items if item.get("code") == "show_runtime.archive_probe_skipped")["status"] == "pass"
[email protected]("language", ["en", "zh"])
+def test_show_runtime_doctor_retires_legacy_source_with_actionable_replacement(
+ monkeypatch,
+ language,
+):
+ manager = SimpleNamespace(
+ status=lambda: {
+ "provider": "github",
+ "platform": "linux-x64",
+ "explicit_command": None,
+ "node_available": True,
+ "node_supported": True,
+ "install": {"state": "absent", "install_dir": None},
+ },
+ archive_cache_status=lambda: {"candidate_count": 0, "candidate_bytes": 0, "skipped_reason": None},
+ )
+ monkeypatch.setattr("core.show_runtime.ShowRuntimeManager", lambda **_kwargs: manager)
+ monkeypatch.setattr(cli, "_configured_cli_language", lambda: language)
+
+ items = cli._show_runtime_doctor_items(deep=False)
+
+ failure = next(item for item in items if item.get("code") == "show_runtime.provider_unsupported")
+ assert failure["status"] == "fail"
+ assert failure["action"] == cli.i18n_t("runtime.doctor.providerUnsupportedAction", language)
+
+
def test_show_runtime_doctor_reports_skipped_archive_inspection_as_warn(monkeypatch):
status = {
"provider": "manifest-cache",
@@ -2290,58 +2316,6 @@ def test_repair_show_runtime_prepares_missing_runtime(monkeypatch, tmp_path):
assert stopped == [True]
-def test_repair_show_runtime_first_github_install_failure_does_not_claim_preserved_install(
- monkeypatch,
- tmp_path,
-):
- from core.show_runtime import ShowRuntimeManager
-
- real_manager = ShowRuntimeManager(
- runtime_dir=tmp_path / "runtime",
- runtime_source="github-source",
- github_repo=str(tmp_path / "upstream"),
- github_ref="main",
- )
- status = real_manager.status()
- source_dir = real_manager._github_source_dir()
- prepared = []
-
- def prepare(force=False):
- prepared.append(force)
- return {
- "ok": False,
- "reason": "runtime_github_source_update_failed",
- "provider": "github-source",
- "platform": "linux-x64",
- "command": None,
- "status": status,
- }
-
- manager = SimpleNamespace(status=lambda: status, prepare=prepare)
- monkeypatch.setattr("core.show_runtime.ShowRuntimeManager", lambda **_kwargs: manager)
- monkeypatch.setattr(cli, "_configured_cli_language", lambda: "en")
-
- result = cli._repair_show_runtime()
-
- assert status["install"] == {
- "state": "absent",
- "reason": None,
- "failure_class": None,
- "recovery_action": None,
- "command": None,
- "install_dir": None,
- "runtime_version": None,
- "matches_manifest": None,
- }
- assert "installed" not in status
- assert "installed_matches_manifest" not in status
- assert "install_dir" not in status
- assert str(source_dir) not in result["message"]
- assert result["message"] == "Show Runtime preparation failed: runtime_github_source_update_failed"
- assert result["installed"] is False
- assert prepared == [False]
-
-
def test_repair_show_runtime_does_not_reinstall_startable_runtime(monkeypatch, tmp_path):
constructor_calls = []
verifier_stops = []
@@ -2684,80 +2658,6 @@ def test_repair_show_runtime_reports_failed_replacement_while_old_runtime_remain
assert prepared == [True]
- ("language", "expected_cause", "expected_action"),
- [
- (
- "en",
- "could not complete the managed source update",
- "Check directory permissions and the Avibe log",
- ),
- (
- "zh",
- "\u65e0\u6cd5\u5728",
- "\u68c0\u67e5\u76ee\u5f55\u6743\u9650\u548c Avibe \u65e5\u5fd7",
- ),
- ],
-)
-def test_repair_show_runtime_names_github_update_failure_and_remediation(
- monkeypatch,
- tmp_path,
- language,
- expected_cause,
- expected_action,
-):
- source_dir = tmp_path / "github-source"
- prepared = []
-
- def prepare(force=False):
- prepared.append(force)
- return {
- "ok": False,
- "reason": "runtime_github_source_update_failed",
- "provider": "github-source",
- "platform": "linux-x64",
- "command": None,
- "status": {
- "install": {"state": "installed", "install_dir": str(source_dir)},
- },
- }
-
- manager = SimpleNamespace(
- status=lambda: {
- "provider": "github-source",
- "platform": "linux-x64",
- "install": {"state": "installed", "install_dir": str(source_dir)},
- "command": [str(tmp_path / "node"), str(source_dir / "cli.js")],
- },
- prepare=prepare,
- )
-
- def manager_factory(**kwargs):
- if not kwargs:
- return manager
- return SimpleNamespace(
- ensure=lambda: asyncio.sleep(
- 0,
- result=SimpleNamespace(available=False, reason="runtime_start_health_timeout"),
- ),
- stop=lambda: None,
- )
-
- monkeypatch.setattr(cli, "_configured_cli_language", lambda: language)
- monkeypatch.setattr("core.show_runtime.ShowRuntimeManager", manager_factory)
-
- result = cli._repair_show_runtime()
-
- assert result["status"] == "failed"
- assert result["reason"] == "runtime_github_source_update_failed"
- assert result["installed"] is True
- assert result["install_dir"] == str(source_dir)
- assert str(source_dir) in result["message"]
- assert expected_cause in result["message"]
- assert expected_action in result["message"]
- assert prepared == [True]
-
-
def test_runtime_prepare_strict_does_not_report_policy_skip_as_ready(monkeypatch, capsys):
manager = SimpleNamespace(
prepare=lambda **_kwargs: {
@@ -2828,6 +2728,35 @@ def test_runtime_prepare_force_does_not_report_explicit_command_as_replaced(monk
assert "VIBE_SHOW_RUNTIME_BIN" in captured.err
[email protected]("legacy_source", ["github", "github-source", "GitHub-Source"])
+def test_runtime_manager_migrates_legacy_source_to_packaged_manifest(
+ monkeypatch,
+ caplog,
+ tmp_path,
+ legacy_source,
+):
+ from core import show_runtime
+
+ monkeypatch.setenv("VIBE_SHOW_RUNTIME_SOURCE", legacy_source)
+ monkeypatch.setattr(show_runtime, "_WARNED_RETIRED_RUNTIME_SOURCES", set())
+ with caplog.at_level("WARNING", logger="core.show_runtime"):
+ manager = show_runtime.ShowRuntimeManager(
+ workspace_root=tmp_path / "show",
+ runtime_dir=tmp_path / "runtime",
+ )
+ second_manager = show_runtime.ShowRuntimeManager(
+ workspace_root=tmp_path / "show-2",
+ runtime_dir=tmp_path / "runtime-2",
+ )
+
+ assert manager.runtime_source == "manifest-cache"
+ assert second_manager.runtime_source == "manifest-cache"
+ warnings = [record.message for record in caplog.records if "is retired" in record.message]
+ assert warnings == [
+ f"VIBE_SHOW_RUNTIME_SOURCE={legacy_source.lower()} is retired; using manifest-cache instead"
+ ]
+
+
@pytest.mark.parametrize("failure_phase", ["temporary_directory", "verifier", "cleanup"])
def test_repair_show_runtime_reports_verification_workspace_failures(monkeypatch, tmp_path, failure_phase):
prepared = []
diff --git a/vibe/cli.py b/vibe/cli.py
index 4a59b25e5..a427e62d7 100644
--- a/vibe/cli.py
+++ b/vibe/cli.py
@@ -11139,7 +11139,7 @@ def _show_runtime_doctor_items(*, deep: bool = False) -> list[dict]:
"Prefer the manifest-cache provider for official installations.",
code="show_runtime.unpinned_archive_provider",
)
- elif provider in {"github", "npm"}:
+ elif provider == "npm":
_add_doctor_item(
items,
"warn",
@@ -11153,7 +11153,7 @@ def _show_runtime_doctor_items(*, deep: bool = False) -> list[dict]:
items,
"fail",
f"Show Runtime provider is unsupported: {provider}",
- "Remove the provider override and reinstall the official Avibe package.",
+ i18n_t("runtime.doctor.providerUnsupportedAction", doctor_language),
code="show_runtime.provider_unsupported",
)
@@ -12490,19 +12490,7 @@ def _repair_show_runtime(*, dry_run: bool = False) -> dict:
detail = f"{detail}: {download_error['url']}"
else:
detail = reason
- github_refusal_messages = {
- "runtime_github_source_update_failed": "runtime.doctor.repairGitHubSourceUpdateFailed",
- }
- refusal_message = github_refusal_messages.get(reason)
- message = (
- i18n_t(
- refusal_message,
- language,
- path=install_dir,
- )
- if refusal_message and install_dir
- else i18n_t("runtime.doctor.repairPrepareFailed", language, detail=detail)
- )
+ message = i18n_t("runtime.doctor.repairPrepareFailed", language, detail=detail)
return _doctor_repair_result(
target,
"failed",
@@ -14525,11 +14513,16 @@ def cmd_runtime(args) -> int:
file=sys.stderr,
)
else:
+ reason = payload.get("reason") or install.get("reason") or "unknown"
print(
i18n_t(
- "runtime.prepare.failed",
+ (
+ "runtime.prepare.unsupportedSource"
+ if reason == "runtime_source_unsupported"
+ else "runtime.prepare.failed"
+ ),
language,
- reason=payload.get("reason") or install.get("reason") or "unknown",
+ reason=reason,
),
file=sys.stderr,
)
@@ -15013,7 +15006,7 @@ def build_parser():
def add_runtime_provider_args(runtime_command_parser):
runtime_command_parser.add_argument(
"--source",
- choices=("manifest-cache", "manifest", "archive", "prebuilt", "github", "github-source", "npm"),
+ choices=("manifest-cache", "manifest", "archive", "prebuilt", "npm"),
help="Runtime provider override. Defaults to the packaged manifest cache.",
)
manifest_group = runtime_command_parser.add_mutually_exclusive_group()
diff --git a/vibe/i18n/en.json b/vibe/i18n/en.json
index 5aebf7bc3..75afce26b 100644
--- a/vibe/i18n/en.json
+++ b/vibe/i18n/en.json
@@ -40,7 +40,7 @@
"nodeMessage": "The installed Node.js runtime is missing or is not supported.",
"platformMessage": "This platform is not supported by the current Show Runtime release.",
"verificationMessage": "The Show Runtime files did not pass integrity verification.",
- "configurationMessage": "The configured Show Runtime source cannot be used.",
+ "configurationMessage": "The configured Show Runtime source cannot be used. Remove VIBE_SHOW_RUNTIME_SOURCE to use the packaged runtime, or set VIBE_SHOW_RUNTIME_BIN to a runtime you built.",
"policyMessage": "Automatic Show Runtime installation is disabled by configuration.",
"installMessage": "Avibe could not install the Show Runtime.",
"startMessage": "The Show Runtime is installed but could not start.",
@@ -931,7 +931,8 @@
"prepare": {
"prepared": "Show Runtime prepared.",
"skipped": "Show Runtime preparation skipped: {reason}",
- "failed": "Show Runtime preparation failed: {reason}"
+ "failed": "Show Runtime preparation failed: {reason}",
+ "unsupportedSource": "Show Runtime preparation failed: {reason}. Remove VIBE_SHOW_RUNTIME_SOURCE and use the packaged runtime, or set VIBE_SHOW_RUNTIME_BIN to a runtime you built."
},
"clean": {
"dryRunHelp": "Report stale archives and cache entries without removing anything.",
@@ -955,8 +956,8 @@
"archiveCacheSkipped": "Show Runtime archive cache was not inspected ({reason}); it may still hold reclaimable archives.",
"archiveCacheSkippedAction": "Wait for the running install or clean to finish, then rerun Doctor.",
"archiveCacheSkippedInspectionAction": "Check runtime directory permissions and the Avibe log; retry Doctor once fixed.",
+ "providerUnsupportedAction": "Remove VIBE_SHOW_RUNTIME_SOURCE to use the packaged runtime, or set VIBE_SHOW_RUNTIME_BIN to a runtime you built.",
"repairHealthy": "Show Runtime starts successfully; no repair is needed.",
- "repairGitHubSourceUpdateFailed": "Show Runtime was not rebuilt because Avibe could not complete the managed source update at {path}. The installed runtime was left in place. Check directory permissions and the Avibe log, then rerun Doctor.",
"repairInstalled": "Installed and started Show Runtime.",
"repairReinstalled": "Reinstalled and started Show Runtime.",
"repairInstallStartFailed": "Show Runtime was installed but could not start: {reason}",
diff --git a/vibe/i18n/zh.json b/vibe/i18n/zh.json
index db7b15af5..9ddbf4c57 100644
--- a/vibe/i18n/zh.json
+++ b/vibe/i18n/zh.json
@@ -40,7 +40,7 @@
"nodeMessage": "Node.js 未安装,或当前版本不受支持。",
"platformMessage": "当前 Show Runtime 版本不支持此平台。",
"verificationMessage": "Show Runtime 文件未通过完整性校验。",
- "configurationMessage": "当前配置的 Show Runtime 来源不可用。",
+ "configurationMessage": "当前配置的 Show Runtime 来源不可用。请移除 VIBE_SHOW_RUNTIME_SOURCE 以使用随 Avibe 发布的运行时,或将 VIBE_SHOW_RUNTIME_BIN 指向你自行构建的运行时。",
"policyMessage": "配置已关闭 Show Runtime 自动安装。",
"installMessage": "Avibe 无法安装 Show Runtime。",
"startMessage": "Show Runtime 已安装,但无法启动。",
@@ -931,7 +931,8 @@
"prepare": {
"prepared": "Show Runtime 已准备完成。",
"skipped": "Show Runtime 准备已跳过:{reason}",
- "failed": "Show Runtime 准备失败:{reason}"
+ "failed": "Show Runtime 准备失败:{reason}",
+ "unsupportedSource": "Show Runtime 准备失败:{reason}。请移除 VIBE_SHOW_RUNTIME_SOURCE 以使用随 Avibe 发布的运行时,或将 VIBE_SHOW_RUNTIME_BIN 指向你自行构建的运行时。"
},
"clean": {
"dryRunHelp": "\u4ec5\u62a5\u544a\u53ef\u6e05\u7406\u7684\u5f52\u6863\u4e0e\u7f13\u5b58\u6761\u76ee\uff0c\u4e0d\u5220\u9664\u4efb\u4f55\u5185\u5bb9\u3002",
@@ -955,9 +956,9 @@
"archiveCacheSkipped": "未能检查 Show Runtime 归档缓存({reason});其中可能仍有可回收归档。",
"archiveCacheSkippedAction": "等待正在进行的安装或清理结束后,重新运行 Doctor。",
"archiveCacheSkippedInspectionAction": "\u8bf7\u68c0\u67e5\u8fd0\u884c\u76ee\u5f55\u6743\u9650\u548c Avibe \u65e5\u5fd7\uff0c\u4fee\u590d\u540e\u91cd\u8bd5 Doctor\u3002",
+ "providerUnsupportedAction": "请移除 VIBE_SHOW_RUNTIME_SOURCE 以使用随 Avibe 发布的运行时,或将 VIBE_SHOW_RUNTIME_BIN 指向你自行构建的运行时。",
"repairHealthy": "Show Runtime \u53ef\u4ee5\u6b63\u5e38\u542f\u52a8\uff0c\u65e0\u9700\u4fee\u590d\u3002",
"repairExplicitCommandFailed": "VIBE_SHOW_RUNTIME_BIN \u6307\u5b9a\u7684 Show Runtime \u547d\u4ee4\u65e0\u6cd5\u542f\u52a8\uff1a{reason}\u3002\u8bf7\u4fee\u590d\u6216\u79fb\u9664\u8be5\u8986\u76d6\u540e\u91cd\u65b0\u8fd0\u884c Doctor\u3002",
- "repairGitHubSourceUpdateFailed": "Show Runtime 未重新构建,因为 Avibe 无法在 {path} 完成托管源代码更新。已安装的 runtime 保持不变。请检查目录权限和 Avibe 日志,然后重新运行 Doctor。",
"repairInstalled": "\u5df2\u5b89\u88c5\u5e76\u6210\u529f\u542f\u52a8 Show Runtime\u3002",
"repairReinstalled": "\u5df2\u91cd\u65b0\u5b89\u88c5\u5e76\u6210\u529f\u542f\u52a8 Show Runtime\u3002",
"repairInstallStartFailed": "Show Runtime \u5df2\u5b89\u88c5\uff0c\u4f46\u65e0\u6cd5\u542f\u52a8\uff1a{reason}",