Spec: Feature Add-on Packs — fetch, verify and load a feature's libraries in a frozen install¶
| Field | Value |
|---|---|
| ID | spec-feature-addon-packs |
| Status | Proposed |
| Date | 2026-10-20 |
| Decision record | ADR-028 |
| Related | ADR-019 (egress), ADR-018 (price first, no plug-ins), ADR-016 (dependency budget), ADR-027 (one-click Windows update, unmerged branch integ/wave3-2026-10-20) |
| Modules | new src/yazses/packs/ (pure core + orchestration), new PackRuntime Protocol in platform/base.py, platform/windows/packs.py, packaging/windows/rthook_yazses_packs.py, scripts/build-packs.py, packaging/packs/packs.toml |
Goal¶
When a user turns on a heavy feature in a frozen Windows install, YazSes shows the price, downloads that feature's add-on pack from the running version's GitHub release, verifies it against the hash built into the installed app, installs it per user and loads it on the next start. The base installer does not change.
Non-goals¶
- Third-party plug-ins. ADR-018 §3 stands. Only packs listed in the embedded index of the running build can be installed or loaded.
- Models. Packs carry libraries. Model weights keep their existing first-use fetch paths and egress rows.
- Background or automatic downloads, including after an update.
- Hot-mounting into a running daemon. Mounting happens at process start.
- MSIX, macOS
.app, snap and flatpak in Phases 0–2 (see ADR-028 §8). - In-app Sigstore/SLSA verification (rejected for now, ADR-028 §3).
Module list¶
The house split applies: pure modules with no I/O beside thin backends that are injected.
| Module | Kind | Responsibility |
|---|---|---|
packs/manifest.py | pure | Parse and validate pack.json, RECORD.json and the index (format: 1). Return typed dataclasses or a ManifestError with a user sentence. Never raise anything else. |
packs/abi.py | pure | BaseIdentity (build id, Python cache tag and patch version, platform, arch, app version), read from the embedded index plus sys facts that are passed in. match(pack, base, index_entry) -> Match returns ok, stale or refused, with one reason per field. |
packs/layout.py | pure | The paths below data_dir/packs, short components, and the 140-character budget. build_dir(build_id) uses the first 12 hex digits plus a collision guard read from state.json. |
packs/archive.py | pure | Zip member validation (names, kinds, counts, sizes, ratio) over a list of (name, size, compressed, is_dir, external_attr) tuples, so no real archive is needed in tests. check_tree(record, stat_fn). |
packs/catalog.py | pure | Feature slug to pack name, derived from _FEATURE_DEPS and the extras in pyproject.toml, plus the packs.toml decisions (pack, bundled, no-windows-wheel, unwired, deferred). |
packs/state.py | pure | The per-feature state machine in ADR-028 §5 and the state.json schema. Inputs: catalogue, index, installed trees, config. Output: one PackStatus per feature. |
packs/policy.py | pure | Disk-space arithmetic, the size-proportional deadline, the PACK_MAX_BYTES ceiling, GC and rollback choices (keep the current build, keep the previous build until started-ok, delete the rest), and the quarantine-or-stale decision. |
packs/fetch.py | I/O, egress | Builds the two URLs (SHA256SUMS.txt and the pack) for tag v<running version>, then calls ADR-027's fetch_checksums, expected_sha256 and download_verified. It is the only module that starts a pack download, and the FETCH_VIA entry in the egress test. |
packs/install.py | orchestration | The install transaction (ADR-028 §6) with injected fetch, extract, probe, replace and clock. Returns InstallResult(ok, title, message, steps, log_file). It never raises to the UI. |
packs/mount.py | pure decision + backend call | plan_mount(base, installed, env, elevated) -> MountPlan (paths to append, native dirs, quarantines). apply(plan, runtime). |
packs/probe.py | CLI-side | yazses packs probe <name> [--staged <dir>] mounts one tree and imports entry_modules. Exit 0, or a non-zero code naming the module that failed. |
platform/base.py | Protocol | PackRuntime: supported() -> bool, is_elevated() -> bool, add_native_dir(path) -> object (a handle that is kept alive), embedded_index_path() -> Path \| None. |
platform/windows/packs.py | backend | os.add_dll_directory, a token-elevation check (GetTokenInformation(TokenElevation) via pywin32, already a base dependency), and Path(sys._MEIPASS) / "yazses-packs-index.json". Registered in platform/factory.py. |
platform/{linux,macos}/… | backend | supported() -> False until their phase. |
packaging/windows/rthook_yazses_packs.py | runtime hook | Three lines: import, call mount.mount_at_startup(), swallow every exception. |
cli.py | surface (L3) | yazses packs [list] / install / remove / verify / path / probe / clean. features enable integration. |
tray/…, settingsui/controller.py | surface | States and actions from packs/state.py. Progress and cancel go through install.py callbacks. |
cameraperm/matrix.py | data | PackageProfile.can_add_packs. |
system/deps.py | integration | fixed_payload_reason returns None when the profile can add packs and the index has the feature's pack. |
scripts/build-packs.py | build | ADR-028 §7. Stdlib plus uv only, so it runs on the Windows runner without new dependencies. |
packaging/packs/packs.toml | build data | Per-extra decision, entry modules, approved_large, shared_with. |
A rule for every module above: nothing under packs/ branches on sys.platform. The OS facts come through PackRuntime (AGENTS.md rule 6).
On-disk layout (Windows)¶
%LOCALAPPDATA%\yazses\packs\
state.json installed packs per build, last results, started-ok
b-<12hex>\<name>\ one tree per pack per base build
COMPLETE written last
pack.json RECORD.json site\ stdlib\ LICENSES\
staging\<name>.<rand>\ extraction in progress; deleted on any failure
downloads\<asset>.part ADR-027 download_verified's bounded .part file
quarantine\<name>-<UTC>\ + reason.txt
<name>.lock O_CREAT|O_EXCL single-flight; stale after 2 h
Phases¶
Phase 0: spike on the Windows runner (no user-visible change)¶
The goal is to settle ADR-028's open risks with evidence before any surface is built.
- A throwaway workflow (
workflow_dispatchonly) builds the base as today, then builds theparakeetanddiarizationpacks with a first version ofscripts/build-packs.py, and runsyazses-cli.exe --cli packs probefor each, using a hand-written mount in a test entry point. - Record and decide:
- whether appending to
sys.pathimports pack modules in the frozen app (expected yes, per PyInstaller's bootstrap order); - stdlib gaps hit by each pack's imports, and whether the
stdlib/supplement is needed; importlib.metadatalookups against base distributions;- pruned submodules of base packages (
onnxruntime,huggingface_hub,numpy); - the DLL-basename collision report for
sherpa-onnx-coreagainst the base'sonnxruntime; - Windows pack sizes, which replace the Linux figures in ADR-028's table.
Acceptance:
- A written result, recorded in the ADR's Revision section, with the run id.
- A decided list of permitted base changes: metadata-only and/or
collect_submodulesfor named base distributions, each with its measured size cost. - If the collision is real, a decision for
diarization: a shared ONNX Runtime, an out-of-process route, or deferral.
Phase 1: mechanism + parakeet and diarization packs, Inno .exe only¶
Changed by ADR-028 Q1 (answered 2026-10-21):
parakeetis bundled into the frozen base instead of packed, so Phase 1 ships one pack,diarization. Criteria below that nameparakeetorstt-parakeetapply todiarizationanddiarize; on a pack-capable installstt-parakeetneeds no add-on, only its model download.
Build:
scripts/build-packs.pyandpacks.tomlwith the two packs.build-windows.ymlsteps between PyInstaller and Inno (ADR-028 §7, steps 1–5).- Provenance attestation with
subject-path: dist/packs/*, and the…-packs.intoto.jsonlasset. checksums.yml: glob gains*.yazpackand*-packs.json, and the "prove" regex gains them too.scripts/verify-release-assets.pyARTIFACT_SUFFIXESgains.yazpack.release-complete.ymlchecks that every pack in the published index is attached and listed inSHA256SUMS.txt. The list is read from the index, not written by hand.- The runtime hook in
packaging/windows/yazses.spec.
Runtime:
- Every pure module,
packs/fetch.py,install.py,mount.pyandprobe.py, the WindowsPackRuntime,PackageProfile.can_add_packs(true forwindows-exeonly), andPACK_INSTALL_METHODS = {"windows-installer"}. winget rides with it (ADR-027: it cannot be told apart). - Surfaces:
- CLI:
yazses packs,install,remove,verify,path,probe,clean, plus thefeatures enableprompt with size,--yes, Ctrl-C cancel and the--no-installmessage. - Tray: Download & enable, progress balloons, Cancel menu item, and the post-update re-download notification.
- Settings: per-feature button, progress bar, Cancel, and the Add-ons section with location, size, Open folder and Remove unused.
[UninstallDelete]for{localappdata}\yazses\packsininstaller.iss.
Egress:
- The ADR-019 row and Class A recount.
- The fourth scan (
FETCH_VIA), the user-initiated closure test, and the captured-Requesttest. docs/privacy-statement.mdsentence;tests/test_docs_network_claims_are_complete.pyextended.
Docs:
CHANGELOG.md[Unreleased].- Regenerated
docs/cli-reference.mdanddocs/command-index.md(make docs,make man). - A user page
docs/addons.md: what an add-on is, where it lives, how to remove it, and manual download. docs/install-cost.mdrows for Windows.design/architecture.md(new module and the new invariant: "no stale pack is ever loaded").
Acceptance criteria:
- On a release build, the base-manifest invariance check passes. The
_internalDLL set and the distribution set equal those of the previous release, apart from the Phase 0 permitted changes. SHA256SUMS.txtlists both packs and the index.gh attestation verifysucceeds for each pack with--signer-workflow MSKazemi/yazses/.github/workflows/build-windows.yml.- The frozen probe passes on the runner for both packs, or the job fails and the release gets no packs. It never publishes a pack that did not probe.
- Enabling
stt-parakeetin a per-user.exeinstall shows exact sizes. A click downloads, verifies, probes and installs the pack, then writes config, then restarts the daemon. Parakeet then transcribes.yazses doctorshows the pack asok. - A corrupted archive (one byte flipped in the cache), a wrong
SHA256SUMS.txtline, a pack from another build id, a truncated download, a cancelled download and a full disk each end with nothing installed, config unchanged and an actionable message. - After a one-click update (ADR-027) to a build with a new id, the old pack is not loaded. The feature reads waiting for add-on, and one click re-downloads it. After the new build's first
started-ok, the old build's tree is removed. If the update fails and the old version relaunches, its packs still load. - Deleting one DLL from an installed pack shows damaged — reinstall at the next import attempt. The tree is in
quarantine\with a reason, and Reinstall restores the feature. - With
YAZSES_NO_PACKS=1, YazSes starts and every pack-backed feature reads waiting for add-on. - Every pure-module test runs in the ordinary offline suite.
ruffandpytestare green andmypy srcreports no issues.
Phase 2: the remaining qualifying packs, Chocolatey, Scoop, offline install¶
packs.tomladds whichever ofgaze,tts,prosody,denoiseandmoonshinepass the licence gate (ADR-028 Q7, answered: permissive and LGPL pass; GPL needs a recorded owner approval and aSOURCE.md; an unknown licence fails).chineseis not among them: ADR-028 Q1 bundled it, withparakeet, into the frozen base.PACK_INSTALL_METHODSaddschocoandscooponce their checklist items pass.yazses packs install --from <file>(ADR-028 Q5, answered yes): the file name must equal the expected asset name and its SHA-256 must equal the embedded index entry. No network.cancelandReleaseAssetfrom the ADR-028 §4a follow-up refactor, if it has landed. Otherwise Phase 1's coarse cancel (raising fromprogress) is documented as a known limit.
Acceptance:
- Each new pack meets Phase 1 criteria 1–7.
gaze's pack loads OpenCV and MediaPipe fromnative_dirs, and the camera matrix,doctorandfeatures enableagree on every row (EYE-PERM-001).
Phase 3: large packs and other channels (each needs an owner decision)¶
- Not
voiceprint: ADR-028 Q2 answered no torch packs. It stays PyPI-only; the route forward is an ONNX speaker-embedding backend riding on thediarizationpack. - MSIX, after the spike in ADR-028 §8 on
AddDllDirectoryinside a packaged process and DLL loading from virtualised AppData, and after the Store-policy question. - The macOS
.app, in an ADR-028 addendum.
Acceptance: whatever the deciding addendum defines. None of it is implied by this spec.
Contracts¶
Index (YazSes-<v>-windows-<arch>-packs.json, also _internal/yazses-packs-index.json)¶
{
"format": 1,
"app_version": "2.44.0",
"base_build_id": "sha256:…",
"python": {"cache_tag": "cpython-312", "version": "3.12.9", "abi": "cp312"},
"platform": "win-amd64",
"arch": "x64",
"packs": [
{"name": "parakeet", "asset": "YazSes-2.44.0-windows-x64-pack-parakeet.yazpack",
"sha256": "…", "size": 312345, "unpacked_bytes": 1234567, "files": 210,
"features": ["stt-parakeet"]}
]
}
Rules:
- Unknown
format: refuse every pack, and say "this add-on index needs a newer YazSes". - Unknown keys are ignored. Missing required keys: refuse.
assetmust equalYazSes-<app_version>-<platform os>-<arch>-pack-<name>.yazpack, re-derived and compared rather than trusted.
features enable in a pack-capable install¶
- The unwired and experimental refusals stay as they are.
- If
_missing_feature_deps(feat)is empty, the existing path runs. - Otherwise, look up the catalogue:
- no pack for this build: the existing
fixed_payload_reasonmessage, reworded for the reason (no-windows-wheel,deferred); - pack stale or absent: price, confirm,
install.py; on success write config and restart; on failure write nothing.
Error semantics¶
Every user-facing entry point returns a result object, as ADR-027 does. Exceptions are for programming errors only. Every message names the next step.
Tests¶
Offline, in tests/:
test_packs_manifest.py: valid, unknown format, missing keys, wrong types, the asset name re-derivation.test_packs_abi.py: every field mismatch yields its own reason; equal build id with a different Python is still refused (defence in depth);staleversusrefused.test_packs_archive.py:../x,C:\x,\\server\share\x, an absolute path, a symlink attribute, a name over budget, count or size different from the manifest, ratio over the cap, a duplicate name, case-insensitive duplicates (A.pyanda.py).test_packs_layout.py: path budget at the worst-case%LOCALAPPDATA%length; build-dir prefix collision.test_packs_state.py: every state in ADR-028 §5 from fixtures; waiting for add-on never reads ason.test_packs_policy.py: disk-space math, deadline, GC and rollback, quarantine versus stale.test_packs_catalog.py: every wired_FEATURE_DEPSslug has apacks.tomldecision; everypackextra exists inpyproject.toml; nopackrow for an unwired slug. It fails on an empty catalogue (guard the guard).test_packs_install.py: the transaction with fakes. A failure injected at each step leaves no staging dir, no download and no config write. Single-flight lock, cancel.test_packs_mount.py: with a fakePackRuntime: appended (never prepended) order, handles retained, elevated means no mount,YAZSES_NO_PACKSmeans no mount, a missingCOMPLETEmeans no mount, and an exception inside the plan never propagates out ofmount_at_startup.test_packs_egress.py: the capturedRequestobjects (URLs and exact headers). Noapi.github.com.test_egress_inventory.py: theFETCH_VIAscan (equality in both directions, fails on an empty scan) and the closure test (daemon, watcher and runtime hook cannot reachpacks.fetchorpacks.install).test_build_packs.py: collision checks on synthetic--targettrees (module, DLL with equal or different bytes, distribution overlap),.pthhandling, deterministic zip (two runs give equal bytes), path budget.test_checksums_cover_packs.py:checksums.yml's glob and prove regex, andverify-release-assets.py, cover.yazpackand-packs.json. Derived from the asset namesbuild-packs.pyproduces, not from a second hand-written list.test_frozen_bundles_ship_the_gui.py/test_windows_build_architectures.py: extended so the runtime hook is in the spec andbuild-windows.ps1still syncs only--extra desktop.
On the Windows CI runner: the frozen probe per pack and the base-manifest invariance check, both in build-windows.yml, failing the job.
Manual Windows checklist (definition of done for the first release that carries packs):
- Per-user
.exe: enable Parakeet from the tray. Size shown → download → balloon → restart → dictation uses Parakeet. Then repeat from Settings and fromyazses features enable stt-parakeet. - Cancel at about 50 %: no
.part, no config change. - Unplug the network after confirming: an actionable message, and nothing changed.
- Flip a byte in
downloads\*.partduring the download: mismatch, deleted, nothing installed. - Delete one DLL from the installed diarization pack: damaged at the next use, the tree is quarantined, Reinstall works.
- One-click update (ADR-027) to the next version: the old pack is not loaded, one click re-downloads it, and the old tree is gone after the first good start. Force a failed update: the old version relaunches with its packs.
- A user name with a space, an apostrophe and a non-ASCII letter: every path survives.
- Microsoft Defender with real-time protection: note first-load time and any quarantine.
- Smart App Control (evaluation and enforce): note whether pack DLLs are blocked. Record it in the ADR either way.
- All-users install: packs install per user and load unelevated. Run
yazseselevated: no pack is mounted and the features say why. YAZSES_NO_PACKS=1: starts clean.- Uninstall (per-user):
packs\removed; config and models follow the current policy. - winget-installed copy: identical behaviour to item 1.
Live smoke evidence¶
Filled in by the Phase 0 spike and the Phase 1 checklist: run ids, Windows build numbers and measured sizes.
- 2026-10-21,
packs-spike.ymlrun 39631811305 (windows-latest, main c946e71e), packdiarization(sherpa-onnx 1.13.8): probes (a)–(d) PASS; the boundonnxruntime.dllwas the base's_internal\onnxruntime\capi\onnxruntime.dll, onnxruntime 1.28.0, and an ONNX Runtime session ran. The bind row's FAIL was a probe path-comparison bug, fixed afterwards (see Implementation status). Pack and installer sizes on Windows: not yet recorded. - 2026-10-21,
packs-spike.ymlrun 39648862078 (windows-latest, main 0fe86633, after the bind-check fix): all 8 probes PASS fordiarization, including (d) bind: the onlyonnxruntime.dllloaded is the base's_internal\onnxruntime\capi\onnxruntime.dll. Phase 0 is proven on Windows. The pack is still not released (licence: see item 14).
Implementation status¶
First Phase 0 spike on Windows (2026-10-21, run 39631811305 on main c946e71e)¶
packs-spike.yml ran the frozen app on windows-latest with the diarization pack (sherpa-onnx 1.13.8) mounted. Every risk the ADR called unmeasured passed: the probe ran inside the frozen app (sys.frozen, _MEIPASS); a sys.path append made the pack importable; (a) the 7 stdlib modules the pack references import; (b) importlib.metadata sees sherpa_onnx and sherpa-onnx-core 1.13.8; © no pruned base submodule is referenced; (d) no DLL collision remains (sherpa's onnxruntime.dll dropped, 1 bound to the base). The bind row reported FAIL although its own detail shows the bind is right: the only onnxruntime.dll loaded was the base's _internal\onnxruntime\capi\onnxruntime.dll, onnxruntime 1.28.0, and an ONNX Runtime session ran. The hook had recorded the preload request as a relative path and the verdict compared it with the loader's absolute one. Fixed (branch fix/spike-bind-abspath): the hook records the absolute path, and bind_verdict accepts a relative expected path that ends the loaded one on a directory boundary. Tests reproduce this run's exact paths. Not yet re-run on Windows after the fix, and diarization is still withheld at release by the Q7 licence gate until the owner signs its two licence entries.
Build side, phases 0–1 (2026-10-21)¶
Landed: scripts/build-packs.py (pure logic plus a CLI), packaging/packs/packs.toml, the pack steps in scripts/build-windows.ps1, the pack attestation and attachment in build-windows.yml, .yazpack and -packs.json coverage in checksums.yml, verify-release-assets.py and verify-provenance.py, an index-driven check in release-complete.yml, and the Phase 0 spike (.github/workflows/packs-spike.yml with packaging/packs/spike/rthook_pack_spike.py). Tests: tests/test_build_packs.py and tests/test_checksums_cover_packs.py.
Not landed (runtime side, a separate change): everything under src/yazses/packs/, PackRuntime, packaging/windows/rthook_yazses_packs.py, the packs CLI and [UninstallDelete]. The build talks to that work only through the formats below and the probe command.
Not yet run: neither the spike nor a release build has run on a hosted Windows runner. The Live smoke evidence section is still empty. A Linux dry run on a developer machine, using a fake bundle and Linux wheels, produced parakeet at 4.08 MB archived (7.27 MB unpacked) and diarization at 15.0 MB (44.7 MB). These figures are not Windows sizes; the spike replaces them. (parakeet is no longer a pack; see the answers below.)
Where the spec was open, the build chose the following. The runtime should read the formats the same way.
- Counts.
filesandunpacked_bytes, inpack.jsonand in the index, count every member of the ZIP,pack.jsonandRECORD.jsonincluded.pack.jsonis computed to a fixed point, because its own size depends on those numbers. An extractor can therefore compare the entry count and the total uncompressed size against them directly. RECORD.jsonhas the form{"format": 1, "files": [{"path", "size", "sha256"}]}. It lists every member exceptRECORD.jsonandpack.json. Paths are POSIX and relative to the pack root.- Archive shape. The ZIP holds regular files only (Unix mode
0o100644), with no directory entries. Entries are sorted, carry the timestamp 1980-01-01 and use DEFLATE level 9. A member whose DEFLATE ratio would exceed 100:1 is STORED, so a per-member ratio cap of 100 or more never refuses a genuine pack. path_entriesis a newpack.jsonkey, a list of pack-root-relative paths taken from.pthlines that only add a path. The.pthfile itself is removed. The loader appends these aftersite/. A.pththat runsimportcode fails the build. Both phase 1 packs have an empty list.native_dirslists pack-root-relative directories that still hold a.dllafter any DLL byte-identical to the base's, or bound to the base's (item 16), has been dropped.- The OS word in asset names.
win-*becomeswindowsandmacosx-*becomesmacos. Theplatformfield holds the build venv'ssysconfig.get_platform()(win-amd64).pythonis{cache_tag: sys.implementation.cache_tag, version: platform.python_version(), abi: "cp3XY"}. - Base manifest.
base-manifest.jsonis canonical JSON (sorted keys, no whitespace):{"format": 1, "files": [{"path", "size", "sha256"}]}. It covers every file indist/YazSes/except_internal/yazses-packs-index.json.base_build_idissha256:followed by the hex digest of those bytes. The manifest is kept in the build's work directory and is not a release asset. - Index bytes. The embedded index and the release asset are byte-identical: UTF-8, sorted keys, 2-space indent, trailing newline. The index lists only packs that passed every check and the frozen probe. When none passed, no index is embedded or published.
- The same DLL in two packs. When two packs carry byte-identical copies of a DLL, both packs keep it, because either pack may be installed alone. The "dropped" rule in ADR-028 §1 applies only to copies identical to the base's. Different bytes still fail the build.
- The probe command the build calls:
yazses-cli.exe --cli packs probe <name> --staged <dir>.<dir>is the extracted pack root, the folder holdingpack.jsonandsite/. During the probe,LOCALAPPDATA,APPDATA,USERPROFILE,HOMEandXDG_*point at a sandbox, a provisional index of every built pack is embedded, and the timeout is 120 s. Exit 0 publishes the pack. Until the runtime side ships this command, every pack is withheld, which keeps the rule never to publish an unprobed pack. - Withhold, not fail (acceptance 3). A pack that fails a check or its probe is withheld: no index entry, no asset, a warning annotation and a row in the job summary. The job still ships the base installer. The job fails only if the base bundle changed during pack production (the step 4 invariance guard).
build-packs.py build --strictis available for a release that should fail instead. packs.tomlschema.format = 1plus one[extras.<name>]table per pyproject extra. Each table has adecision(pack,bundled,no-windows-wheel,unwiredordeferred), and areasonfor anything that is not a pack. A pack also hasfeatures,entry_modulesand optionallyapproved_large/approved_byandbind_to_base/bind_reason(item 16). A non-pack entry carryingfeatures,entry_modulesorbind_to_basefails validation. The large threshold is 500 MiB.shared_withis not used yet.- Provenance. One
actions/attest-build-provenancestep attests the packs and the index through a multi-linesubject-path: |.verify-provenance.pynow reads such blocks, so.yazpackand.jsonbecame attested suffixes. Only-packs.jsonassets are inSHA256SUMS.txt, so no other JSON file is affected. - Licences. Each distribution's licence files go to
LICENSES/<dist>/. The Q7 licence gate (owner answer, 2026-10-21) isscripts/pack_licences.py, called once per pack frombuild_oneafter the wheels are installed. It classes each distribution permissive / LGPL (LGPL, MPL-2.0) / GPL (GPL, AGPL) / UNKNOWN fromLicense-Expression(SPDX;OR→ most permissive,AND→ strictest,WITHonly a known exception, which can relax GPL to LGPL), otherwise fromLicenseplus theLicense ::classifiers, the stricter of the two. A pack is withheld on UNKNOWN, on a distribution with no licence file in its dist-info (unless a signed[[licence_text]]supplies one, below), on LGPL/GPL without an upstream URL in METADATA, and on GPL without an[[approval]]inpackaging/packs/licence-approvals.tomlnaming that pack, distribution, exact version and licence. A[[clarification]]records a person's reading of a free-text licence as an SPDX expression for one exact version. An entry that no longer matches is reported as stale and approves nothing. A copyleft pack carriesLICENSES/SOURCE.md(LICENSES/, not the root, because the runtime'sarchive.TOP_LEVELallows only five root names). The result islicence_gatein the build report andlicences(name,version,licence,classper distribution) inpack.json, which the runtime ignores. Under--skip-probe(the spike) a failure is recorded, not withheld, as for DLL conflicts.- Two differences from the ADR text. Approvals live in
licence-approvals.toml, not as apacks.tomlfield, so the per-version record and its staleness check have their own schema. The gate is the standard library only, notpip-licenses, and has no ScanCode step, so it cannot see a GPL binary vendored in a wheel that declares MIT. - Verified:
tests/test_pack_licences.py, synthetic METADATA only, with each rule shown to fail its tests when removed. Not verified: a run on real Windows wheels. Read offline from the Linux 1.13.8 wheels in a local uv cache:sherpa-onnx-corehas no licence file andsherpa-onnxdeclares free text (Apache licensed, as found in the LICENSE file), so the first real build withholdsdiarizationon two counts.parakeet'sonnx-asr0.12.0 passes (License-Expression: MIT).espeakng-loaderwas not in the cache, so the ADR's finding for it is not re-checked here. - A reviewed licence text for a distribution that ships none (
[[licence_text]], 2026-10-21). Fields:pack,dist,version,spdx,source_url,file(relative to the approvals file, underlicence-texts/, no..),sha256(of the file's bytes, lower-case hex),reviewed_by,date. The build copies the file toLICENSES/<dist>/<file name>only when pack, dist and exact version match,spdxequals the declared licence (legacy spellings such asApache 2.0mapped; a clarification's licence counts as declared), the file exists insidelicence-texts/(a symlink out reads as missing) and hashes tosha256, andreviewed_byis not empty. Otherwise the pack keeps its "no licence file" problem, with the reason appended, and the entry is reported instale_approvals: another version, a wrong hash, a missing file, another licence. An entry for a distribution that ships its own licence file is reported as redundant and never overrides that file.build_onerefuses a vendored member that would overwrite an existing one. The build report lists the copied members asvendored_licencesand the entry under the distribution'svendored_licence..gitattributesmarkspackaging/packs/licence-texts/**-text, because Git for Windows would otherwise check the text out with CRLF and change its hash. - Prepared but unsigned. A
[[clarification]]or[[licence_text]]whosereviewed_byis empty (datemay be empty too) parses cleanly, is listed in the build report'sawaiting_review, and honours nothing. An[[approval]]cannot be unsigned: an emptyapproved_byis an error. Two such entries are committed fordiarization, both withreviewed_by = "": a clarification ofsherpa-onnx1.13.8 asApache-2.0, and a licence text forsherpa-onnx-core1.13.8 atpackaging/packs/licence-texts/sherpa-onnx-core/1.13.8/LICENSE. That text is the repository'sLICENSEat tagv1.13.8(a lightweight tag on commit11afbd009a7f8c08f4bcf2fc1b265d0df4670fbf, whoseCMakeLists.txtsetsSHERPA_ONNX_VERSION "1.13.8"), fetched 2026-10-21; it is byte-identical (11,358 bytes, SHA-256cfc7749b…3d30) tohttps://www.apache.org/licenses/LICENSE-2.0.txtand to thelicenses/LICENSEin thesherpa-onnx1.13.8 Linux wheel.tests/test_pack_licences.pyholds both entries inert (DIARIZATION_LICENCES_SIGNED = False) and rehearses on a copy that filling in the two fields is all that is left. - What the owner does to release
diarization(licence side only). (1) Readpackaging/packs/licence-texts/sherpa-onnx-core/1.13.8/LICENSEand compare it with itssource_url; read theLICENSEin thesherpa-onnx1.13.8 wheel's dist-info. (2) Inpackaging/packs/licence-approvals.toml, setreviewed_byto your full name anddateto the day, in both diarization entries. (3) Intests/test_pack_licences.py, setDIARIZATION_LICENCES_SIGNED = Truein the same commit. (4) Runuv run python -m pytest tests/test_pack_licences.py. A coding agent does none of (1)–(3). The licence gate is not the only gate: the pack still needs the bind probe (item 16) and a real Windows build, and the Windows wheels' METADATA has not been read, so the first real build may still report something the Linux wheels did not show. - Do not sign these as Apache-2.0 (finding, 2026-10-21). The sherpa-onnx 1.13.8 binaries embed espeak-ng, which is GPL-3.0-or-later:
stringson the Linux wheels finds 137espeaksymbols inlibsherpa-onnx-c-api.soand 98 in_sherpa_onnx…so(espeak_Initialize,espeak_TextToPhonemesWithTerminator,espeak_CompileDictionary;.constprop/.israsuffixes mean statically compiled in, not loaded). sherpa-onnx builds TTS in by default, so the Windows wheels very likely do too (not checked). The declared licence is therefore incomplete, and the gate cannot see it because it reads declared metadata only. Redistributing these binaries in a Windows add-on means GPL-3.0 obligations: an[[approval]]for GPL-3.0-or-later plus a source offer inSOURCE.md, or a sherpa-onnx build without TTS. Owner decision 2026-10-21: leave both entries unsigned;diarizationstays PyPI-only (pip/uv), which is not redistribution by YazSes. This is a technical finding, not legal advice.
- Two differences from the ADR text. Approvals live in
- No
stdlib/supplement yet. The spike measures the stdlib gaps first (Phase 0 item 2). bind_to_base: a reviewed DLL exception (ADR-028 finding on sherpa-onnx-core).packs.tomlmay list bare DLL basenames underbind_to_basefor a pack, with abind_reason. When the base ships a DLL of a listed basename, every copy of it in the pack is dropped although the bytes differ (sherpa-onnx-core 1.13.8 ships an unsigned onnxruntime 1.28.2 insherpa_onnx/lib/and again under.data/data/Scripts/; the base has Microsoft's signed 1.28.0). The build report records the dropped paths (dll_bound_to_base) and any listed name that collided with nothing (dll_bind_unused, a warning), andpack.jsongainsbind_to_base: the sorted, lower-case basenames the pack relies on the base for, always present and usually empty. The runtime must load the base's copy of each before it imports the pack's entry modules. Every other differing collision still withholds the pack; the byte-identical drop (item 5) is unchanged.- The base is the
bundledextras.build-packs.pymeasures the base from the extraspacks.tomldecidesbundled(todaydesktop,overlay,parakeet,chinese), not from a hard-codeddesktop, and subtracts their closure from every pack. If the build venv lacks a bundled extra's distribution, every pack is withheld and the base still ships.build-packs.py validate(andtests/test_build_packs.py) holdsscripts/build-windows.ps1'suv syncextras, and the spike workflow's, to thebundledset in both directions. A bundled extra is never built as a pack.
Owner answers (ADR-028, "Owner questions: answered 2026-10-21") and their build-side effect.
- Q1, bundle the tiny pure-Python extras: yes.
parakeet(onnx-asr, MIT, ~4 MB wheel) andchinese(opencc-python-reimplemented, Apache-2.0, ~0.5 MB) arebundled.scripts/build-windows.ps1runsuv sync --no-dev --extra desktop --extra parakeet --extra chinese, andpackaging/windows/yazses.specaddscopy_metadata("onnx-asr"),collect_data_files("onnx_asr")and its submodules, because onnx-asr reads its own version throughimportlib.metadataat import and its preprocessor.onnxfiles throughimportlib.resources(opencc is covered by pyinstaller-hooks-contrib'shook-opencc). Both files are therefore part of the base manifest and itsbase_build_id. Phase 1 builds one pack,diarization. The PyPI base is unchanged. - Q2, torch packs: no.
voiceprintstaysdeferred, with that reason. - Q7, licence gate: yes, three rules (item 14).
ttsandprosodystaydeferredwith the GPL reason. - Finding M1, sherpa's onnxruntime.dll:
diarizationbindsonnxruntime.dllto the base (item 16).packs-spike.ymlprobe (d) now proves or refutes the binding: with the base's copy preloaded by full path,import sherpa_onnxmust leave exactly oneonnxruntime.dllloaded, from the base;onnxruntime.__version__must equal the version the build venv froze (from the build report, 1.28.0 today); and both an onnxruntime session and sherpa-onnx's own silero VAD session must build and run on a pinnedsilero_vad.onnx(SHA-256 checked in the workflow). It prints onePASS:orFAIL:line carrying the loaded path and the version. If it fails,diarizationtakes ADR-028 §1's out-of-process route. - Q3–Q6 and Q8 are runtime, installer or account matters; the build side does not change for them.
Not verified. None of the above has run on Windows: not the frozen bundle with onnx-asr and opencc inside it, not its size, and not the bind probe. The +~4.5 MB installer figure is ADR-028's wheel measurement, not a built installer.
Spike limits. The spike's runtime hook imports json, pkgutil, ctypes and traceback, so PyInstaller collects those four into the spike base, and risk (a) cannot report them as missing. The spike builds with --skip-probe, which embeds and publishes nothing. The shipped spec never contains the spike hook, and a test enforces that.
Implementation status (runtime side)¶
Runtime side, phase 1 (2026-10-21, branch feat/addon-packs-runtime)¶
Landed. The pure core packs/manifest.py, abi.py, layout.py, archive.py, catalog.py, state.py and policy.py; the I/O halves packs/context.py (reads only), fetch.py (the one egress module), install.py (the transaction), mount.py and probe.py, plus packs/manage.py behind the CLI. PackRuntime in platform/base.py, platform/windows/packs.py, supported() -> False backends for Linux/BSD and macOS, and platform.factory.get_pack_runtime() / get_pack_paths(), which build no Platform so the hook stays light. packaging/windows/rthook_yazses_packs.py, registered in packaging/windows/yazses.spec (runtime_hooks; the build branch left that line untouched). PackageProfile.can_add_packs (true for windows-exe only) and policy.PACK_INSTALL_METHODS = {"windows-installer"}. CLI: features enable --yes, and yazses packs [list] / install / verify / remove / clean / path / probe. ADR-019 row, the fourth scan FETCH_VIA, the closure test, the computed Class A count and the captured Request test. ReleaseAsset is an additive alias in installer_update.py; nothing else there changed.
Formats: aligned with the build side's items 1–15. Checked on 2026-10-21 by building a pack with scripts/build-packs.py's own record_json, pack_json, pack_fields, write_deterministic_zip, build_index and index_bytes (from feat/addon-packs-build) and feeding it to parse_index, extract_archive and abi.match: accepted, ok. catalog.catalogue_problems reports nothing for the build branch's packs.toml.
- Counts include
pack.jsonandRECORD.json(item 1);RECORD.jsonlists the rest (2). - The per-member ratio cap is 200:1, above the build's 100:1 STORE threshold (3).
path_entriesis optional; mount and probe appendsite/, thenpath_entries, thenstdlib/(4).native_dirsmust sit undersite/orstdlib/(5).- The probe is
--cli packs probe <name> --staged <pack root>; exit codes: 0 ok, 3 refused tree, 4 stdlib gap, 5 missing metadata, 6 pruned base submodule, 7 native load failure (theonnxruntime.dllcollision case), 8 other import error, 9 anything else. The last stdout line isYAZSES-PROBE <kind> <module>: <sentence>(10). - The probe does not refuse an elevated process, unlike the mount and the install. It loads only the directory it is given; the install starts it from the user's unelevated process, and the Windows CI runner's account is an administrator.
Two limits stricter than the build's.
- Pack names: at most 16 characters (build: 40), so the quarantine path fits
MAX_PATHwith a 66-characterdata_dir(layout.budget_problems). A longer name makesparse_indexrefuse the whole index. Both phase 1 names fit; the build should cap at 16 as well. data_dirbudget: 66 characters (C:\Users\<20>.<15-char domain>\AppData\Local\yazses).
Conservative choices where an owner question is open. Q3: the re-download after an update waits for the user (yazses packs install, or features enable again); nothing fetches on its own. Q4: yazses packs remove --all exists; no per-user cleanup at login. Q5: no --from <file>; the failure messages name the asset and its URL, not a command that does not exist. Q6: the MSIX profile has can_add_packs = False. Chocolatey and Scoop are outside PACK_INSTALL_METHODS, so they keep the "install from PyPI" answer. Choosing differently means changing one constant or one profile field.
Not landed.
deps.fixed_payload_reasonis unchanged. ReturningNonethere for a pack-capable profile, as the module list says, would let the Settings, hands-free and language paths, which callinstall_blocked_reasonand then pip, try to run pip inside the frozen app. The pack branch is incli.pybefore that check, so onlyfeatures enableroutes to packs. The tray and Settings surfaces, and rewording the message forno-windows-wheel/deferred(the embedded index carries no reasons), are follow-ups.- The tray's
started-okmarker (state.mark_started_okexists, nothing calls it). Until it does,cleanand the post-install GC always keep the newest previous build. Landed with Q3 below (packs.refetch.mark_first_start). - A full
RECORD.jsoncheck triggered by anImportErrorat a lazy import site. Todayyazses packs verifyruns it and quarantines a damaged tree. [UninstallDelete]ininstaller.iss,docs/addons.md,docs/install-cost.mdrows.
Untested without Windows. os.add_dll_directory handles and DLL resolution; the token elevation probe; sys._MEIPASS and the yazses-cli.exe sibling path; that PyInstaller collects yazses.packs.* through the hook's import; CREATE_NO_WINDOW for the probe child; os.replace of a tree across %LOCALAPPDATA%; Defender or Smart App Control; and every item in the manual checklist above.
Uninstall and offline install, owner questions 4 and 5 (2026-10-21, branch feat/packs-uninstall-from)¶
This supersedes the Q4 and Q5 sentences under Conservative choices above, and the [UninstallDelete] part of Not landed.
Q4, landed.
installer.isshas[UninstallDelete] Type: filesandordirs; Name: "{localappdata}\yazses\packs"; Check: IsPerUserInstall, whereIsPerUserInstallisnot IsAdminInstallMode. Only the packs folder: config, logs and models beside it keep their policy.- Per-user installs only. In an all-users uninstall
{localappdata}is the elevated administrator's profile, so that uninstall deletes nothing there. ADR-028's answer says "the uninstaller removes the elevating user'spacks\"; this deliberately does less, because the administrator who elevates is usually not a user who installed packs, and the one who is gets the doctor row instead. Changing it means dropping theCheck. - The
Checkis right whichever moment Inno evaluates it (when it writes the uninstall log or when it uninstalls), because one registration has one install mode. Inno's documentation pages checked on 2026-10-21 do not say which moment it is. - Never on an upgrade.
[UninstallDelete]runs only from the uninstaller, and an in-place upgrade (ADR-027's one-click update included) never starts it.tests/test_packaging_windows.pyfails if[InstallDelete],[Run],[Files]or[Registry]names the packs folder, or if[Code]deletes a tree, names the folder or starts the uninstaller, and if any[UninstallDelete]entry naming a per-user folder lacks theCheck. yazses doctorhas an Add-ons row (doctor.packs_row, facts frompacks.manage.disk_use). WARN when the pack folder holds bytes this copy never loads (another build's packs, orstaging/downloads/quarantineleftovers). OK, as a statement, when the install is all-users (UpdateLauncher.install_scope() == "machine") and this user has packs. Both nameyazses packs remove --alland what it frees. No row without a pack folder, and nothing is called unused when the process cannot tell its own build (a source checkout sharing the data folder).docs/windows-install.mdUninstall says the same.
Q5, landed. yazses packs install --from <file> (packs.manage.install_from_file, additive; the name argument becomes optional when --from is given).
- The file name must equal one of this build's asset names exactly (
manage.entry_for_file); a wrong name is refused before the file is read, naming the accepted files, and the YazSes version when the name says another one. manage.file_fetcherstands in for the network fetch inside the unchangedinstall_packtransaction. It refuses a size mismatch fromstat, copies the file intodownloads\<asset>.part, and hashes the copy against the embedded index entry, so a file changed after a check cannot be the one extracted. On a mismatch it reads onlypack.jsonto say "made for a different build" when that is the reason. The user's own file is never deleted.- After the hash: member validation,
RECORD.json, the ABI match, the child-process probe and the atomic place, exactly as for a download. - No
SHA256SUMS.txtand no request of any kind.tests/test_packs_egress.py::test_an_offline_install_from_a_file_makes_no_requestruns a whole--frominstall through the captured opener and asserts zero requests;tests/test_packs_install_from_file.pyreplaces every network primitive with a failing one. fetch.manual_steps, which every failed download prints, now adds the--fromroute after the asset name and URL.
Not verified. installer.iss was not compiled (no ISCC on Linux); the uninstall on a real per-user and all-users install is manual checklist item 12, still open, plus the all-users case. install_scope() on a real all-users install is unit-tested only.
Runtime side: binding to the base's ONNX Runtime (ADR-028 M1, 2026-10-21, branch feat/packs-runtime-ort)¶
Why. sherpa-onnx-core 1.13.8's Windows wheel carries its own onnxruntime.dll (an unsigned 1.28.2 build) while the base carries Microsoft's signed 1.28.0 (measured fact M1 in ADR-028's answered questions). The build drops the pack's copy; the runtime must make sherpa_onnx use the base's copy, deterministically, and refuse otherwise.
The contract with the build side (pack.json, both optional, absent = empty):
bind_to_base: a list of bare DLL file names (no directory, no drive; compared case-insensitively; duplicates refused) the build dropped because the pack must use the base's own file of that name. Agreed with the build side, which writes the names in lower case (today["onnxruntime.dll"]) and ships no copy of a listed DLL.bind_min_versions: an object mapping some of those names to the lowest version of the base's copy the pack accepts, e.g.{"onnxruntime.dll": "1.28"}. A key not listed inbind_to_baserefuses the manifest. This field is the runtime side's proposal; the build side does not write it yet. Without it, any version of the base's copy binds and the version is only reported. That is safe today because a pack loads only into the one base build it names (base_build_id), and the build's frozen probe already checks that the base's copy is the version the base froze.
Landed.
packs/bind.py: the pure decisions and the binding. The base's copy is found by walking the frozen app's_internalfolder (sys._MEIPASS) and nowhere else. One copy is taken. Of several, the only one inside a package folder named after the DLL (onnxruntime/capi/onnxruntime.dll) is taken: it is the file the base's ownimport onnxruntimeloads, and the build's spike (spike_bind_request) preloads the same file. Any other set of copies is refused, not ranked. It is loaded by absolute path (ctypes.WinDLL, which passesLOAD_LIBRARY_SEARCH_DEFAULT_DIRS | LOAD_LIBRARY_SEARCH_DLL_LOAD_DIRfor a path), so the loader never searches for the name, and its module name is then in the loaded-module list that answers sherpa's import (DLL search order). The version comes from ONNX Runtime's own C entry point,OrtGetApiBase()->GetVersionString(). Afterwards every loaded module of that name (K32EnumProcessModules, as the spike's check (d) does) must be the base's file.- Lazy.
mount.applyputs aFirstUseBinderonsys.meta_pathfor each mounted pack that listsbind_to_base. Start-up loads nothing and walks nothing (onescandirof the pack'ssite/to learn its top-level names). The first import of one of the pack's modules binds, before the pack's own code runs; on success the finder removes itself. A binding pack in whosesite/no module name is found is not mounted (fail closed). The start-up path importspacks/bind.pyonly when such a pack is mounted. - Refusal has a named reason: the base does not contain the DLL; it contains several copies and not exactly one inside a package folder of that name; it does not load; its version is below
bind_min_versions; its version cannot be read while a minimum is stated; another file of that name is already loaded; the loaded list cannot be read. At first use it is anImportErrornaming the reason for every import of that pack, and an entry inmount.LAST.failed. The pack is not quarantined: the fault is the base's, not the pack's. - Probe.
yazses packs probebinds before importingentry_modulesand re-checks the loaded modules after. A refusal or a secondonnxruntime.dllappearing during the import isnative-load(exit 7). Success ends theYAZSES-PROBE okline withbound onnxruntime.dll -> <path> (version <v>), YazSes's own copy, so the install transaction and the release job record which ONNX Runtime the pack runs on. No exit code was added. - Verify.
yazses packs verifyprints one line per bound DLL (path and version, or the refusal) and exits 1 on a refusal without setting the pack aside. PackRuntimegainedbase_native_candidates,load_base_nativeandloaded_native_paths; the Linux/BSD and macOS backends answer "none" / "cannot tell", so a binding pack is refused there.- Out-of-process fallback (ADR-028 §1): not built.
bind.bind_mode()always returns"in-process";bind.OutOfProcessHostis the typed seam, with a TODO naming what would trigger it: the spike's check (d) showingsherpa_onnxfailing to import against the base's 1.28.0, or anyonnxruntime.dllloaded from a path other than the base's. Until then, a pack whose mode is not in-process is skipped at mount and refused by the probe.
Tests. tests/test_packs_bind.py (64 cases, through a fake runtime): field parsing, every refusal reason, the import ordering through the real import system, nothing loaded or walked at mount, the probe and verify output, the Windows folder walk and the OrtGetApiBase read through a ctypes stand-in. Each guard was mutated out and the suite went red.
Not verified (needs a Windows run). That sherpa_onnx's extension actually resolves to the base's preloaded onnxruntime.dll and works against 1.28.0; ctypes.WinDLL on the real _internal\onnxruntime\capi\onnxruntime.dll path; K32EnumProcessModules paths matching the walked path; OrtGetApiBase on Microsoft's build; how many onnxruntime.dll files the frozen base contains, and where. The spike's check (d) and the release job's frozen probe answer these.
Q3: add-ons across an update (2026-10-21, branch feat/packs-update-consent)¶
Landed, as the owner answered Q3 (ADR-028, Owner questions: answered 2026-10-21):
- Consent at the update question.
installer_update.confirmation_prompt(..., addons=)appends one sentence frominstaller_update.addons_note, e.g. "Your add-on (Diarization, 15 MB) will be downloaded again for the new version. If that download fails, Settings offers Install now." The names and sizes come from the running (old) build's embedded index and the trees intact under it (packs.refetch.addons_for_update). Dialog text only:Offer.reason, which rides a tray balloon, is unchanged, and so are theall_userskeyword andALL_USERS_NOTE. The Windows tray and the Settings window pass it;yazses updatein a terminal does not, and so records no consent. - The consent record. Once the hand-off has started (
HandoffResult.ok), the surface that asked writespacks/update-consent.json(format, oldbuild_id,from,to,packs,at) throughtray.updates.record_update_consent. - First start of the new version. The tray's entry point (
tray.app.run) startsstart_addon_refetch, a worker thread that waits 5 s (the daemon and the icon come first) and callstray.updates.refetch_after_update. Without a consent file it returns after onestat. Otherwisepacks.refetch.run_refetcherases the consent first (if it cannot, nothing is downloaded), thenplan_refetch(pure) picks the packs that are consented, recorded instate.jsonfor the old build, listed in the new build's own index and not already installed. A stale consent (over 7 days), an incapable or elevated process, or an unchanged build id (a failed update relaunched the old version) downloads nothing. Each pack goes throughpacks.manage.install(the existing verified transaction: no second downloader, no new ADR-019 row) with a freshly readstate.json, thenpacks.manage.verify. - Where the downloader is bound.
tray.updatesis in the daemon's static import closure (handsfree.probe→platform.factory→ the platform trays), so neither it norpacks.refetchimportspacks.manage:run_refetchtakesinstallandverifywith no default, and onlytray.app(the tray process's entry point, outside the daemon's closure) binds them. The first version of this branch bound them insidepacks.refetch, andtest_pack_downloads_are_user_initiated_onlyfailed on it, which is the guard doing its job. ADR-028 §4's "never at startup" still holds for the daemon, the watcher and the hook; this one start-time download runs in the tray process and only on the consent given in the update question. - Old build retired only after everything verified. On full success the new build is marked
started_okandpolicy.gc_plan(..., started_ok=True)deletes the other builds' trees. On a partial or failed run nothing of the old build is touched, the features read waiting for add-on, and the existing Install now (Settings) oryazses packs installis the one-click retry. The result is shown once, in a balloon under 255 characters (refetch.describe). - The
started_okmarker is now written. Nothing calledstate.mark_started_okbefore, so every previous build's packs stayed on disk untilyazses packs remove --all. The tray job now runs on every start of a frozen build that has astate.json(onestatotherwise), and a start with nothing to download -- no consent, a consent with nothing left to fetch, or a failed update that relaunched the old build -- is this build's first good start:refetch.mark_first_startmarks it and retires the other builds through the sameretire_old_builds(mark_started_ok+policy.gc_plan(started_ok=True)+state.remove_build). It does nothing in an incapable or elevated process, writes nostate.jsonfor someone who never had an add-on, and runs once per build. A start that downloaded and failed retires nothing; the next start, with nothing left to download, does. That old tree is not loadable by the new build, so only the rollback reason kept it, and a second start of the new build settles that.
Tests. tests/test_packs_refetch.py (prompt with and without packs, all_users unchanged; consent parse; the plan; consented / not consented / failed / partial / verify failure / raised install; at most once; an un-erasable consent; the old build kept until every tree verified; the tray question and consent wiring; the entry point binding the downloader and notifying once) and three cases in tests/test_settingsui_maintenance_panel.py. Each guard was shown red by a mutation that removes it.
Not verified. No run on Windows with a published pack: the balloon text on a real tray, the download after a real relaunch, and the timing of the tray's startup thread against a daemon that has not finished starting are untested. A balloon raised before pystray has shown the icon is dropped (the 5 s delay makes that unlikely, not impossible). A restart is still needed to load the new packs into the daemon that started before they arrived; the message says so.