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(dependencies): mirror askill, avault, and tmux downloads (#2295)

Call White6e6078c044c4
diff --git a/.github/workflows/release-mirror.yml b/.github/workflows/release-mirror.yml
index e6fd1f9ab..2e364bdd9 100644
--- a/.github/workflows/release-mirror.yml
+++ b/.github/workflows/release-mirror.yml
@@ -11,7 +11,8 @@ on:
- Guard Git Runtime release
- Build local-only Git runtime
types: [completed]
- # Safety net for missed triggers and renamed workflows.
+ # Safety net for missed triggers and renamed workflows, and the trigger for
+ # the other mirrored repositories' releases (askill, avault, tmux-builds).
schedule:
- cron: "41 * * * *"
workflow_dispatch:
@@ -58,7 +59,6 @@ jobs:
args+=(--dry-run)
fi
python3 scripts/release_mirror.py \
- --repository "$GITHUB_REPOSITORY" \
--bucket avibe \
--endpoint-url "https://${R2_ACCOUNT_ID}.r2.cloudflarestorage.com" \
${args[@]+"${args[@]}"}
diff --git a/core/dependency_network.py b/core/dependency_network.py
index cb1dfd2b4..98a6766b5 100644
--- a/core/dependency_network.py
+++ b/core/dependency_network.py
@@ -30,11 +30,16 @@ class RetryPolicy:
DOWNLOAD_RETRY_POLICY = RetryPolicy(max_attempts=3, initial_delay=1.0, max_delay=4.0)
PROBE_RETRY_POLICY = RetryPolicy(max_attempts=2, initial_delay=0.5, max_delay=0.5)
-# Byte-identical copies of published Avibe release assets
-# (docs/plans/release-download-mirror.md). Trusted for availability only:
-# callers verify what they download, whichever source served it.
-RELEASE_DOWNLOAD_ROOT = "https://github.com/avibe-bot/avibe/releases/download/"
-RELEASE_MIRROR_ROOT = "https://dl.avibe.bot/releases/"
+# Byte-identical copies of published release assets of Avibe and its managed
+# tools (docs/plans/release-download-mirror.md), by GitHub download root.
+# Trusted for availability only: callers verify what they download, whichever
+# source served it.
+RELEASE_MIRRORS = {
+ "https://github.com/avibe-bot/avibe/releases/download/": "https://dl.avibe.bot/releases/",
+ "https://github.com/avibe-bot/askill/releases/download/": "https://dl.avibe.bot/askill/releases/",
+ "https://github.com/avibe-bot/avault/releases/download/": "https://dl.avibe.bot/avault/releases/",
+ "https://github.com/tmux/tmux-builds/releases/download/": "https://dl.avibe.bot/tmux/releases/",
+}
# Index into download_sources() of the source that last completed a download.
_preferred_source = 0
_DOWNLOAD_CHUNK_BYTES = 1024 * 1024
@@ -155,14 +160,16 @@ def fetch_bytes(
def download_sources(url: str) -> list[str]:
- """Download order for a URL: the mirror, then GitHub, for Avibe release assets.
+ """Download order for a URL: the mirror, then GitHub, for mirrored release assets.
The mirror holds ``<tag>/<asset>`` only, so a URL with a query stays on its
own host. The mirror URL substitutes the prefix alone, which keeps
percent-encoding identical.
"""
- if url.startswith(RELEASE_DOWNLOAD_ROOT) and "?" not in url:
- return [RELEASE_MIRROR_ROOT + url.removeprefix(RELEASE_DOWNLOAD_ROOT), url]
+ if "?" not in url:
+ for github_root, mirror_root in RELEASE_MIRRORS.items():
+ if url.startswith(github_root):
+ return [mirror_root + url.removeprefix(github_root), url]
return [url]
diff --git a/core/latest_version_cache.py b/core/latest_version_cache.py
index 7bd5855af..d003fd23b 100644
--- a/core/latest_version_cache.py
+++ b/core/latest_version_cache.py
@@ -1,18 +1,12 @@
"""One owner for "what is the newest published version of X", cached on disk.
The answer used to live only in a module-level dict, which is right for the
-long-running service and useless for the CLI: ``vibe runtime prepare`` is a
-fresh process that asks GitHub for askill's newest release, exits, and throws
-the answer away. Install, upgrade, every regression sync, and every tenant
-update pay that probe again — and they pay it against the unauthenticated
-GitHub budget of 60 requests per hour per IP, shared with the opencode probe
-that reads the same cache.
-
-Exhausting that budget is not a slow path, it is a wrong one: a 403 makes the
-latest lookup fail, prepare cannot establish currency, and it falls back to
-reinstalling askill — about 30 seconds of network to land the version already on
-disk. So persisting the answer across processes matters more for the failures it
-prevents than for the round trip it skips.
+long-running service and useless for the CLI: every fresh process asked the
+registry again, exited, and threw the answer away — and GitHub-hosted probes such
+as opencode's pay against the unauthenticated budget of 60 requests per hour per
+IP. Exhausting that budget is not a slow path, it is a wrong one: a 403 makes the
+latest lookup fail, so persisting the answer across processes matters more for
+the failures it prevents than for the round trip it skips.
The cache is two tiers holding different things. The file tier holds *answers*,
so a cold process inherits what a previous one paid GitHub for. A failed probe
@@ -30,10 +24,10 @@ probe.
Inheriting a failure was never worth that window anyway: it does not avoid the
fallback it looks like it avoids. A process reading a cached ``None`` reports
-``latest_unavailable`` and reinstalls askill; a process that re-probes might find
-the blip over instead. Persisting the failure turns "maybe" into "certainly
-reinstall" to save one HTTP request against a budget that, in the only case this
-arises, is already exhausted.
+the latest version unavailable; a process that re-probes might find the blip
+over instead. Persisting the failure turns "maybe" into "certainly unavailable"
+to save one HTTP request against a budget that, in the only case this arises, is
+already exhausted.
Nothing here is authoritative. Every entry is a best-effort answer with an
expiry, and a caller that reads a stale or absent one gets the same behaviour it
@@ -111,7 +105,7 @@ def _entry_from(raw: Any) -> _Entry | None:
round trip, compare false against every TTL, and would then be written back
out as the non-standard ``Infinity``/``NaN`` tokens. And a null value is not
something this version writes, so it is not something it trusts — corruption
- must not pin ``latest_unavailable`` on every cold process.
+ must not pin an unavailable answer on every cold process.
"""
try:
diff --git a/docs/plans/dependencies-settings.md b/docs/plans/dependencies-settings.md
index e60b0a936..7edfb6e60 100644
--- a/docs/plans/dependencies-settings.md
+++ b/docs/plans/dependencies-settings.md
@@ -40,6 +40,10 @@ Non-goal (Phase 2): unify backends + askill + show runtime into one declarative
## Install mechanism (verified)
+> Superseded: Avibe now downloads a pinned askill binary mirror-first and
+> verifies its sha256; see `release-download-mirror.md`. The original mechanism
+> follows.
+
- Official one-liner: `curl -fsSL https://askill.sh | sh` (same shape as the
OpenCode installer already in `install_agent`).
- No npm fallback: askill ships via the askill.sh installer, not a public npm
diff --git a/docs/plans/release-download-mirror.md b/docs/plans/release-download-mirror.md
index a706eae2a..18a0e4da8 100644
--- a/docs/plans/release-download-mirror.md
+++ b/docs/plans/release-download-mirror.md
@@ -2,11 +2,12 @@
## Background
-Every Avibe download (desktop installers and updates, the managed runtimes, the
-Show Runtime, and wheels used by install scripts) comes from GitHub Release
-assets. Update discovery uses `api.github.com`. In mainland China, GitHub
-downloads are often slow or stall, and the 60 requests/hour unauthenticated API
-limit per IP has already surfaced as update-check 403s.
+Every Avibe download (desktop installers and updates, the managed runtimes
+including tmux, the Show Runtime, the askill and avault binaries, and wheels
+used by install scripts) comes from GitHub Release assets. Update discovery uses
+`api.github.com`. In mainland China, GitHub downloads are often slow or stall,
+and the 60 requests/hour unauthenticated API limit per IP has already surfaced
+as update-check 403s.
`dl.avibe.bot` serves the Cloudflare R2 bucket `avibe` through a custom domain,
with no egress fees. This plan makes it a byte-identical mirror of the
@@ -18,7 +19,7 @@ and fall back to GitHub.
- GitHub Releases remain the source of truth. The mirror serves copies of
published bytes and never authenticates them. Clients keep verifying what
they already verify, whatever the source: updater signatures, pinned
- manifest sha256 values, and `SHA256SUMS`.
+ sha256 values, and `SHA256SUMS`.
- A mirror miss is a fallback, not an error. Retention, lag, and outages
degrade to today's GitHub path.
@@ -26,19 +27,33 @@ and fall back to GitHub.
### URLs
-- `https://dl.avibe.bot/releases/<tag>/<asset>` is byte-identical to
- `https://github.com/avibe-bot/avibe/releases/download/<tag>/<asset>`.
+Each mirrored repository owns one bucket root:
+
+| Repository | Root |
+| --- | --- |
+| `avibe-bot/avibe` | (the bucket root) |
+| `avibe-bot/askill` | `askill/` |
+| `avibe-bot/avault` | `avault/` |
+| `tmux/tmux-builds` | `tmux/` |
+
+`tmux/tmux-builds` is third-party: the ISC-licensed tmux builds the managed
+tmux runtime pins. Its releases are mirrored like Avibe's own, with their
+`LICENSES.tar.gz`.
+
+- `https://dl.avibe.bot/<root>releases/<tag>/<asset>` is byte-identical to
+ `https://github.com/<repository>/releases/download/<tag>/<asset>`.
Clients derive the mirror URL only by substituting that prefix, which keeps
percent-encoding identical (for example `+` as `%2B`). The bucket key is
- `releases/<tag>/<asset>` with the decoded asset name.
+ `<root>releases/<tag>/<asset>` with the decoded asset name.
- Release objects are immutable:
`Cache-Control: public, max-age=31536000, immutable`. Published assets are
upload-once (release workflows replace assets only on drafts), so a tag and
asset name never change bytes.
-- `https://dl.avibe.bot/index/releases.json` is the release index:
- `Cache-Control: public, max-age=60`.
+- `https://dl.avibe.bot/<root>index/releases.json` is the repository's release
+ index: `Cache-Control: public, max-age=60`.
- Other top-level prefixes are reserved and never touched by the release
mirror (for example a future `thirdparty/` for install-script dependencies).
+ A new mirrored repository takes a new root.
### Release index, schema 1
@@ -63,7 +78,8 @@ and fall back to GitHub.
every listed asset already exists in the bucket with those bytes.
- `sha256` is GitHub's asset digest, re-verified against the downloaded bytes
before upload. `commit` is the peeled tag target.
-- Producer: the release mirror workflow. Consumers: the desktop updater.
+- Producer: the release mirror workflow. Consumers: the desktop updater reads
+ Avibe's index; the other repositories' have none yet.
Planned: the CLI update checker, replacing its `api.github.com` discovery
call. Runtime downloads use pinned release URLs and need no index.
- The index is unauthenticated metadata. A hostile index can at most withhold
@@ -77,12 +93,18 @@ and fall back to GitHub.
- The newest 20 prereleases by `published_at` are kept. Older prereleases leave
the mirror and the index; their downloads fall back to GitHub.
- Drafts are never mirrored.
-- At the time of writing that is 89 releases and about 19 GB, most of it the
- desktop bundles in recent prereleases (about 0.7 GB each).
+- tmux-builds keeps no prereleases. Its `preview` prerelease is rebuilt in
+ place, changing bytes under unchanged asset names, which the reconciler must
+ treat as published bytes changing.
+- At the time of writing Avibe is 89 releases and about 19 GB, most of it the
+ desktop bundles in recent prereleases (about 0.7 GB each). askill adds 16
+ releases and about 7 GB, avault 5 releases and 0.04 GB, tmux-builds 5
+ releases and 0.02 GB.
## Reconciler
-`.github/workflows/release-mirror.yml` runs `scripts/release_mirror.py`:
+`.github/workflows/release-mirror.yml` runs `scripts/release_mirror.py`, which
+reconciles each mirrored repository against its own root:
1. List published releases through the GitHub API and tag commits through
`git ls-remote`. Refuse to continue if GitHub reports no published releases.
@@ -90,17 +112,21 @@ and fall back to GitHub.
3. Upload each selected asset that is missing, has the wrong size, or is not
recorded with the same digest in the previous index, after verifying the
downloaded size and sha256 against GitHub's digest.
-4. Write the index if its bytes changed, then delete `releases/` objects that
- left the selection. Objects appear before the index names them and
+4. Write the index if its bytes changed, then delete `<root>releases/` objects
+ that left the selection. Objects appear before the index names them and
disappear only after it stops naming them.
5. If GitHub's digest for an indexed asset changed, re-upload it and fail the
run: published bytes changed, and edge caches may hold the old copy until
that URL is purged.
+Roots are disjoint, so a repository that fails does not stop the others; the
+run fails after all of them were tried.
+
Triggers: completion of the release-publishing workflows (assets are uploaded
with `GITHUB_TOKEN`, which does not emit release events), an hourly schedule
-as the safety net, and manual dispatch with an optional dry run. A dry run
-reports the plan without writing and still fails when published bytes changed.
+as the safety net and the only trigger for the other repositories' releases, and
+manual dispatch with an optional dry run. A dry run reports the plan without
+writing and still fails when published bytes changed.
Credentials are the `R2_ACCOUNT_ID`, `R2_ACCESS_KEY_ID`, and
`R2_SECRET_ACCESS_KEY` repository secrets. They can write and delete every
@@ -122,12 +148,13 @@ Cloudflare configuration lives outside the repository. The expected state:
## Client downloads
-The managed git runtime, the model hub engine, and Show Runtime manifest
-archives download through `core.dependency_network.fetch_to_path`:
+The managed git and tmux runtimes, the model hub engine, Show Runtime manifest
+archives, and the askill and avault binaries download through
+`core.dependency_network.fetch_to_path`:
-- An Avibe release URL without a query tries the mirror, then GitHub. Any other
- URL (tmux builds, legacy Show Runtime archives, manifest overrides) keeps its
- single source.
+- A mirrored repository's release URL without a query tries the mirror, then
+ GitHub. Any other URL (legacy Show Runtime archives, manifest overrides)
+ keeps its single source.
- Sources rotate, each with the download retry budget. A non-retryable failure,
such as a mirror 404, drops that source.
- A failed or stalled attempt (the caller's socket timeout) keeps its bytes, and
@@ -136,7 +163,12 @@ archives download through `core.dependency_network.fetch_to_path`:
`Content-Length` is incomplete, not finished.
- The source that last completed a download goes first for the rest of the
process.
-- The pinned `sha256` check after download is unchanged.
+- The pinned `sha256` check after download is unchanged. askill and avault are
+ pinned in `vibe/api.py` (version, and the sha256 and size of each platform's
+ asset from GitHub's digests), so neither fetches a manifest or asks GitHub
+ for its latest release. A newer askill or avault reaches users with the
+ Avibe release that moves the pin. Updates keep an askill newer than the
+ pin; an explicit repair installs the pin.
`probe_url` reports a release asset reachable when any of its sources answers.
@@ -146,11 +178,11 @@ archives download through `core.dependency_network.fetch_to_path`:
2. Cache Rule, then real-file tests from the three mainland carriers at the
evening peak.
3. Clients, one at a time: desktop updater (done), then runtime and Show
- Runtime downloads (done). Each tries the mirror first, then GitHub, with a
- connect timeout and a stall watchdog, resumes with `Range` when switching
- source, and remembers the last source that worked. The references are the
- desktop shell's `avibe_runtime_host::download` (Rust) and Client downloads
- above (Python).
+ Runtime downloads (done), then askill, avault, and tmux (done). Each tries the
+ mirror first, then GitHub, with a connect timeout and a stall watchdog,
+ resumes with `Range` when switching source, and remembers the last source
+ that worked. The references are the desktop shell's
+ `avibe_runtime_host::download` (Rust) and Client downloads above (Python).
4. Install-script third-party dependencies (the uv installer and
python-build-standalone). The install scripts fetch no Avibe release
assets; their GitHub traffic is uv and the Python it installs. The uv
diff --git a/scripts/release_mirror.py b/scripts/release_mirror.py
index 3922df141..c3d5337fc 100644
--- a/scripts/release_mirror.py
+++ b/scripts/release_mirror.py
@@ -1,8 +1,9 @@
#!/usr/bin/env python3
"""Mirror published GitHub Release assets into the dl.avibe.bot R2 bucket.
-GitHub stays the source of truth. The mirror holds byte-identical copies under
-``releases/<tag>/<asset>`` and a release index at ``index/releases.json``; see
+GitHub stays the source of truth. For each mirrored repository the bucket holds
+byte-identical copies under ``<root>releases/<tag>/<asset>`` and a release
+index at ``<root>index/releases.json``; see
``docs/plans/release-download-mirror.md`` for the contract.
"""
@@ -24,6 +25,18 @@ from typing import Any, Mapping, Sequence
from urllib.parse import quote
+# Bucket root of each mirrored repository. Avibe's own releases keep the bucket
+# root, where their mirror URLs were first published.
+REPOSITORIES = {
+ "avibe-bot/avibe": "",
+ "avibe-bot/askill": "askill/",
+ "avibe-bot/avault": "avault/",
+ "tmux/tmux-builds": "tmux/",
+}
+# Repositories mirrored without prereleases. tmux-builds rebuilds its
+# ``preview`` prerelease in place, changing bytes under unchanged asset names,
+# which the mirror must treat as published bytes changing.
+FULL_RELEASES_ONLY = frozenset({"tmux/tmux-builds"})
RELEASE_PREFIX = "releases/"
INDEX_KEY = "index/releases.json"
IMMUTABLE_CACHE_CONTROL = "public, max-age=31536000, immutable"
@@ -40,6 +53,14 @@ class MirrorError(RuntimeError):
"""Raised when the mirror cannot be proven to match GitHub."""
+def release_prefix(repository: str) -> str:
+ return f"{REPOSITORIES[repository]}{RELEASE_PREFIX}"
+
+
+def index_key(repository: str) -> str:
+ return f"{REPOSITORIES[repository]}{INDEX_KEY}"
+
+
@dataclass(frozen=True)
class Asset:
name: str
@@ -51,6 +72,7 @@ class Asset:
@dataclass(frozen=True)
class Release:
+ repository: str
tag: str
prerelease: bool
published_at: str
@@ -58,7 +80,7 @@ class Release:
assets: tuple[Asset, ...]
def key(self, asset: Asset) -> str:
- return f"{RELEASE_PREFIX}{self.tag}/{asset.name}"
+ return f"{release_prefix(self.repository)}{self.tag}/{asset.name}"
@dataclass(frozen=True)
@@ -108,6 +130,7 @@ def parse_releases(
)
releases.append(
Release(
+ repository=repository,
tag=tag,
prerelease=bool(item["prerelease"]),
published_at=item["published_at"],
@@ -146,13 +169,13 @@ def render_index(repository: str, releases: Sequence[Release]) -> bytes:
return (json.dumps(document, separators=(",", ":")) + "\n").encode()
-def _indexed_digests(index: bytes | None) -> dict[str, str]:
+def _indexed_digests(repository: str, index: bytes | None) -> dict[str, str]:
if index is None:
return {}
try:
document = json.loads(index)
return {
- f"{RELEASE_PREFIX}{release['tag']}/{asset['name']}": asset["sha256"]
+ f"{release_prefix(repository)}{release['tag']}/{asset['name']}": asset["sha256"]
for release in document["releases"]
for asset in release["assets"]
}
@@ -168,10 +191,11 @@ def plan(
objects: Mapping[str, int],
previous_index: bytes | None,
) -> Plan:
- """Compare the selected releases with the bucket's ``releases/`` objects."""
+ """Compare the selected releases with the repository's ``releases/`` objects."""
if not releases:
- raise MirrorError("GitHub returned no published releases; refusing to reconcile")
- indexed = _indexed_digests(previous_index)
+ raise MirrorError(f"GitHub returned no published releases for {repository}; refusing to reconcile")
+ prefix = release_prefix(repository)
+ indexed = _indexed_digests(repository, previous_index)
uploads, changed, expected = [], [], set()
for release in releases:
for asset in release.assets:
@@ -184,7 +208,7 @@ def plan(
elif prior is None or objects.get(key) != asset.size:
# Only an object this job verified and indexed is trusted.
uploads.append((key, asset))
- deletions = sorted(key for key in objects if key.startswith(RELEASE_PREFIX) and key not in expected)
+ deletions = sorted(key for key in objects if key.startswith(prefix) and key not in expected)
return Plan(
uploads=tuple(uploads),
deletions=tuple(deletions),
@@ -279,41 +303,43 @@ class Bucket:
def reconcile(repository: str, bucket: Bucket, *, keep_prereleases: int, dry_run: bool) -> int:
releases = select(parse_releases(repository, github_releases(repository), tag_commits(repository)), keep_prereleases)
objects = bucket.objects()
- previous_index = bucket.read(INDEX_KEY) if INDEX_KEY in objects else None
+ key = index_key(repository)
+ previous_index = bucket.read(key) if key in objects else None
result = plan(repository, releases, objects, previous_index)
size = sum(asset.size for _, asset in result.uploads)
print(
- f"{len(releases)} releases mirrored; {len(result.uploads)} uploads ({size / 1e9:.2f} GB), "
+ f"{repository}: {len(releases)} releases mirrored; "
+ f"{len(result.uploads)} uploads ({size / 1e9:.2f} GB), "
f"{len(result.deletions)} deletions, index {'unchanged' if result.index == previous_index else 'changed'}"
)
- for key in result.changed:
- print(f"error: published bytes changed upstream: {key}", file=sys.stderr)
+ for changed in result.changed:
+ print(f"error: published bytes changed upstream: {changed}", file=sys.stderr)
if dry_run:
- for key, _ in result.uploads:
- print(f"would upload {key}")
- for key in result.deletions:
- print(f"would delete {key}")
+ for upload, _ in result.uploads:
+ print(f"would upload {upload}")
+ for deletion in result.deletions:
+ print(f"would delete {deletion}")
else:
with tempfile.TemporaryDirectory(prefix="avibe-release-mirror-") as temporary:
path = Path(temporary) / "asset"
- for key, asset in result.uploads:
+ for upload, asset in result.uploads:
download(asset, path)
bucket.put(
- key, path, content_type=asset.content_type,
+ upload, path, content_type=asset.content_type,
cache_control=IMMUTABLE_CACHE_CONTROL, sha256=asset.sha256,
)
- print(f"uploaded {key}")
+ print(f"uploaded {upload}")
if result.index != previous_index:
path.write_bytes(result.index)
bucket.put(
- INDEX_KEY, path, content_type="application/json",
+ key, path, content_type="application/json",
cache_control=INDEX_CACHE_CONTROL, sha256=hashlib.sha256(result.index).hexdigest(),
)
- print(f"wrote {INDEX_KEY}")
+ print(f"wrote {key}")
# Delete only after the index stops listing these objects.
- for key in result.deletions:
- bucket.delete(key)
- print(f"deleted {key}")
+ for deletion in result.deletions:
+ bucket.delete(deletion)
+ print(f"deleted {deletion}")
if result.changed:
print("error: purge the changed URLs from the dl.avibe.bot cache", file=sys.stderr)
return 1
@@ -322,22 +348,26 @@ def reconcile(repository: str, bucket: Bucket, *, keep_prereleases: int, dry_run
def main(argv: list[str] | None = None) -> int:
parser = argparse.ArgumentParser(description=__doc__)
- parser.add_argument("--repository", required=True)
+ parser.add_argument(
+ "--repository", action="append", choices=sorted(REPOSITORIES),
+ help="repository to reconcile (repeatable; default: every mirrored repository)",
+ )
parser.add_argument("--bucket", required=True)
parser.add_argument("--endpoint-url", required=True)
parser.add_argument("--keep-prereleases", type=int, default=DEFAULT_KEEP_PRERELEASES)
parser.add_argument("--dry-run", action="store_true")
arguments = parser.parse_args(argv)
- try:
- return reconcile(
- arguments.repository,
- Bucket(arguments.bucket, arguments.endpoint_url),
- keep_prereleases=arguments.keep_prereleases,
- dry_run=arguments.dry_run,
- )
- except MirrorError as exc:
- print(f"error: {exc}", file=sys.stderr)
- return 1
+ bucket = Bucket(arguments.bucket, arguments.endpoint_url)
+ status = 0
+ # Repositories own disjoint roots, so one failing never blocks the others.
+ for repository in arguments.repository or REPOSITORIES:
+ try:
+ keep_prereleases = 0 if repository in FULL_RELEASES_ONLY else arguments.keep_prereleases
+ status |= reconcile(repository, bucket, keep_prereleases=keep_prereleases, dry_run=arguments.dry_run)
+ except MirrorError as exc:
+ print(f"error: {repository}: {exc}", file=sys.stderr)
+ status = 1
+ return status
if __name__ == "__main__":
diff --git a/tests/test_dependency_network.py b/tests/test_dependency_network.py
index 53fbaafb0..2d9cd1abc 100644
--- a/tests/test_dependency_network.py
+++ b/tests/test_dependency_network.py
@@ -10,6 +10,7 @@ import urllib.request
import pytest
from core import dependency_network
+from scripts import release_mirror
RELEASE_URL = "https://github.com/avibe-bot/avibe/releases/download/git-runtime-v2.55.0-1/git-runtime.tar.gz"
@@ -251,25 +252,25 @@ def test_dependency_error_message_reports_exhausted_attempts() -> None:
assert message == "Runtime download failed after 3 attempts: Connection timed out (https://example.test/archive.tgz)"
[email protected](("repository", "root"), sorted(release_mirror.REPOSITORIES.items()))
+def test_release_assets_of_every_mirrored_repository_try_the_mirror_first(repository, root) -> None:
+ url = f"https://github.com/{repository}/releases/download/v1.0.0/tool_1.0.0%2Bbuild.tar.gz"
+
+ assert dependency_network.download_sources(url) == [
+ f"https://dl.avibe.bot/{root}releases/v1.0.0/tool_1.0.0%2Bbuild.tar.gz",
+ url,
+ ]
+
+
@pytest.mark.parametrize(
- ("url", "sources"),
+ "url",
[
- (
- "https://github.com/avibe-bot/avibe/releases/download/v1.0.0/avibe_1.0.0%2Bbuild.tar.gz",
- [
- "https://dl.avibe.bot/releases/v1.0.0/avibe_1.0.0%2Bbuild.tar.gz",
- "https://github.com/avibe-bot/avibe/releases/download/v1.0.0/avibe_1.0.0%2Bbuild.tar.gz",
- ],
- ),
- (f"{RELEASE_URL}?token=secret", [f"{RELEASE_URL}?token=secret"]),
- (
- "https://github.com/tmux/tmux-builds/releases/download/v3.5/tmux.tar.gz",
- ["https://github.com/tmux/tmux-builds/releases/download/v3.5/tmux.tar.gz"],
- ),
+ f"{RELEASE_URL}?token=secret",
+ "https://github.com/avibe-bot/avibe-docs/releases/download/v1/a.tgz",
],
)
-def test_only_avibe_release_assets_have_a_mirror_source(url, sources) -> None:
- assert dependency_network.download_sources(url) == sources
+def test_other_urls_keep_their_single_source(url) -> None:
+ assert dependency_network.download_sources(url) == [url]
def test_mirror_miss_falls_back_to_github_and_later_downloads_start_there(monkeypatch, tmp_path) -> None:
diff --git a/tests/test_doctor_i18n.py b/tests/test_doctor_i18n.py
index 9f8c4a919..8a7a58b1d 100644
--- a/tests/test_doctor_i18n.py
+++ b/tests/test_doctor_i18n.py
@@ -504,11 +504,11 @@ def test_doctor_localizes_nested_repair_details_and_missing_payload_values(
"askill",
{
"ok": False,
- "reason": "askill_auto_install_unsupported",
- "required_tools": ["curl", "bash"],
- "message": "askill auto-install needs curl + bash",
+ "reason": "askill_platform_unsupported",
+ "platform": "Windows ARM64",
+ "message": "no askill build for Windows ARM64",
},
- "自动安装需要",
+ "没有为当前平台发布",
),
(
"avault",
diff --git a/tests/test_latest_version_cache.py b/tests/test_latest_version_cache.py
index 262ad62ba..10a436d75 100644
--- a/tests/test_latest_version_cache.py
+++ b/tests/test_latest_version_cache.py
@@ -63,9 +63,9 @@ def _not_json(token: str) -> float:
def test_a_second_process_inherits_the_answer_without_probing() -> None:
probe = _Probe("0.1.15")
- assert cached_latest("askill", probe) == "0.1.15"
+ assert cached_latest("claude", probe) == "0.1.15"
_cold_process()
- assert cached_latest("askill", probe) == "0.1.15"
+ assert cached_latest("claude", probe) == "0.1.15"
assert probe.calls == 1
@@ -74,24 +74,24 @@ def test_a_failed_probe_stops_at_the_memory_tier() -> None:
"""The file holds answers; a failure is not one, so it does not travel.
Inheriting one never bought what it looked like it bought: a process that
- reads a cached ``None`` reports ``latest_unavailable`` and reinstalls askill
- outright, where re-probing might find the blip already over. It saves one
+ reads a cached ``None`` reports the latest version unavailable, where
+ re-probing might find the blip already over. It saves one
HTTP request against a budget that — in the only case this arises — is
already exhausted, and pays for it with the race in the next test.
"""
probe = _Probe(None, "0.1.15")
- assert cached_latest("askill", probe) is None
+ assert cached_latest("claude", probe) is None
assert not cache_path().exists()
# Same process asks again: the memory tier still backs off, which is the
# tier that needs to — a service polling a dead registry, not a fresh CLI.
- assert cached_latest("askill", probe) is None
+ assert cached_latest("claude", probe) is None
assert probe.calls == 1
_cold_process()
- assert cached_latest("askill", probe) == "0.1.15"
+ assert cached_latest("claude", probe) == "0.1.15"
assert probe.calls == 2
@@ -105,12 +105,12 @@ def test_a_failed_probe_never_writes_the_file() -> None:
"""
stale = time.time() - latest_version_cache.SUCCESS_TTL_SECONDS - 1
- _write_entries({"askill": {"at": stale, "value": "0.1.15"}})
+ _write_entries({"claude": {"at": stale, "value": "0.1.15"}})
before = cache_path().read_bytes()
_cold_process()
# Expired, so this process really does probe — and really does fail.
- assert cached_latest("askill", _Probe(None)) is None
+ assert cached_latest("claude", _Probe(None)) is None
assert cache_path().read_bytes() == before
@@ -119,27 +119,27 @@ def test_the_memory_tier_retries_a_failure_far_sooner_than_a_success() -> None:
probe = _Probe("0.1.15")
- _remember("askill", age=latest_version_cache.FAILURE_TTL_SECONDS + 1, value=None)
- assert cached_latest("askill", probe) == "0.1.15"
+ _remember("claude", age=latest_version_cache.FAILURE_TTL_SECONDS + 1, value=None)
+ assert cached_latest("claude", probe) == "0.1.15"
- _remember("askill", age=latest_version_cache.FAILURE_TTL_SECONDS - 1, value=None)
- assert cached_latest("askill", _never_probed) is None
+ _remember("claude", age=latest_version_cache.FAILURE_TTL_SECONDS - 1, value=None)
+ assert cached_latest("claude", _never_probed) is None
- _remember("askill", age=latest_version_cache.SUCCESS_TTL_SECONDS - 60, value="0.1.14")
- assert cached_latest("askill", _never_probed) == "0.1.14"
+ _remember("claude", age=latest_version_cache.SUCCESS_TTL_SECONDS - 60, value="0.1.14")
+ assert cached_latest("claude", _never_probed) == "0.1.14"
assert probe.calls == 1
def test_an_expired_entry_is_re_probed() -> None:
probe = _Probe("0.1.15", "0.1.16")
- cached_latest("askill", probe)
+ cached_latest("claude", probe)
_write_entries(
- {"askill": {"at": time.time() - latest_version_cache.SUCCESS_TTL_SECONDS - 1, "value": "0.1.15"}}
+ {"claude": {"at": time.time() - latest_version_cache.SUCCESS_TTL_SECONDS - 1, "value": "0.1.15"}}
)
_cold_process()
- assert cached_latest("askill", probe) == "0.1.16"
+ assert cached_latest("claude", probe) == "0.1.16"
assert probe.calls == 2
@@ -147,55 +147,54 @@ def test_a_timestamp_from_the_future_is_never_live() -> None:
"""A clock that stepped backwards must not pin an entry until it catches up."""
probe = _Probe("0.1.16")
- _write_entries({"askill": {"at": time.time() + 86_400, "value": "0.1.15"}})
+ _write_entries({"claude": {"at": time.time() + 86_400, "value": "0.1.15"}})
- assert cached_latest("askill", probe) == "0.1.16"
+ assert cached_latest("claude", probe) == "0.1.16"
assert probe.calls == 1
def test_a_null_answer_on_disk_is_ignored_rather_than_inherited() -> None:
"""The rule holds in both directions: never written, so never trusted.
- Otherwise a corrupted byte or a foreign writer could pin
- ``latest_unavailable`` — and therefore an askill reinstall — on every cold
- process for the whole failure TTL.
+ Otherwise a corrupted byte or a foreign writer could pin an unavailable
+ answer on every cold process for the whole failure TTL.
"""
- _write_entries({"askill": {"at": time.time(), "value": None}})
+ _write_entries({"claude": {"at": time.time(), "value": None}})
- assert cached_latest("askill", _Probe("0.1.15")) == "0.1.15"
- assert _persisted()["entries"]["askill"]["value"] == "0.1.15"
+ assert cached_latest("claude", _Probe("0.1.15")) == "0.1.15"
+ assert _persisted()["entries"]["claude"]["value"] == "0.1.15"
def test_entries_for_other_dependencies_survive_a_write() -> None:
- """askill runs from the CLI and opencode from the service; neither may evict."""
+ """Every dependency shares the file; no entry may evict another."""
- cached_latest("askill", _Probe("0.1.15"))
+ cached_latest("claude", _Probe("0.1.15"))
cached_latest("opencode", _Probe("1.2.3"))
_cold_process()
- assert cached_latest("askill", _never_probed) == "0.1.15"
- assert set(_persisted()["entries"]) == {"askill", "opencode"}
+ assert cached_latest("claude", _never_probed) == "0.1.15"
+ assert set(_persisted()["entries"]) == {"claude", "opencode"}
# opencode expires and is re-probed; the rewrite that publishes its new
- # answer must carry askill's untouched entry along with it.
+ # answer must carry claude's untouched entry along with it.
_write_entries(
{
- "askill": _persisted()["entries"]["askill"],
+ "claude": _persisted()["entries"]["claude"],
"opencode": {"at": time.time() - latest_version_cache.SUCCESS_TTL_SECONDS - 1, "value": "1.2.3"},
}
)
_cold_process()
assert cached_latest("opencode", _Probe("1.2.4")) == "1.2.4"
_cold_process()
- assert cached_latest("askill", _never_probed) == "0.1.15"
+ assert cached_latest("claude", _never_probed) == "0.1.15"
@pytest.mark.parametrize(
"content",
[
"not json at all",
- json.dumps({"schema_version": 999, "entries": {"askill": {"at": 0, "value": "0.1.15"}}}),
+ json.dumps({"schema_version": 999, "entries": {"claude": {"at": 0, "value": "0.1.15"}}}),
json.dumps({"schema_version": 1, "entries": "not-a-mapping"}),
json.dumps(["not", "a", "mapping"]),
json.dumps({"schema_version": 1}),
@@ -206,9 +205,9 @@ def test_an_unusable_cache_file_costs_a_probe_and_nothing_else(content) -> None:
cache_path().write_text(content, encoding="utf-8")
probe = _Probe("0.1.15")
- assert cached_latest("askill", probe) == "0.1.15"
+ assert cached_latest("claude", probe) == "0.1.15"
assert probe.calls == 1
- assert _persisted()["entries"]["askill"]["value"] == "0.1.15"
+ assert _persisted()["entries"]["claude"]["value"] == "0.1.15"
def test_bytes_that_are_not_a_document_cost_a_probe_and_nothing_else() -> None:
@@ -223,9 +222,9 @@ def test_bytes_that_are_not_a_document_cost_a_probe_and_nothing_else() -> None:
cache_path().write_bytes(b'{"schema_version": 1, "entries": {"\xff\xfe": 0}}')
probe = _Probe("0.1.15")
- assert cached_latest("askill", probe) == "0.1.15"
+ assert cached_latest("claude", probe) == "0.1.15"
assert probe.calls == 1
- assert _persisted()["entries"]["askill"]["value"] == "0.1.15"
+ assert _persisted()["entries"]["claude"]["value"] == "0.1.15"
@pytest.mark.parametrize(
@@ -243,10 +242,10 @@ def test_bytes_that_are_not_a_document_cost_a_probe_and_nothing_else() -> None:
)
def test_an_unusable_entry_is_skipped_without_discarding_its_neighbours(entry) -> None:
fresh = time.time()
- _write_entries({"askill": entry, "opencode": {"at": fresh, "value": "1.2.3"}})
+ _write_entries({"claude": entry, "opencode": {"at": fresh, "value": "1.2.3"}})
assert cached_latest("opencode", _never_probed) == "1.2.3"
- assert cached_latest("askill", _Probe("0.1.15")) == "0.1.15"
+ assert cached_latest("claude", _Probe("0.1.15")) == "0.1.15"
@pytest.mark.parametrize("at", [float("inf"), float("nan")])
@@ -262,16 +261,16 @@ def test_a_timestamp_that_is_not_a_number_never_reaches_the_file_again(at) -> No
"""
expired = time.time() - latest_version_cache.SUCCESS_TTL_SECONDS - 1
- _write_entries({"askill": {"at": at, "value": "0.1.15"}, "opencode": {"at": expired, "value": "1.2.3"}})
+ _write_entries({"claude": {"at": at, "value": "0.1.15"}, "opencode": {"at": expired, "value": "1.2.3"}})
_cold_process()
# opencode re-probes, and publishing its answer rewrites the whole file --
- # carrying whatever askill's entry was parsed into along with it.
+ # carrying whatever claude's entry was parsed into along with it.
assert cached_latest("opencode", _Probe("1.2.4")) == "1.2.4"
written = json.loads(cache_path().read_text(encoding="utf-8"), parse_constant=_not_json)
assert written["entries"]["opencode"]["value"] == "1.2.4"
- assert "askill" not in written["entries"]
+ assert "claude" not in written["entries"]
def test_an_unforeseen_entry_failure_still_costs_only_a_probe(monkeypatch) -> None:
@@ -289,10 +288,10 @@ def test_an_unforeseen_entry_failure_still_costs_only_a_probe(monkeypatch) -> No
raise _NovelFailure("no enumeration was ever going to list this one")
monkeypatch.setattr(latest_version_cache, "math", SimpleNamespace(isfinite=boom))
- _write_entries({"askill": {"at": time.time(), "value": "0.1.15"}})
+ _write_entries({"claude": {"at": time.time(), "value": "0.1.15"}})
probe = _Probe("0.1.16")
- assert cached_latest("askill", probe) == "0.1.16"
+ assert cached_latest("claude", probe) == "0.1.16"
assert probe.calls == 1
@@ -316,10 +315,10 @@ def test_an_answer_is_timestamped_when_the_question_was_asked() -> None:
return "0.1.15"
asked_at = time.time()
- cached_latest("askill", slow_probe)
+ cached_latest("claude", slow_probe)
answered_at = time.time()
- at = _persisted()["entries"]["askill"]["at"]
+ at = _persisted()["entries"]["claude"]["at"]
assert at - asked_at < 0.1
assert answered_at - at >= 0.2
@@ -333,7 +332,7 @@ def test_a_lookup_still_answers_when_the_state_directory_cannot_be_written(
lambda *_args, **_kwargs: (_ for _ in ()).throw(OSError("read-only filesystem")),
)
- assert cached_latest("askill", _Probe("0.1.15")) == "0.1.15"
+ assert cached_latest("claude", _Probe("0.1.15")) == "0.1.15"
def _write_entries(entries: dict) -> None:
diff --git a/tests/test_local_deps.py b/tests/test_local_deps.py
index c023067af..87241aa98 100644
--- a/tests/test_local_deps.py
+++ b/tests/test_local_deps.py
@@ -1,9 +1,8 @@
-"""Hermetic tests for the askill local-dependency helpers in vibe/api.py.
+"""Hermetic tests for the local-dependency helpers in vibe/api.py.
-The subprocess / path-resolution boundary is monkeypatched, so these run
-without askill, npm, or the network — they pin the install command
-construction, the idempotency of ``ensure_askill_installed``, and the status
-shape.
+The download / subprocess / path-resolution boundary is monkeypatched, so these
+run without askill, avault, or the network — they pin the verified pinned-release
+downloads, the idempotency of the ``ensure_*`` helpers, and the status shape.
"""
from __future__ import annotations
@@ -12,6 +11,7 @@ import hashlib
import io
import json
import os
+import re
import subprocess
import sys
import tarfile
@@ -48,13 +48,16 @@ def _stub_dependency_status_neighbors(monkeypatch) -> None:
lambda: {"installed": False, "version": None, "status": "missing"},
)
-from core import latest_version_cache
+from core import dependency_network
from vibe import api
class _FakeHTTPResponse:
+ status = 200
+
def __init__(self, body: bytes):
- self._body = body
+ self._body = io.BytesIO(body)
+ self.headers = {"Content-Length": str(len(body))}
def __enter__(self):
return self
@@ -62,8 +65,32 @@ class _FakeHTTPResponse:
def __exit__(self, *args):
return None
- def read(self) -> bytes:
- return self._body
+ def read(self, size: int = -1) -> bytes:
+ return self._body.read(size)
+
+
+def _serve_release_asset(monkeypatch, suffix: str, body: bytes) -> list[str]:
+ """Serve ``body`` for any URL ending in ``suffix``; return the requested URLs."""
+ calls: list[str] = []
+
+ def fake_urlopen(request, timeout=30):
+ url = request.full_url
+ calls.append(url)
+ if url.endswith(suffix):
+ return _FakeHTTPResponse(body)
+ raise AssertionError(f"unexpected url: {url}")
+
+ monkeypatch.setattr(api.urllib.request, "urlopen", fake_urlopen)
+ # Another test's download may have left GitHub as the preferred source.
+ monkeypatch.setattr(dependency_network, "_preferred_source", 0)
+ return calls
+
+
+def _installable_askill_release(monkeypatch, *, platform_name: str = "darwin-arm64", sha256: str | None = None):
+ binary = f"#!/bin/sh\necho askill {api.ASKILL_VERSION}\n".encode()
+ monkeypatch.setattr(api, "_ASKILL_BINARIES", {platform_name: (sha256 or hashlib.sha256(binary).hexdigest(), len(binary))})
+ suffix = ".exe" if platform_name.startswith("win32-") else ""
+ return _serve_release_asset(monkeypatch, f"/askill-{platform_name}{suffix}", binary), binary
def _fake_avault_archive(
@@ -93,30 +120,8 @@ def _installable_avault_release(
content = f"#!/bin/sh\necho avault {api.AVAULT_VERSION}\n".encode()
member_name = api._avault_binary_name_for_target(target)
archive = _fake_avault_archive(content=content, member_name=member_name)
- digest = sha256 or hashlib.sha256(archive).hexdigest()
- manifest = {
- "schema_version": 1,
- "versions": {
- api.AVAULT_VERSION: {
- target: {
- "asset": f"avault-{api.AVAULT_VERSION}-{target}.tar.gz",
- "sha256": digest,
- }
- }
- },
- }
- calls: list[str] = []
-
- def fake_urlopen(request, timeout=30):
- url = request.full_url
- calls.append(url)
- if url.endswith("/manifest.json"):
- return _FakeHTTPResponse(json.dumps(manifest).encode("utf-8"))
- if url.endswith(f"/avault-{api.AVAULT_VERSION}-{target}.tar.gz"):
- return _FakeHTTPResponse(archive)
- raise AssertionError(f"unexpected url: {url}")
-
- monkeypatch.setattr(api.urllib.request, "urlopen", fake_urlopen)
+ monkeypatch.setattr(api, "_AVAULT_ARCHIVES", {target: (sha256 or hashlib.sha256(archive).hexdigest(), len(archive))})
+ calls = _serve_release_asset(monkeypatch, f"/avault-{api.AVAULT_VERSION}-{target}.tar.gz", archive)
def fake_candidate_cli_paths(binary: str, *, include_npm_global: bool = True):
expanded = api.Path(api.os.path.expanduser(binary))
has_path_separator = api.os.sep in binary or (api.os.altsep is not None and api.os.altsep in binary)
@@ -131,22 +136,103 @@ def _installable_avault_release(
return calls, member_name
-def test_install_askill_uses_official_curl_installer(monkeypatch):
- captured: dict = {}
- monkeypatch.setattr(api, "resolve_cli_path", lambda b: f"/usr/bin/{b}" if b in {"curl", "bash"} else None)
+ ("system", "machine", "platform_name", "binary_name"),
+ [
+ ("Darwin", "arm64", "darwin-arm64", "askill"),
+ ("Darwin", "x86_64", "darwin-x64", "askill"),
+ ("Linux", "x86_64", "linux-x64", "askill"),
+ ("Linux", "aarch64", "linux-arm64", "askill"),
+ ("Windows", "AMD64", "win32-x64", "askill.exe"),
+ ],
+)
+def test_install_askill_downloads_the_pinned_binary_mirror_first(monkeypatch, system, machine, platform_name, binary_name):
+ monkeypatch.setattr("platform.system", lambda: system)
+ monkeypatch.setattr("platform.machine", lambda: machine)
+ calls, binary = _installable_askill_release(monkeypatch, platform_name=platform_name)
+
+ out = api.install_askill()
+
+ installed = api.Path.home() / ".local" / "bin" / binary_name
+ assert out["ok"] is True
+ assert installed.read_bytes() == binary
+ if system != "Windows":
+ assert installed.stat().st_mode & 0o777 == 0o755
+ # askill's own installer location, which discovery checks first.
+ assert api.resolve_cli_path("askill") == str(installed)
+ suffix = ".exe" if system == "Windows" else ""
+ assert calls == [f"https://dl.avibe.bot/askill/releases/v{api.ASKILL_VERSION}/askill-{platform_name}{suffix}"]
+
- def fake_run(name, cmd, _trunc, *, mode="install", env=None):
- captured.update(name=name, cmd=cmd, mode=mode)
- return {"ok": True, "path": "/usr/local/bin/askill", "output": ""}
+def test_install_askill_checksum_mismatch_installs_nothing(monkeypatch):
+ monkeypatch.setattr("platform.system", lambda: "Darwin")
+ monkeypatch.setattr("platform.machine", lambda: "arm64")
+ _installable_askill_release(monkeypatch, sha256="0" * 64)
- monkeypatch.setattr(api, "_run_install_command", fake_run)
out = api.install_askill()
- assert out["ok"]
- assert captured["name"] == "askill"
- assert captured["cmd"][:2] == ["bash", "-c"]
- assert "https://askill.sh | sh" in captured["cmd"][2]
- assert "--retry 2" in captured["cmd"][2]
- assert "--retry-all-errors" not in captured["cmd"][2]
+
+ assert out["ok"] is False
+ assert out["reason"] == "askill_binary_checksum_mismatch"
+ assert out["expected_sha256"] == "0" * 64
+ assert len(out["actual_sha256"]) == 64
+ assert not (api.Path.home() / ".local" / "bin" / "askill").exists()
+
+
+def test_install_askill_download_failure_keeps_the_network_evidence(monkeypatch):
+ monkeypatch.setattr("platform.system", lambda: "Linux")
+ monkeypatch.setattr("platform.machine", lambda: "x86_64")
+
+ def not_found(request, timeout=30):
+ raise urllib.error.HTTPError(request.full_url, 404, "Not Found", {}, None)
+
+ monkeypatch.setattr(api.urllib.request, "urlopen", not_found)
+
+ out = api.install_askill()
+
+ assert out["ok"] is False
+ assert out["reason"] == "askill_download_failed"
+ assert out["download_error"]["http_status"] == 404
+ assert not (api.Path.home() / ".local" / "bin" / "askill").exists()
+
+
+def test_install_askill_without_a_pinned_build_downloads_nothing(monkeypatch):
+ # askill publishes no Windows arm64 build.
+ monkeypatch.setattr("platform.system", lambda: "Windows")
+ monkeypatch.setattr("platform.machine", lambda: "ARM64")
+ monkeypatch.setattr(api.urllib.request, "urlopen", lambda *a, **k: pytest.fail("should not download"))
+
+ out = api.install_askill()
+
+ assert out["ok"] is False
+ assert out["reason"] == "askill_platform_unsupported"
+ assert out["platform"] == "Windows-ARM64"
+ assert api.askill_auto_install_supported() is False
+ assert api.askill_download_url() is None
+
+
+ ("system", "machine"),
+ [
+ ("Darwin", "arm64"),
+ ("Darwin", "x86_64"),
+ ("Linux", "x86_64"),
+ ("Linux", "aarch64"),
+ ("Windows", "AMD64"),
+ ("Windows", "ARM64"),
+ ],
+)
+def test_every_supported_platform_has_well_formed_download_pins(monkeypatch, system, machine):
+ # A version bump that drops or misnames a target would otherwise surface
+ # only as a failed install on that platform: the install tests pin their own.
+ monkeypatch.setattr("platform.system", lambda: system)
+ monkeypatch.setattr("platform.machine", lambda: machine)
+ pins = [api._AVAULT_ARCHIVES[api._avault_target()[0]]]
+ if (system, machine) != ("Windows", "ARM64"):
+ pins.append(api._ASKILL_BINARIES[api._askill_platform()])
+
+ for sha256, size in pins:
+ assert re.fullmatch(r"[0-9a-f]{64}", sha256)
+ assert size > 0
def test_curl_installer_command_uses_pipe_safe_retry_flags(tmp_path):
@@ -179,26 +265,7 @@ def test_curl_installer_command_uses_pipe_safe_retry_flags(tmp_path):
assert "--retry-all-errors" not in calls[0]
-def test_avault_download_retries_transient_network_failure(monkeypatch):
- attempts = 0
-
- def opener(_request, timeout):
- nonlocal attempts
- attempts += 1
- if attempts == 1:
- raise urllib.error.URLError(ConnectionResetError("reset"))
- return _FakeHTTPResponse(b"manifest")
-
- monkeypatch.setattr(api.urllib.request, "urlopen", opener)
- monkeypatch.setattr("core.dependency_network.time.sleep", lambda _delay: None)
-
- result = api._download_avault_release_file("https://example.test/manifest.json")
-
- assert result == b"manifest"
- assert attempts == 2
-
-
-def test_askill_install_command_does_not_persist_agent_cli_path(monkeypatch):
+def test_install_runner_does_not_persist_a_non_agent_cli_path(monkeypatch):
config_loads = []
class FakePopen:
@@ -211,13 +278,13 @@ def test_askill_install_command_does_not_persist_agent_cli_path(monkeypatch):
return "installed", ""
monkeypatch.setattr(api.subprocess, "Popen", FakePopen)
- monkeypatch.setattr(api, "resolve_cli_path", lambda b: "/usr/local/bin/askill" if b == "askill" else None)
- monkeypatch.setattr(api, "load_config", lambda: config_loads.append(True) or pytest.fail("askill should not load V2Config"))
+ monkeypatch.setattr(api, "resolve_cli_path", lambda b: "/usr/local/bin/tool" if b == "tool" else None)
+ monkeypatch.setattr(api, "load_config", lambda: config_loads.append(True) or pytest.fail("tool should not load V2Config"))
- out = api._run_install_command("askill", ["bash", "-c", "true"], lambda value: value, mode="install")
+ out = api._run_install_command("tool", ["bash", "-c", "true"], lambda value: value, mode="install")
assert out["ok"] is True
- assert out["path"] == "/usr/local/bin/askill"
+ assert out["path"] == "/usr/local/bin/tool"
assert config_loads == []
@@ -232,8 +299,8 @@ def test_shared_install_runner_failures_have_structured_identity(monkeypatch):
return "", "installer stderr"
monkeypatch.setattr(api.subprocess, "Popen", FailedPopen)
- failed = api._run_install_command("askill", ["bash"], lambda value: value)
- assert failed["reason"] == "askill_install_failed"
+ failed = api._run_install_command("opencode", ["bash"], lambda value: value)
+ assert failed["reason"] == "opencode_install_failed"
assert failed["exit_code"] == 17
class ErrorPopen:
@@ -241,8 +308,8 @@ def test_shared_install_runner_failures_have_structured_identity(monkeypatch):
raise OSError("runner unavailable")
monkeypatch.setattr(api.subprocess, "Popen", ErrorPopen)
- errored = api._run_install_command("askill", ["bash"], lambda value: value)
- assert errored["reason"] == "askill_install_error"
+ errored = api._run_install_command("opencode", ["bash"], lambda value: value)
+ assert errored["reason"] == "opencode_install_error"
assert errored["error"] == "runner unavailable"
class TimedOutPopen:
@@ -259,35 +326,11 @@ def test_shared_install_runner_failures_have_structured_identity(monkeypatch):
monkeypatch.setattr(api.subprocess, "Popen", TimedOutPopen)
monkeypatch.setattr(api, "signal_process_tree", lambda *args, **kwargs: None)
- timed_out = api._run_install_command("askill", ["bash"], lambda value: value)
- assert timed_out["reason"] == "askill_install_timeout"
+ timed_out = api._run_install_command("opencode", ["bash"], lambda value: value)
+ assert timed_out["reason"] == "opencode_install_timeout"
assert timed_out["timeout_seconds"] == 300
-def test_install_askill_unsupported_without_curl(monkeypatch):
- # No curl/bash (e.g. Windows): no broken npm fallback — a clear manual
- # message pointing at askill.sh, and _run_install_command is never invoked.
- monkeypatch.setattr(api, "resolve_cli_path", lambda b: None)
- monkeypatch.setattr(api, "_run_install_command", lambda *a, **k: pytest.fail("should not install"))
- out = api.install_askill()
- assert out["ok"] is False
- assert "askill.sh" in out["message"]
- assert out["reason"] == "askill_auto_install_unsupported"
- assert out["required_tools"] == ["curl", "bash"]
-
-
-def test_install_askill_unsupported_on_windows_even_with_tools(monkeypatch):
- monkeypatch.setattr("platform.system", lambda: "Windows")
- monkeypatch.setattr(api, "resolve_cli_path", lambda binary: f"C:/{binary}.exe")
- monkeypatch.setattr(api, "_run_install_command", lambda *a, **k: pytest.fail("should not install"))
-
- out = api.install_askill()
-
- assert out["ok"] is False
- assert "askill.sh" in out["message"]
- assert out["reason"] == "askill_auto_install_unsupported"
-
-
def test_ensure_askill_idempotent_when_present(monkeypatch):
monkeypatch.setattr(api, "resolve_cli_path", lambda b: "/usr/local/bin/askill")
flag = {"installed": False}
@@ -472,7 +515,7 @@ def test_windows_candidate_paths_include_managed_exe(monkeypatch):
("Windows", "ARM64", "windows-arm64"),
],
)
-def test_install_avault_downloads_manifest_verifies_and_installs(monkeypatch, system, machine, target):
+def test_install_avault_downloads_the_pinned_archive_verifies_and_installs(monkeypatch, system, machine, target):
monkeypatch.setattr(api, "_configured_avault_cli_path", lambda: "avault")
monkeypatch.setattr(api, "_managed_avault_release_satisfies_p2", lambda: True)
monkeypatch.setattr("platform.system", lambda: system)
@@ -491,10 +534,7 @@ def test_install_avault_downloads_manifest_verifies_and_installs(monkeypatch, sy
assert api.V2Config.load().agents.avault.cli_path == str(installed)
else:
assert api.resolve_cli_path("avault") == str(installed)
- assert calls == [
- f"https://github.com/avibe-bot/avault/releases/download/v{api.AVAULT_VERSION}/manifest.json",
- f"https://github.com/avibe-bot/avault/releases/download/v{api.AVAULT_VERSION}/avault-{api.AVAULT_VERSION}-{target}.tar.gz",
- ]
+ assert calls == [f"https://dl.avibe.bot/avault/releases/v{api.AVAULT_VERSION}/avault-{api.AVAULT_VERSION}-{target}.tar.gz"]
def test_install_avault_checksum_mismatch_installs_nothing(monkeypatch):
@@ -522,15 +562,15 @@ def test_install_avault_generic_failure_has_structured_identity(monkeypatch):
monkeypatch.setattr("platform.machine", lambda: "arm64")
monkeypatch.setattr(
api,
- "_download_avault_release_file",
- lambda _url: (_ for _ in ()).throw(ValueError("invalid manifest")),
+ "_download_pinned_release_file",
+ lambda _url, _path, _size: (_ for _ in ()).throw(ValueError("invalid archive")),
)
out = api.install_avault()
assert out["ok"] is False
assert out["reason"] == "avault_install_failed"
- assert out["error"] == "invalid manifest"
+ assert out["error"] == "invalid archive"
def test_install_avault_is_idempotent_when_present(monkeypatch):
@@ -563,7 +603,7 @@ def test_install_avault_force_redownloads_when_present(monkeypatch):
out = api.install_avault(force=True)
assert out["ok"] is True
- assert len(calls) == 2
+ assert len(calls) == 1
assert installed.read_text(encoding="utf-8").startswith("#!/bin/sh")
@@ -820,18 +860,19 @@ def test_avault_status_marks_old_version_upgrade_required(monkeypatch):
assert s["status"] == "upgrade_required"
-def test_askill_update_status_compares_latest(monkeypatch):
[email protected](("version", "has_update"), [("0.1.13", True), (api.ASKILL_VERSION, False), ("99.0.0", False)])
+def test_askill_update_status_compares_against_the_pin(monkeypatch, version, has_update):
+ # Avibe upgrades an askill older than its pin and never downgrades a newer one.
monkeypatch.setattr(
api,
"askill_status",
- lambda: {"id": "askill", "installed": True, "version": "0.1.13", "status": "ready", "path": "/x"},
+ lambda: {"id": "askill", "installed": True, "version": version, "status": "ready", "path": "/x"},
)
- monkeypatch.setattr(api, "_cached_latest_askill", lambda: "0.1.14")
s = api.askill_update_status()
- assert s["latest_version"] == "0.1.14"
- assert s["has_update"] is True
+ assert s["latest_version"] == api.ASKILL_VERSION
+ assert s["has_update"] is has_update
assert s["auto_update"] is True
@@ -855,18 +896,11 @@ def test_reconcile_askill_auto_update_installs_when_missing(monkeypatch):
assert out["ok"] is True and out["action"] == "install"
-def test_reconcile_askill_auto_update_refreshes_when_newer(monkeypatch):
+def test_reconcile_askill_auto_update_refreshes_when_older_than_the_pin(monkeypatch):
monkeypatch.setattr(
api,
- "askill_update_status",
- lambda **_: {
- "id": "askill",
- "installed": True,
- "version": "0.1.13",
- "status": "ready",
- "latest_version": "0.1.14",
- "has_update": True,
- },
+ "askill_status",
+ lambda: {"id": "askill", "installed": True, "version": "0.1.13", "status": "ready", "path": "/x/askill"},
)
calls = []
@@ -882,21 +916,14 @@ def test_reconcile_askill_auto_update_refreshes_when_newer(monkeypatch):
assert out["ok"] is True
assert out["action"] == "update"
assert out["from_version"] == "0.1.13"
- assert out["latest_version"] == "0.1.14"
+ assert out["latest_version"] == api.ASKILL_VERSION
def test_reconcile_askill_auto_update_refreshes_when_current_version_unknown(monkeypatch):
monkeypatch.setattr(
api,
- "askill_update_status",
- lambda **_: {
- "id": "askill",
- "installed": True,
- "version": None,
- "status": "unknown",
- "latest_version": "0.1.14",
- "has_update": False,
- },
+ "askill_status",
+ lambda: {"id": "askill", "installed": True, "version": None, "status": "ready", "path": "/x/askill"},
)
calls = []
@@ -911,7 +938,7 @@ def test_reconcile_askill_auto_update_refreshes_when_current_version_unknown(mon
assert calls == [True]
assert out["ok"] is True
assert out["action"] == "refresh_unknown_version"
- assert out["latest_version"] == "0.1.14"
+ assert out["latest_version"] == api.ASKILL_VERSION
def test_reconcile_askill_auto_update_skips_when_disabled(monkeypatch):
@@ -923,21 +950,14 @@ def test_reconcile_askill_auto_update_skips_when_disabled(monkeypatch):
assert out == {"ok": True, "skipped": True, "reason": "askill_auto_update_disabled"}
-def test_refresh_askill_if_stale_does_not_run_the_installer_when_current(monkeypatch):
- # The askill.sh installer re-downloads the CLI whenever it runs, so the
- # shared currency owner must answer "already current" without invoking it.
[email protected]("version", [api.ASKILL_VERSION, "99.0.0"])
+def test_refresh_askill_if_stale_does_not_download_when_current(monkeypatch, version):
+ # Installing re-downloads the ~100 MB binary, so the shared currency owner
+ # must answer "already current" without it, and a newer askill is current.
monkeypatch.setattr(
api,
- "askill_update_status",
- lambda **_: {
- "id": "askill",
- "installed": True,
- "version": "0.1.14",
- "status": "ready",
- "path": "/x/askill",
- "latest_version": "0.1.14",
- "has_update": False,
- },
+ "askill_status",
+ lambda: {"id": "askill", "installed": True, "version": version, "status": "ready", "path": "/x/askill"},
)
monkeypatch.setattr(api, "ensure_askill_installed", lambda force=False: pytest.fail("should not install"))
@@ -948,32 +968,6 @@ def test_refresh_askill_if_stale_does_not_run_the_installer_when_current(monkeyp
assert "action" not in out
-def test_a_second_prepare_process_reuses_the_persisted_askill_latest(monkeypatch):
- # The waste this closes: ``vibe runtime prepare`` is a fresh process on every
- # install, upgrade, regression sync, and tenant update, and each one used to
- # spend a GitHub request re-learning askill's newest release. That request
- # comes out of the unauthenticated 60/hour/IP budget, and exhausting it makes
- # the latest lookup fail, which makes prepare reinstall askill outright.
- monkeypatch.setattr(
- api,
- "askill_status",
- lambda: {"id": "askill", "installed": True, "version": "0.1.14", "status": "ready"},
- )
- monkeypatch.setattr(api, "ensure_askill_installed", lambda force=False: pytest.fail("should not install"))
- probes = []
- monkeypatch.setattr(
- api,
- "_fetch_latest_askill_version",
- lambda: probes.append(1) or "0.1.14",
- )
-
- assert api.refresh_askill_if_stale()["reason"] == "up_to_date"
- latest_version_cache._MEMORY.clear() # noqa: SLF001 - stand in for a new process
- assert api.refresh_askill_if_stale()["reason"] == "up_to_date"
-
- assert len(probes) == 1
-
-
def test_refresh_askill_if_stale_ignores_the_auto_update_gate(monkeypatch):
# ``VIBE_ASKILL_AUTO_UPDATE`` disables the update-checker cadence, not the
# lifecycle refresh that ``vibe runtime prepare`` performs; keeping the gate
@@ -1116,30 +1110,6 @@ def test_refresh_avault_if_stale_never_answers_healthier_than_forcing(monkeypatc
assert stale_state["installs"] <= forced_state["installs"]
-def test_refresh_askill_if_stale_repairs_an_unreadable_binary_without_the_latest_probe(monkeypatch):
- # A binary that cannot report its version is broken, not current, and that
- # verdict must not depend on the upstream probe answering: prepare used to
- # force this install unconditionally, so gating the repair on a reachable
- # latest would report a broken askill as ready during a network blip.
- monkeypatch.setattr(
- api,
- "askill_status",
- lambda: {"id": "askill", "installed": True, "version": None, "status": "unknown", "path": "/x/askill"},
- )
- monkeypatch.setattr(api, "_cached_latest_askill", lambda: None)
- calls = []
- monkeypatch.setattr(
- api,
- "ensure_askill_installed",
- lambda force=False: calls.append(force) or {"ok": True, "installed": True, "changed": True, "path": "/x/askill"},
- )
-
- out = api.refresh_askill_if_stale()
-
- assert calls == [True]
- assert out["action"] == "refresh_unknown_version"
-
-
# Strings a version probe can produce that no comparison can order: absent,
# empty, a development build, a git description, a partial number. The point is
# not the list — it is that each one makes `_compare_versions` answer False, the
@@ -1157,7 +1127,6 @@ def test_askill_status_calls_an_unorderable_version_unknown(monkeypatch, version
"askill_status",
lambda: {"id": "askill", "installed": True, "version": version, "status": "ready", "path": "/x/askill"},
)
- monkeypatch.setattr(api, "_cached_latest_askill", lambda: "0.1.14")
assert api.askill_update_status()["status"] == "unknown"
@@ -1166,7 +1135,7 @@ def test_askill_status_calls_an_unorderable_version_unknown(monkeypatch, version
def test_refresh_askill_if_stale_repairs_an_unorderable_local_version(monkeypatch, version):
# `up_to_date` must be an affirmative verdict, never the branch everything
# unrecognised falls into. A version that cannot be ordered against the
- # published one means unknown, and unknown gets the repair the forced path
+ # pin means unknown, and unknown gets the repair the forced path
# would have performed — asserted over the shapes a probe can produce rather
# than over the one the review happened to name.
monkeypatch.setattr(
@@ -1174,7 +1143,6 @@ def test_refresh_askill_if_stale_repairs_an_unorderable_local_version(monkeypatc
"askill_status",
lambda: {"id": "askill", "installed": True, "version": version, "status": "ready", "path": "/x/askill"},
)
- monkeypatch.setattr(api, "_cached_latest_askill", lambda: "0.1.14")
calls = []
monkeypatch.setattr(
api,
@@ -1188,24 +1156,6 @@ def test_refresh_askill_if_stale_repairs_an_unorderable_local_version(monkeypatc
assert out["action"] == "refresh_unknown_version"
[email protected]("latest", UNORDERABLE_VERSIONS)
-def test_refresh_askill_if_stale_needs_an_orderable_latest_to_claim_currency(monkeypatch, latest):
- # The same rule on the upstream side: with nothing orderable to compare
- # against, staleness is undecided. The owner reports that instead of
- # currency, and each caller decides (prepare installs, the cadence skips).
- monkeypatch.setattr(
- api,
- "askill_status",
- lambda: {"id": "askill", "installed": True, "version": "0.1.14", "status": "ready", "path": "/x/askill"},
- )
- monkeypatch.setattr(api, "_cached_latest_askill", lambda: latest)
- monkeypatch.setattr(api, "ensure_askill_installed", lambda force=False: pytest.fail("the owner decides, it does not install here"))
-
- out = api.refresh_askill_if_stale()
-
- assert out["reason"] == "latest_unavailable"
-
-
@pytest.mark.parametrize(
("managed", "platform_supported", "expected"),
(
@@ -2052,43 +2002,6 @@ def test_start_dependency_install_job_runs_model_hub_engine(monkeypatch):
assert cur["version"] == "v7.2.149"
-def test_installing_askill_keeps_the_persisted_latest_for_the_next_process(monkeypatch):
- """An install is the one moment prepare runs most, and must not cost a probe.
-
- Installing 0.1.14 does not change the fact that 0.1.14 is what askill
- publishes, so the entry that justified the install is exactly what the next
- process needs: it compares a freshly measured local version against it and
- concludes ``up_to_date``. Retiring it here — the reflex the in-memory cache
- this replaced had — would send every post-update ``runtime prepare`` back to
- GitHub for a string already on disk.
- """
-
- installed = {"version": "0.1.13"}
- monkeypatch.setattr(
- api,
- "askill_status",
- lambda: {"id": "askill", "installed": True, "version": installed["version"], "status": "ready"},
- )
-
- def _install(force=False):
- installed["version"] = "0.1.14"
- return {"ok": True, "installed": True, "changed": True, "path": "/x/askill"}
-
- monkeypatch.setattr(api, "ensure_askill_installed", _install)
- probes = []
- monkeypatch.setattr(
- api,
- "_fetch_latest_askill_version",
- lambda: probes.append(1) or "0.1.14",
- )
-
- assert api.refresh_askill_if_stale()["action"] == "update"
- latest_version_cache._MEMORY.clear() # noqa: SLF001 - stand in for a new process
-
- assert api.refresh_askill_if_stale()["reason"] == "up_to_date"
- assert len(probes) == 1
-
-
def test_dependencies_status_shape(monkeypatch):
monkeypatch.setattr(
api.V2Config,
diff --git a/tests/test_release_mirror.py b/tests/test_release_mirror.py
index 5476892ec..a78821fcf 100644
--- a/tests/test_release_mirror.py
+++ b/tests/test_release_mirror.py
@@ -13,7 +13,9 @@ from tests.test_desktop_release import ROOT, workflow
REPOSITORY = "avibe-bot/avibe"
-def github_release(tag, *, published_at, prerelease=False, draft=False, assets=("a.tgz",)):
+def github_release(
+ tag, *, published_at, prerelease=False, draft=False, assets=("a.tgz",), repository=REPOSITORY
+):
return {
"tag_name": tag,
"draft": draft,
@@ -26,7 +28,7 @@ def github_release(tag, *, published_at, prerelease=False, draft=False, assets=(
"digest": f"sha256:{hashlib.sha256(name.encode()).hexdigest()}",
"content_type": "application/x-gtar",
"browser_download_url": (
- f"https://github.com/{REPOSITORY}/releases/download/{tag}/{name.replace('+', '%2B')}"
+ f"https://github.com/{repository}/releases/download/{tag}/{name.replace('+', '%2B')}"
),
}
for name in assets
@@ -34,8 +36,8 @@ def github_release(tag, *, published_at, prerelease=False, draft=False, assets=(
}
-def releases(*items):
- return mirror.parse_releases(REPOSITORY, items, {item["tag_name"]: "0" * 40 for item in items})
+def releases(*items, repository=REPOSITORY):
+ return mirror.parse_releases(repository, items, {item["tag_name"]: "0" * 40 for item in items})
def test_selection_keeps_every_full_release_and_only_the_newest_prereleases():
@@ -66,8 +68,9 @@ def test_reconcile_plan_trusts_only_objects_the_prior_index_verified():
objects = {release.key(asset): asset.size for asset in release.assets if asset.name != "absent.tgz"}
objects["releases/v1.0.0/truncated.tgz"] -= 1
objects["releases/gh-v0.9.0rc1/old.tgz"] = 1
- objects[mirror.INDEX_KEY] = len(prior)
+ objects[mirror.index_key(REPOSITORY)] = len(prior)
objects["thirdparty/uv/uv.tar.gz"] = 1
+ objects["askill/releases/v0.1.0/askill-linux-x64"] = 1
current = replace(
release,
assets=tuple(
@@ -88,6 +91,62 @@ def test_reconcile_plan_trusts_only_objects_the_prior_index_verified():
assert result.deletions == ("releases/gh-v0.9.0rc1/old.tgz",)
+def test_sibling_repositories_reconcile_only_their_own_root():
+ repository = "avibe-bot/askill"
+ (release,) = releases(
+ github_release("v0.1.15", published_at="2026-01-01T00:00:00Z", assets=("askill-linux-x64",),
+ repository=repository),
+ repository=repository,
+ )
+ objects = {
+ "askill/releases/v0.1.14/askill-linux-x64": 1,
+ "avault/releases/v0.1.6/manifest.json": 1,
+ "releases/v1.0.0/a.tgz": 1,
+ "index/releases.json": 1,
+ }
+
+ result = mirror.plan(repository, [release], objects, None)
+
+ assert [key for key, _ in result.uploads] == ["askill/releases/v0.1.15/askill-linux-x64"]
+ assert result.deletions == ("askill/releases/v0.1.14/askill-linux-x64",)
+ assert mirror.index_key(repository) == "askill/index/releases.json"
+
+
+def test_a_failing_repository_does_not_stop_the_others_but_fails_the_run(monkeypatch, capsys):
+ reconciled = []
+
+ def reconcile(repository, bucket, *, keep_prereleases, dry_run):
+ reconciled.append(repository)
+ if repository == "avibe-bot/askill":
+ raise mirror.MirrorError("gh api failed: HTTP 403")
+ return 0
+
+ monkeypatch.setattr(mirror, "reconcile", reconcile)
+
+ assert mirror.main(["--bucket", "avibe", "--endpoint-url", "https://r2.invalid"]) == 1
+ assert reconciled == list(mirror.REPOSITORIES)
+ assert "error: avibe-bot/askill: gh api failed: HTTP 403" in capsys.readouterr().err
+
+
+def test_tmux_builds_mirrors_its_full_releases_but_not_its_rebuilt_preview(monkeypatch):
+ repository = "tmux/tmux-builds"
+ items = [
+ github_release("v3.6b", published_at="2026-05-20T11:54:47Z", assets=("tmux-3.6b-linux-x86_64.tar.gz",),
+ repository=repository),
+ github_release("preview", published_at="2026-09-29T11:17:16Z", prerelease=True,
+ assets=("LICENSES.tar.gz",), repository=repository),
+ ]
+ bucket = RecordingBucket({}, None)
+ monkeypatch.setattr(mirror, "Bucket", lambda name, endpoint_url: bucket)
+ monkeypatch.setattr(mirror, "github_releases", lambda repository: items)
+ monkeypatch.setattr(mirror, "tag_commits", lambda repository: {"v3.6b": "0" * 40, "preview": "1" * 40})
+ monkeypatch.setattr(mirror, "download", lambda asset, destination: destination.write_bytes(b""))
+
+ arguments = ["--repository", repository, "--bucket", "avibe", "--endpoint-url", "https://r2.invalid"]
+ assert mirror.main(arguments) == 0
+ assert bucket.writes == ["tmux/releases/v3.6b/tmux-3.6b-linux-x86_64.tar.gz", "tmux/index/releases.json"]
+
+
def test_a_completed_reconcile_is_a_no_op_on_the_next_run():
selected = releases(
github_release("v1.0.0", published_at="2026-01-01T00:00:00Z", assets=("a.tgz", "b+local.whl")),
@@ -125,13 +184,13 @@ def test_published_bytes_changing_upstream_fails_the_run_even_as_a_dry_run(monke
(release,) = releases(item)
(asset,) = release.assets
prior = mirror.render_index(REPOSITORY, [replace(release, assets=(replace(asset, sha256="f" * 64),))])
- bucket = RecordingBucket({release.key(asset): asset.size, mirror.INDEX_KEY: len(prior)}, prior)
+ bucket = RecordingBucket({release.key(asset): asset.size, "index/releases.json": len(prior)}, prior)
monkeypatch.setattr(mirror, "github_releases", lambda repository: [item])
monkeypatch.setattr(mirror, "tag_commits", lambda repository: {"v1.0.0": "0" * 40})
monkeypatch.setattr(mirror, "download", lambda asset, destination: destination.write_bytes(b""))
assert mirror.reconcile(REPOSITORY, bucket, keep_prereleases=20, dry_run=dry_run) == 1
- assert bucket.writes == ([] if dry_run else ["releases/v1.0.0/a.tgz", mirror.INDEX_KEY])
+ assert bucket.writes == ([] if dry_run else ["releases/v1.0.0/a.tgz", "index/releases.json"])
def test_an_empty_release_listing_never_plans_deleting_the_mirror():
diff --git a/tests/test_show_pages.py b/tests/test_show_pages.py
index 8305db6fd..4a89aaac8 100644
--- a/tests/test_show_pages.py
+++ b/tests/test_show_pages.py
@@ -377,7 +377,7 @@ def test_runtime_prepare_tmux_runs_when_terminal_enabled(monkeypatch):
def test_runtime_prepare_downloads_nothing_when_managed_deps_are_current(monkeypatch):
# Prepare is the chokepoint that keeps managed local deps current, which is
# not the same as reinstalling them: every install here is a network download
- # (askill ~30s, avault ~20s), so a prepare with nothing to change must reach
+ # (askill ~100 MB, avault ~3 MB), so a prepare with nothing to change must reach
# none of them. Stubbing the installers rather than the decision keeps this
# honest whichever way the wrappers ask the question.
monkeypatch.delenv("VIBE_INSTALL_SKIP_ASKILL", raising=False)
@@ -387,9 +387,8 @@ def test_runtime_prepare_downloads_nothing_when_managed_deps_are_current(monkeyp
monkeypatch.setattr(
api,
"askill_status",
- lambda: {"id": "askill", "installed": True, "version": "0.1.14", "status": "ready", "path": "/x/askill"},
+ lambda: {"id": "askill", "installed": True, "version": api.ASKILL_VERSION, "status": "ready", "path": "/x/askill"},
)
- monkeypatch.setattr(api, "_cached_latest_askill", lambda: "0.1.14")
monkeypatch.setattr(api, "_configured_avault_cli_path", lambda: "avault")
monkeypatch.setattr(api, "resolve_cli_path", lambda _b: "/usr/local/bin/avault")
monkeypatch.setattr(api, "_probe_avault_version", lambda _path: api.AVAULT_VERSION)
@@ -402,44 +401,15 @@ def test_runtime_prepare_downloads_nothing_when_managed_deps_are_current(monkeyp
"installed": True,
"changed": False,
"path": "/x/askill",
- "version": "0.1.14",
+ "version": api.ASKILL_VERSION,
}
assert avault["ok"] is True
assert avault["changed"] is False
assert avault["version"] == api.AVAULT_VERSION
[email protected]("reason", ["latest_unavailable", "a_reason_invented_after_this_test"])
-def test_runtime_prepare_installs_when_currency_was_not_established(monkeypatch, reason):
- # "I did not install" and "it is current" are different facts, and prepare
- # may only report ready for the second. `up_to_date` is the one verdict that
- # states it; every other non-install verdict — the upstream probe failing
- # today, whatever is added later — means unknown, so prepare installs rather
- # than printing `askill ready.` off a check that never happened. Keyed on the
- # verdict rather than on a list of reasons, so a reason added later inherits
- # the safe branch instead of a false pass.
- monkeypatch.delenv("VIBE_INSTALL_SKIP_ASKILL", raising=False)
- monkeypatch.setattr(
- api,
- "refresh_askill_if_stale",
- lambda: {"ok": True, "skipped": True, "reason": reason, "status": {"path": "/x/askill", "version": "0.1.14"}},
- )
- forced = []
- monkeypatch.setattr(
- api,
- "ensure_askill_installed",
- lambda force=False: forced.append(force) or {"ok": True, "installed": True, "changed": True},
- )
-
- out = cli._ensure_askill_during_prepare()
-
- assert forced == [True], "an unestablished currency must reach the installer"
- assert out["changed"] is True
- assert out["action"] == "refresh_currency_unknown"
-
-
def test_runtime_prepare_force_still_reinstalls_current_managed_deps(monkeypatch):
- # The mirror of the test above, and the boundary of the change: making the
+ # The mirror of the current-deps test, and the boundary of the change: making the
# ordinary prepare cheap must not take the repair away. A corrupted binary
# can still report the current version, so `--force` has to reach the
# installer for exactly the states the currency check skips.
diff --git a/vibe/api.py b/vibe/api.py
index 399ed2480..6c57d3e00 100644
--- a/vibe/api.py
+++ b/vibe/api.py
@@ -127,7 +127,7 @@ from core.vibe_agents import (
)
from core.process_isolation import isolated_subprocess_kwargs, signal_process_tree, KILL_SIGNAL
from storage.lock import MigrationFileLock, MigrationLockTimeout
-from core.dependency_network import DependencyNetworkError, dependency_error_message, fetch_bytes
+from core.dependency_network import DependencyNetworkError, dependency_error_message, fetch_to_path
logger = logging.getLogger(__name__)
@@ -7592,9 +7592,8 @@ def _run_install_command(
# Persist real Agent backend CLI paths to V2Config so the next
# ``get_backend_runtime`` reads them directly instead of relying
- # on the resolver's stale-path fallback. Local dependencies such
- # as askill reuse this runner but do not have ``agents.<name>``
- # config entries, so they must not touch V2Config bookkeeping.
+ # on the resolver's stale-path fallback. Only Agent backends have
+ # ``agents.<name>`` config entries to persist into.
if installed_path and is_agent_backend(name):
_persist_agent_cli_path(name, installed_path)
@@ -7632,6 +7631,18 @@ def _run_install_command(
_ASKILL_INSTALL_LOCK = threading.Lock()
+# The managed askill release. Avibe installs it and upgrades an older askill to
+# it; only an explicit repair replaces a newer one.
+ASKILL_VERSION = "0.1.15"
+# (sha256, size) of each ASKILL_VERSION binary by askill's platform name, from
+# the release's GitHub asset digests.
+_ASKILL_BINARIES = {
+ "darwin-arm64": ("09d333828577bca89c4c842f3a30fb5459f22a78a59db8287512b3653762acb1", 63759842),
+ "darwin-x64": ("0f81766bcaf18c05148c403ebe561a3b7f2c0699cadca86fc498b5f812fc97a9", 69484624),
+ "linux-arm64": ("e06830ba2170f70e8dc9c5efbe83568f615735c75cca8f6961e45f2fbaf2bc91", 93956240),
+ "linux-x64": ("a5ac72faafc0f3f14c36a34c1a2e2beff777a483ad6ce71ee945297f0fa0aa24", 94894208),
+ "win32-x64": ("00e1bd471f531bded8504f1c6d79edf900ff9cee7e313bf6528be927e508dfe1", 98781696),
+}
_AVAULT_INSTALL_LOCK = threading.Lock()
_AVAULT_AGENT_MANAGER_LOCK = threading.Lock()
_AVAULT_AGENT_MANAGER = None
@@ -7645,14 +7656,42 @@ AVAULT_GRANT_DELIVERY_MIN_VERSION = "0.1.4"
# Older binaries cannot open browser-sealed protected values and fail with
# "open failed for <name>", so protected Vaults must not treat them as ready.
AVAULT_PROTECTED_RECORD_MIN_VERSION = "0.1.6"
-# Installer pin must reference a published manifest-pinned release. v0.1.6 adds the
+# Installer pin must reference a published release. v0.1.6 adds the
# protected-record v2 AAD fix so agent delivery can open browser-sealed protected values.
AVAULT_VERSION = "0.1.6"
-_AVAULT_RELEASE_BASE_URL = f"https://github.com/avibe-bot/avault/releases/download/v{AVAULT_VERSION}/"
+# (sha256, size) of each AVAULT_VERSION archive by target, copied from that
+# release's manifest.json so the download is verified whichever source served it.
+_AVAULT_ARCHIVES = {
+ "linux-arm64": ("3405d740ac91c5490a0c16839bb878a2c574ee21053a7a4362d7bbeb7ce3f110", 3251581),
+ "linux-x64": ("42d5bd3bed5ccdd4748a99cfd64f2e32ab1649e4cd2dd13fcc060806c39109f2", 3574160),
+ "macos-arm64": ("2bf9ace2e055c9988ca3b24aa483676e1123b7a588b5082f57cc18d7d856f7c9", 1458126),
+ "macos-x64": ("558b4559b0bcdaeb713758183530d6944c2eacd68fcbfb35cd43ebd017fde163", 1597445),
+ "windows-arm64": ("0b1a2a91ad0a24c392172164e4040fb3c50bec81fd3a14d58e6e13d04053d864", 1316664),
+ "windows-x64": ("c0b9404d30980531f2a6df5e2b4f8bf6e5a34b31a916f7971b522a3a6cad71ad", 1394102),
+}
+
+def _avault_archive_url(target: str) -> str:
+ return (
+ f"https://github.com/avibe-bot/avault/releases/download/v{AVAULT_VERSION}/"
+ f"avault-{AVAULT_VERSION}-{target}.tar.gz"
+ )
-def avault_manifest_url() -> str:
- return urllib.parse.urljoin(_AVAULT_RELEASE_BASE_URL, "manifest.json")
+
+def avault_download_url() -> str | None:
+ """The pinned avault archive for this platform, or None without a build."""
+ target = _avault_target()[0]
+ return _avault_archive_url(target) if target else None
+
+
+def _download_pinned_release_file(url: str, path: Path, size: int) -> str:
+ """Download a pinned release asset (mirror first) to ``path``; return its sha256."""
+ fetch_to_path(url, path, timeout=30, size=size)
+ digest = hashlib.sha256()
+ with path.open("rb") as source:
+ while chunk := source.read(1024 * 1024):
+ digest.update(chunk)
+ return digest.hexdigest()
def _truncate_install_output(output: str, limit: int = 8192) -> str:
@@ -7720,40 +7759,102 @@ def _reset_avault_agent_after_binary_change(*, reason: str) -> None:
logger.warning("%s: failed to quarantine resident avault agent socket after binary change", reason, exc_info=True)
-def askill_auto_install_supported() -> bool:
- """Return whether this host can run askill's official installer."""
- import platform
+def _askill_platform() -> str | None:
+ """askill's release platform name for this host when a build is pinned.
+
+ askill names platforms as Node does (``darwin-arm64``, ``win32-x64``) where
+ avault says ``macos-arm64`` and ``windows-x64`` for the same hosts.
+ """
+ target = _avault_target()[0]
+ if target is None:
+ return None
+ system, _, arch = target.partition("-")
+ system = {"macos": "darwin", "windows": "win32"}.get(system, system)
+ name = f"{system}-{arch}"
+ return name if name in _ASKILL_BINARIES else None
+
+def _askill_binary_url(platform_name: str) -> str:
+ suffix = ".exe" if platform_name.startswith("win32-") else ""
return (
- platform.system().lower() != "windows"
- and resolve_cli_path("curl") is not None
- and resolve_cli_path("bash") is not None
+ f"https://github.com/avibe-bot/askill/releases/download/v{ASKILL_VERSION}/"
+ f"askill-{platform_name}{suffix}"
)
+def askill_download_url() -> str | None:
+ """The pinned askill binary for this platform, or None without a build."""
+ platform_name = _askill_platform()
+ return _askill_binary_url(platform_name) if platform_name else None
+
+
+def askill_auto_install_supported() -> bool:
+ """Return whether Avibe pins an askill build for this host."""
+ return _askill_platform() is not None
+
+
def install_askill() -> dict:
"""Install (or refresh) the askill CLI — a required local dependency for Skills.
- Uses the official one-line installer (same shape as the OpenCode bootstrap
- in ``install_agent``). Runs through ``_run_install_command``, whose
- V2Config cli_path bookkeeping is limited to real Agent backends, so it is
- safe for a standalone local dependency.
+ Downloads this platform's pinned ``ASKILL_VERSION`` binary, verifies its
+ pinned sha256, and atomically installs it where askill's own installer puts
+ it: ``~/.local/bin``, the first place ``resolve_cli_path`` looks.
"""
- if askill_auto_install_supported():
- cmd = _curl_installer_command("https://askill.sh", "sh")
- return _run_install_command("askill", cmd, _truncate_install_output, mode="install")
- # No npm fallback: askill is distributed via the askill.sh installer, not a
- # public npm package, so a curl/bash-less host (e.g. Windows) must install
- # it manually rather than hit a guaranteed-failing `npm i -g`.
- import platform
+ import tempfile
+ platform_name = _askill_platform()
+ if platform_name is None:
+ platform_label = _avault_target()[1]
+ return {
+ "ok": False,
+ "message": backend_t("dependencies.askill.noBuild", platform=platform_label),
+ "reason": "askill_platform_unsupported",
+ "platform": platform_label,
+ "output": None,
+ }
+ url = _askill_binary_url(platform_name)
+ expected_sha256, size = _ASKILL_BINARIES[platform_name]
+ windows = platform_name.startswith("win32-")
+ install_path = Path.home() / ".local" / "bin" / ("askill.exe" if windows else "askill")
+ try:
+ install_path.parent.mkdir(parents=True, exist_ok=True)
+ with tempfile.TemporaryDirectory(prefix="askill-install-", dir=install_path.parent) as tmp_dir:
+ tmp_path = Path(tmp_dir) / install_path.name
+ actual_sha256 = _download_pinned_release_file(url, tmp_path, size)
+ if actual_sha256 != expected_sha256:
+ return {
+ "ok": False,
+ "message": backend_t("dependencies.askill.checksumMismatch"),
+ "reason": "askill_binary_checksum_mismatch",
+ "expected_sha256": expected_sha256,
+ "actual_sha256": actual_sha256,
+ "platform": platform_name,
+ "url": url,
+ "output": f"expected {expected_sha256}, got {actual_sha256}",
+ }
+ if not windows:
+ tmp_path.chmod(0o755)
+ os.replace(tmp_path, install_path)
+ _clear_macos_quarantine(install_path)
+ except Exception as exc: # noqa: BLE001
+ logger.warning("askill install failed: %s", exc, exc_info=True)
+ result = {
+ "ok": False,
+ "message": backend_t("dependencies.askill.installFailed", error=str(exc)),
+ "reason": "askill_install_failed",
+ "error": str(exc),
+ "platform": platform_name,
+ "output": None,
+ }
+ if isinstance(exc, DependencyNetworkError):
+ result["reason"] = "askill_download_failed"
+ result["download_error"] = dict(exc.details)
+ result["message"] = dependency_error_message(exc.details, label="askill download")
+ return result
return {
- "ok": False,
- "message": "askill auto-install needs curl + bash (macOS/Linux). Install it manually from https://askill.sh.",
- "reason": "askill_auto_install_unsupported",
- "required_tools": ["curl", "bash"],
- "platform": platform.system() or "unknown",
- "output": None,
+ "ok": True,
+ "message": backend_t("dependencies.askill.installed", version=ASKILL_VERSION),
+ "output": f"Installed askill {ASKILL_VERSION} for {platform_name}",
}
@@ -7894,21 +7995,6 @@ def _persist_avault_cli_path(path: str) -> None:
raise
-def _download_avault_release_file(url: str) -> bytes:
- request = urllib.request.Request(
- url,
- headers={
- "Accept": "application/octet-stream",
- "User-Agent": "avibe/avault-installer",
- },
- )
- return fetch_bytes(
- request,
- timeout=30,
- opener=urllib.request.urlopen,
- )
-
-
def _extract_avault_binary(archive_bytes: bytes, output_path: Path, member_name: str = "avault") -> None:
import io
import tarfile
@@ -7940,9 +8026,9 @@ def _clear_macos_quarantine(path: Path) -> None:
def install_avault(force: bool = False) -> dict:
"""Install (or refresh) avault, the required local custody-core dependency.
- Downloads the Avibe-pinned public avault release manifest and tarball,
- verifies the manifest sha256, safely extracts the single ``avault`` member,
- and atomically installs it into Avibe's managed CLI location.
+ Downloads the Avibe-pinned avault release archive, verifies its pinned
+ sha256, safely extracts the single ``avault`` member, and atomically
+ installs it into Avibe's managed CLI location.
"""
path = _resolve_avault_cli_path()
if path and not force:
@@ -7955,7 +8041,6 @@ def install_avault(force: bool = False) -> dict:
"version": existing_version,
}
- import hashlib
import tempfile
target, platform_label = _avault_target()
@@ -7980,38 +8065,28 @@ def install_avault(force: bool = False) -> dict:
}
try:
- manifest_url = avault_manifest_url()
- manifest = json.loads(_download_avault_release_file(manifest_url).decode("utf-8"))
- entry = manifest["versions"][AVAULT_VERSION][target]
- asset = entry["asset"]
- expected_sha256 = str(entry["sha256"]).strip().lower()
- if not isinstance(asset, str) or not asset.endswith(".tar.gz") or "/" in asset:
- raise ValueError("manifest contains an invalid avault asset name")
- if not re.fullmatch(r"[0-9a-f]{64}", expected_sha256):
- raise ValueError("manifest contains an invalid avault sha256")
-
- archive_url = urllib.parse.urljoin(_AVAULT_RELEASE_BASE_URL, asset)
- archive_bytes = _download_avault_release_file(archive_url)
- actual_sha256 = hashlib.sha256(archive_bytes).hexdigest()
- if actual_sha256 != expected_sha256:
- return {
- "ok": False,
- "message": backend_t("dependencies.avault.checksumMismatch"),
- "reason": "avault_checksum_mismatch",
- "expected_sha256": expected_sha256,
- "actual_sha256": actual_sha256,
- "platform": target,
- "url": archive_url,
- "output": f"expected {expected_sha256}, got {actual_sha256}",
- "path": None,
- }
-
+ expected_sha256, size = _AVAULT_ARCHIVES[target]
+ archive_url = _avault_archive_url(target)
member_name = _avault_binary_name_for_target(target)
install_path = _avault_managed_bin_path(target)
install_path.parent.mkdir(parents=True, exist_ok=True)
with tempfile.TemporaryDirectory(prefix="avault-install-", dir=install_path.parent) as tmp_dir:
+ archive_path = Path(tmp_dir) / "avault.tar.gz"
+ actual_sha256 = _download_pinned_release_file(archive_url, archive_path, size)
+ if actual_sha256 != expected_sha256:
+ return {
+ "ok": False,
+ "message": backend_t("dependencies.avault.checksumMismatch"),
+ "reason": "avault_checksum_mismatch",
+ "expected_sha256": expected_sha256,
+ "actual_sha256": actual_sha256,
+ "platform": target,
+ "url": archive_url,
+ "output": f"expected {expected_sha256}, got {actual_sha256}",
+ "path": None,
+ }
tmp_path = Path(tmp_dir) / member_name
- _extract_avault_binary(archive_bytes, tmp_path, member_name)
+ _extract_avault_binary(archive_path.read_bytes(), tmp_path, member_name)
if not target.startswith("windows-"):
tmp_path.chmod(0o755)
os.replace(tmp_path, install_path)
@@ -8794,26 +8869,14 @@ def _askill_auto_update_disabled() -> bool:
return value in _FALSY_ENV_VALUES
-def _fetch_latest_askill_version() -> str | None:
- return _fetch_github_latest_release_version(_ASKILL_RELEASE_REPOSITORY, user_agent="avibe/askill-dependency")
-
-
-def _cached_latest_askill() -> str | None:
- # Share the managed-dependency cache so every local tool latest probe obeys
- # the same TTLs — and, more to the point here, so ``vibe runtime prepare``
- # inherits the answer a previous process already paid GitHub for.
- return latest_version_cache.cached_latest(_ASKILL_CACHE_KEY, _fetch_latest_askill_version)
-
-
-def askill_update_status(*, include_latest: bool = True) -> dict:
- """Return local askill version plus best-effort upstream update state."""
+def askill_update_status() -> dict:
+ """Return the local askill version and whether it is older than the pin."""
current = askill_status()
- latest = _cached_latest_askill() if include_latest else None
current_version = current.get("version") if current.get("installed") else None
- has_update = bool(include_latest and current.get("installed") and _compare_versions(current_version, latest))
+ has_update = bool(current.get("installed") and _compare_versions(current_version, ASKILL_VERSION))
out = {
**current,
- "latest_version": latest,
+ "latest_version": ASKILL_VERSION,
"has_update": has_update,
"auto_update": not _askill_auto_update_disabled(),
}
@@ -8827,22 +8890,18 @@ def askill_update_status(*, include_latest: bool = True) -> dict:
def refresh_askill_if_stale() -> dict:
- """Bring askill to the published version, installing only when that changes it.
+ """Bring askill to the managed pin, installing only when that changes it.
The single owner of "is the managed askill current, and make it so". Every
- caller that wants currency asks this instead of forcing an install, because
- the askill.sh installer re-downloads the CLI on every run: answering the
- question costs one cached version probe, answering it by reinstalling costs
- ~30s of network even when the local binary is already the published version.
- ``refresh_avault_if_stale`` is the same rule for the version-pinned sibling.
+ caller that wants currency asks this instead of forcing an install, which
+ re-downloads the ~100 MB binary: the wanted version is ``ASKILL_VERSION``,
+ so the question is answered locally with no download at all.
+ ``refresh_avault_if_stale`` is the same rule for the other pinned sibling.
Callers own their own policy gate; this function only decides staleness. An
install attempt is reported by ``action``, so its absence means the
- dependency was already current.
-
- ``up_to_date`` is an affirmative verdict, never a fallthrough: it requires
- two versions that could actually be ordered. Anything else is unknown, and
- unknown is answered by the repair the forced path would have done.
+ dependency was already current. An askill newer than the pin is current:
+ Avibe never downgrades it.
"""
status = askill_update_status()
if not status.get("installed"):
@@ -8850,46 +8909,25 @@ def refresh_askill_if_stale() -> dict:
result["action"] = "install"
return result
- latest = status.get("latest_version")
if status.get("status") == "unknown":
# A binary whose version cannot be ordered is not current, it is broken —
# whether it reported nothing or reported ``dev``. The status field owns
# that judgement (see ``askill_update_status``) so this path and the
- # Dependencies page cannot disagree. Deciding it before the
- # ``latest_unavailable`` exit keeps the repair from being gated on
- # network reachability: callers that used to force this install
- # unconditionally would otherwise be told a broken askill is ready
- # whenever the latest lookup failed too.
+ # Dependencies page cannot disagree.
logger.info("askill local version is unknown; refreshing managed dependency")
result = ensure_askill_installed(force=True)
result["action"] = "refresh_unknown_version"
- result["latest_version"] = latest
+ result["latest_version"] = ASKILL_VERSION
return result
- if not _is_comparable_version(latest):
- # No usable upstream version to compare against — missing, or a string
- # that cannot be ordered. Either way staleness is undecided, which is a
- # different fact from being current; each caller owns what to do with it
- # (prepare installs, the update cadence skips).
- return {"ok": True, "skipped": True, "reason": "latest_unavailable", "status": status}
-
if not status.get("has_update"):
- # Two comparable versions, compared: this is the one state that may claim
- # currency, and it is reached only by having established it.
return {"ok": True, "skipped": True, "reason": "up_to_date", "status": status}
- logger.info("askill update available: %s -> %s", status.get("version"), latest)
+ logger.info("askill update available: %s -> %s", status.get("version"), ASKILL_VERSION)
result = ensure_askill_installed(force=True)
result["action"] = "update"
result["from_version"] = status.get("version")
- result["latest_version"] = latest
- # Deliberately no cache invalidation here, unlike the in-memory cache this
- # replaced. The entry says which version askill *publishes*, and installing
- # that version does not change the answer — it makes it the one a later
- # ``askill_update_status`` needs, to compare a freshly measured local version
- # against and conclude ``up_to_date``. Dropping it would send the next
- # ``runtime prepare`` back to GitHub for a string we still hold, in the one
- # window (right after an update) where prepare runs most often.
+ result["latest_version"] = ASKILL_VERSION
return result
@@ -9208,7 +9246,7 @@ def dependencies_status(*, offline: bool = False, dependency_ids: list[str] | No
raise ValueError(f"Unknown dependencies: {', '.join(sorted(unknown))}")
deps: dict[str, dict] = {}
if "askill" in requested:
- a = askill_update_status(include_latest=False)
+ a = askill_update_status()
deps["askill"] = {
"id": "askill",
"kind": "tool",
@@ -9615,10 +9653,6 @@ _BACKEND_CACHE_LOCK = __import__("threading").Lock()
_BACKEND_VERSION_CACHE: dict[tuple[str, str], tuple[float, str | None]] = {}
_BACKEND_VERSION_TTL_SECONDS = 30.0
_BACKEND_RUNTIME_USER_AGENT = "avibe/backend-runtime"
-_ASKILL_RELEASE_REPOSITORY = "avibe-bot/askill"
-#: askill is a managed dependency, not an agent backend, so it needs a name of
-#: its own in the shared latest-version cache.
-_ASKILL_CACHE_KEY = "askill"
_ASKILL_AUTO_UPDATE_ENV = "VIBE_ASKILL_AUTO_UPDATE"
_ASKILL_SKIP_ENV = "VIBE_INSTALL_SKIP_ASKILL"
_TRUTHY_ENV_VALUES = {"1", "true", "yes", "on"}
diff --git a/vibe/cli.py b/vibe/cli.py
index 97c5cada7..9344fd05f 100644
--- a/vibe/cli.py
+++ b/vibe/cli.py
@@ -206,11 +206,7 @@ DOCTOR_DISPLAY_PROJECTIONS = {
"io": "doctor.repair.dependencyDownloadIo",
},
"repair_reason": {
- "askill_auto_install_unsupported": "doctor.repair.askillAutoInstallUnsupported",
"askill_install_path_missing": "doctor.repair.askillInstallPathMissing",
- "askill_install_timeout": "doctor.repair.installTimeout",
- "askill_install_failed": "doctor.repair.installCommandFailed",
- "askill_install_error": "doctor.repair.installError",
"avault_platform_unsupported": "doctor.repair.avaultPlatformUnsupported",
"avault_checksum_mismatch": "doctor.repair.avaultChecksumMismatch",
"avault_install_path_missing": "doctor.repair.avaultInstallPathMissing",
@@ -11662,12 +11658,12 @@ def _managed_dependencies_doctor_items(*, deep: bool = False) -> list[dict]:
if not deep:
continue
- if dependency_id == "askill":
- probe = probe_url("https://askill.sh", user_agent="avibe-askill-doctor")
- elif dependency_id == "avault":
- probe = probe_url(
- api.avault_manifest_url(),
- user_agent="avibe-avault-doctor",
+ if dependency_id in {"askill", "avault"}:
+ url = api.askill_download_url() if dependency_id == "askill" else api.avault_download_url()
+ probe = (
+ probe_url(url, user_agent=f"avibe-{dependency_id}-doctor")
+ if url
+ else {"ok": False, "checked": False, "reason": f"{dependency_id}_platform_unsupported"}
)
elif dependency_id == "tmux" and probe is None:
from core.tmux_runtime import TmuxRuntimeManager
@@ -12957,17 +12953,11 @@ def _doctor_managed_failure_detail(target: str, result: dict, language: str) ->
key = _doctor_managed_reason_key(reason)
error = result.get("error") or i18n_t("doctor.value.unknownError", language)
kwargs = {"target": target, "error": error}
- if reason == "askill_auto_install_unsupported":
- kwargs["tools"] = "+".join(str(tool) for tool in result.get("required_tools") or ("curl", "bash"))
- elif reason == "avault_platform_unsupported":
+ if reason == "avault_platform_unsupported":
kwargs["platform"] = result.get("platform") or i18n_t("doctor.value.unknown", language)
elif reason == "avault_checksum_mismatch":
kwargs["expected_sha256"] = result.get("expected_sha256") or i18n_t("doctor.value.unknown", language)
kwargs["actual_sha256"] = result.get("actual_sha256") or i18n_t("doctor.value.unknown", language)
- elif reason in {"askill_install_timeout"}:
- kwargs["timeout_seconds"] = result.get("timeout_seconds") or 300
- elif reason == "askill_install_failed" or reason.endswith("_install_failed"):
- kwargs["exit_code"] = result.get("exit_code") or i18n_t("doctor.value.unknown", language)
if key:
return i18n_t(key, language, **kwargs)
return i18n_t("doctor.repair.dependencyFailedDefault", language)
@@ -16250,23 +16240,17 @@ def _ensure_askill_during_prepare(offline: bool = False, force: bool = False) ->
Folded into ``vibe runtime prepare`` so askill auto-installs at exactly the
same lifecycle points as the Show Page runtime (post install / upgrade),
with a ``VIBE_INSTALL_SKIP_ASKILL`` escape hatch mirroring the Show Runtime
- one. Skipped under ``--offline`` (the askill installer needs the network).
- Refreshes askill to latest so prepare stays the chokepoint that keeps
- required local deps current on upgrade, but asks whether that refresh would
- change anything before running the installer: askill.sh re-downloads the CLI
- on every run, so an unconditional refresh charged every prepare ~30s to
- install the version already on disk. An askill hiccup never fails the
- prepare; the Dependencies page offers a manual retry.
+ one. Skipped under ``--offline`` (the askill download needs the network).
+ Refreshes askill to the managed pin so prepare stays the chokepoint that
+ keeps required local deps current on upgrade, but asks whether that refresh
+ would change anything before downloading the ~100 MB binary again. An askill
+ hiccup never fails the prepare; the Dependencies page offers a manual retry.
``force`` is prepare's ``--force``, and it means repair, not currency: a
corrupted binary can still report the current version, so an explicit
``vibe runtime prepare --force`` must reinstall rather than ask. Currency is
the default; repair stays available on request, exactly as it is for the
Show Runtime, tmux, and git phases.
-
- Only an explicit ``up_to_date`` verdict may report ready. Any other verdict
- that installed nothing means currency was not established, not that it holds,
- so prepare installs instead of claiming a fact it never checked.
"""
if offline:
return {"ok": True, "skipped": True, "reason": "offline"}
@@ -16278,20 +16262,6 @@ def _ensure_askill_during_prepare(offline: bool = False, force: bool = False) ->
result = api.refresh_askill_if_stale()
if not (result.get("ok") and result.get("action") is None):
return result
- if result.get("reason") != "up_to_date":
- # The owner skipped without establishing currency — today that is
- # ``latest_unavailable``, when the upstream version probe failed.
- # Prepare is the chokepoint that must *make* the dependency current,
- # so with no evidence either way it does what it did before this fast
- # path existed and installs. The probe and the askill.sh installer
- # are independent paths: a rate-limited or blipped version lookup
- # says nothing about whether the install would succeed, and reporting
- # ready off the back of it would claim currency we never checked.
- # Only ``up_to_date`` may report ready, so a skip reason added later
- # takes this branch rather than inheriting a false pass.
- refreshed = api.ensure_askill_installed(force=True)
- refreshed["action"] = "refresh_currency_unknown"
- return refreshed
except Exception as exc: # noqa: BLE001
return {"ok": False, "message": str(exc)}
# Already current, and the owner said so: report ready rather than skipped so
diff --git a/vibe/i18n/en.json b/vibe/i18n/en.json
index 55809706b..11b4f67fc 100644
--- a/vibe/i18n/en.json
+++ b/vibe/i18n/en.json
@@ -262,6 +262,12 @@
"submitted": "Submitted"
},
"dependencies": {
+ "askill": {
+ "installed": "askill {version} installed.",
+ "noBuild": "no askill build for {platform}",
+ "checksumMismatch": "askill download checksum verification failed.",
+ "installFailed": "askill install failed: {error}"
+ },
"avault": {
"ready": "avault ready.",
"missing": "avault is not installed. Build avault locally and put it on PATH, or set agents.avault.cli_path.",
@@ -1414,10 +1420,7 @@
"dependencyDownloadDisk": "There is not enough disk space to store the dependency.",
"dependencyDownloadIo": "Dependency file access failed.",
"dependencyDownloadUnknown": "Dependency download failed.",
- "askillAutoInstallUnsupported": "askill auto-install requires {tools}. Install it manually.",
- "askillInstallPathMissing": "askill installer completed, but askill was not found on PATH.",
- "installTimeout": "The {target} installer timed out after {timeout_seconds} seconds.",
- "installCommandFailed": "The {target} installer exited with code {exit_code}.",
+ "askillInstallPathMissing": "askill was installed, but was not found on PATH.",
"installError": "The {target} installer failed: {error}.",
"avaultPlatformUnsupported": "No avault build is published for {platform}.",
"avaultChecksumMismatch": "avault archive checksum verification failed (expected {expected_sha256}, got {actual_sha256}).",
@@ -1463,8 +1466,8 @@
"dryDuplicateProcesses": "Would stop extra Avibe service processes outside the service lock.",
"dryStaleRestart": "Would remove stale restart metadata and refresh runtime status.",
"dryStableLaunchers": "Would point every stable vibe launcher at the newest installed version.",
- "dryAskill": "Would install or refresh askill with the official installer.",
- "dryAvault": "Would install or refresh the manifest-pinned avault release.",
+ "dryAskill": "Would install or refresh the pinned askill release.",
+ "dryAvault": "Would install or refresh the pinned avault release.",
"dryModelHubEngine": "Would install or refresh the Avibe-pinned Model Hub engine (CPA).",
"dryGitRuntime": "Would install or refresh the manifest-pinned Git Runtime.",
"dryShowRuntime": "Would prepare the manifest-pinned Show Runtime archive when it is missing or invalid.",
diff --git a/vibe/i18n/zh.json b/vibe/i18n/zh.json
index e7539fd9c..a7cf892f5 100644
--- a/vibe/i18n/zh.json
+++ b/vibe/i18n/zh.json
@@ -262,6 +262,12 @@
"submitted": "已提交"
},
"dependencies": {
+ "askill": {
+ "installed": "askill {version} 已安装。",
+ "noBuild": "没有适用于 {platform} 的 askill 构建。",
+ "checksumMismatch": "askill 下载校验失败。",
+ "installFailed": "askill 安装失败:{error}"
+ },
"avault": {
"ready": "avault 已就绪。",
"missing": "尚未安装 avault。请先在本地构建 avault 并放到 PATH 上,或设置 agents.avault.cli_path。",
@@ -1414,10 +1420,7 @@
"dependencyDownloadDisk": "磁盘空间不足,无法保存依赖。",
"dependencyDownloadIo": "访问依赖文件失败。",
"dependencyDownloadUnknown": "依赖下载失败。",
- "askillAutoInstallUnsupported": "askill 自动安装需要 {tools},请手动安装。",
- "askillInstallPathMissing": "askill 安装器已完成,但在 PATH 中找不到 askill。",
- "installTimeout": "{target} 安装器在 {timeout_seconds} 秒后超时。",
- "installCommandFailed": "{target} 安装器以退出码 {exit_code} 结束。",
+ "askillInstallPathMissing": "askill 已安装,但在 PATH 中找不到 askill。",
"installError": "{target} 安装器失败:{error}。",
"avaultPlatformUnsupported": "没有为 {platform} 发布 avault 构建版本。",
"avaultChecksumMismatch": "avault 归档校验和验证失败(期望 {expected_sha256},实际 {actual_sha256})。",
@@ -1463,8 +1466,8 @@
"dryDuplicateProcesses": "将停止服务锁外的额外 Avibe 服务进程。",
"dryStaleRestart": "将移除过期重启元数据并刷新运行时状态。",
"dryStableLaunchers": "将让所有稳定 vibe 启动器都指向最新的已安装版本。",
- "dryAskill": "将使用官方安装器安装或刷新 askill。",
- "dryAvault": "将安装或刷新清单固定的 avault 版本。",
+ "dryAskill": "将安装或刷新固定版本的 askill。",
+ "dryAvault": "将安装或刷新固定版本的 avault。",
"dryModelHubEngine": "将安装或刷新 Avibe 固定的 Model Hub 引擎(CPA)版本。",
"dryGitRuntime": "将安装或刷新清单固定的 Git Runtime。",
"dryShowRuntime": "当清单固定的 Show Runtime 归档缺失或无效时准备它。",