feat(update): integrate managed installs and recoverable in-app updates (#6168)

Add owner-aware Stable and Preview updates with explicit consent, verified release plans, protected process handoff and bounded service recovery. Keep configuration and conversations separate from program rollback.

Include the compact About controls, Windows long-path support, native package recovery checks and optional macOS Dock lifecycle integration. Preserve documented guidance for installations owned by other managers.

This code integration does not publish packages, enable signing or advance the public update channel.

Co-authored-by: chengyongru <61816729+chengyongru@users.noreply.github.com>
This commit is contained in:
Xubin Renandchengyongru authored and GitHub committed 2026-10-21 19:16:56 +08:00
1 parent 76da55994b
commit fbb61a373f
216 files changed
+27948 -1084

No files matched your search

+121 -20
View File
@@ -141,7 +141,9 @@ jobs:
needs: changes
if: needs.changes.outputs.python_required == 'true'
runs-on: ${{ matrix.os }}
timeout-minutes: 20
# Windows runs real isolated update jobs before the complete compatibility
# suite; that suite was still progressing at the former 20-minute job cap.
timeout-minutes: ${{ matrix.os == 'windows-latest' && 30 || 20 }}
env:
PYTEST_ADDOPTS: "-o tmp_path_retention_policy=failed -p scripts.pytest_timing"
strategy:
@@ -152,22 +154,22 @@ jobs:
os: ubuntu-latest
python-version: "3.11"
coverage: false
# CLI command tests assert exact Rich terminal output; run them
# serially below so xdist cannot change terminal-width rendering.
pytest_args: "-n auto --dist loadfile --ignore=tests/cli/test_commands.py"
# Keep exact Rich output and real prompt_toolkit pipes in a fresh
# CLI process: long-lived workers can exceed select()'s fd limit.
pytest_args: "-n auto --dist loadfile --ignore=tests/cli/test_commands.py --ignore=tests/cli/test_cli_input.py --ignore=tests/cli/test_desktop_target.py --ignore=tests/cli/test_desktop_target_entrypoints.py"
- name: latest, 3.14 + coverage
os: ubuntu-latest
python-version: "3.14"
coverage: true
pytest_args: "-n auto --dist loadfile --ignore=tests/cli/test_commands.py"
pytest_args: "-n auto --dist loadfile --ignore=tests/cli/test_commands.py --ignore=tests/cli/test_cli_input.py --ignore=tests/cli/test_desktop_target.py --ignore=tests/cli/test_desktop_target_entrypoints.py"
- name: Windows, 3.14
os: windows-latest
python-version: "3.14"
coverage: false
# Real PowerShell, browser-handoff, and process-tree tests run
# serially so xdist workers do not compete for native processes.
# Keep threaded storage work bounded without adding another runner.
pytest_args: "-n 3 --dist loadfile --ignore=tests/cli/test_commands.py --ignore=tests/tools/test_exec_platform.py --ignore=tests/cli/test_wsl_browser.py"
# Process identities run serially; isolated update jobs use case-level
# scheduling below so one file cannot serialize all real venv work.
# Retain main's three-worker budget and the separate native-process job.
pytest_args: "-n 3 --dist loadfile --ignore=tests/cli/test_commands.py --ignore=tests/cli/test_cli_input.py --ignore=tests/cli/test_desktop_target.py --ignore=tests/cli/test_desktop_target_entrypoints.py --ignore=tests/tools/test_exec_platform.py --ignore=tests/cli/test_wsl_browser.py --ignore=tests/test_install_scripts.py --ignore=tests/test_update_jobs.py --ignore=tests/test_update_profiles.py"
steps:
- uses: actions/checkout@v4
@@ -200,6 +202,13 @@ jobs:
- name: Verify dependency consistency
run: uv pip check
- name: Install pipx for offline installer checks
if: runner.os == 'Linux'
shell: bash
run: |
uv tool install pipx==1.17.12
uv tool dir --bin >> "$GITHUB_PATH"
# Channel requirements live in manifests rather than uv.lock. Avoid a
# later uv run sync pruning the packages installed by the previous step.
- name: Lint with ruff
@@ -210,6 +219,27 @@ jobs:
if: matrix.coverage
run: uv run --no-sync basedpyright
- name: Check Windows update coordination before the full suite
if: runner.os == 'Windows'
run: >-
uv run --no-sync python -m pytest
tests/test_installation_lock.py
tests/test_update_profiles.py
tests/utils/test_helpers.py::test_atomic_record_reader_does_not_block_concurrent_replacement
tests/gateway/test_runtime.py::test_runtime_state_publish_keeps_existing_snapshot_readable
tests/gateway/test_runtime.py::test_runtime_state_reader_does_not_block_publish_while_decoding
-q --junitxml=test-results/coordination.xml --timing-report=test-results/coordination.json
# Each update job owns its venv, HOME, profile and lock directory. Preserve
# the real installation/restore checks, but avoid a loadfile straggler and
# disk contention with timing-sensitive runtime-registration checks.
- name: Run Windows isolated update jobs
if: runner.os == 'Windows'
run: >-
uv run --no-sync python -m pytest tests/test_update_jobs.py
-n 3 --dist load -vv --durations=25 --durations-min=1.0
--junitxml=test-results/update-jobs.xml --timing-report=test-results/update-jobs.json
- name: Run tests with coverage
if: matrix.coverage
run: >-
@@ -220,11 +250,12 @@ jobs:
--junitxml=test-results/main.xml --timing-report=test-results/main.json
--durations=25 --durations-min=1.0
- name: Run serial CLI command tests with coverage
- name: Run serial CLI input and command tests with coverage
if: matrix.coverage
run: >-
uv run --no-sync python -m pytest
tests/cli/test_commands.py
tests/cli/test_cli_input.py tests/cli/test_desktop_target.py
tests/cli/test_desktop_target_entrypoints.py tests/cli/test_commands.py
--cov=nanobot --cov-append --cov-report=term-missing:skip-covered
--junitxml=test-results/cli.xml --timing-report=test-results/cli.json
--durations=25 --durations-min=1.0
@@ -237,11 +268,12 @@ jobs:
--junitxml=test-results/main.xml --timing-report=test-results/main.json
--durations=25 --durations-min=1.0
- name: Run serial CLI command compatibility tests
- name: Run serial CLI input and command compatibility tests
if: ${{ !matrix.coverage }}
run: >-
uv run --no-sync python -m pytest
tests/cli/test_commands.py
tests/cli/test_cli_input.py tests/cli/test_desktop_target.py
tests/cli/test_desktop_target_entrypoints.py tests/cli/test_commands.py
--junitxml=test-results/cli.xml --timing-report=test-results/cli.json
--durations=25 --durations-min=1.0
@@ -293,6 +325,22 @@ jobs:
--junitxml=test-results/process.xml --timing-report=test-results/process.json
--durations=25 --durations-min=1.0
- name: Install pipx for offline installer checks
shell: bash
run: |
uv tool install pipx==1.17.12
uv tool dir --bin >> "$GITHUB_PATH"
# Installer subprocesses run here, parallel to the broad Windows suite.
# Each case owns an isolated manager/config root, so individual cases can
# run concurrently without sharing a console or package installation.
# Keep four workers: three exceed this job's budget on native Windows.
- name: Run Windows installer checks
run: >-
uv run --no-sync python -m pytest tests/test_install_scripts.py
-n 4 --dist load -x -vv --durations=10
--junitxml=test-results/installers.xml --timing-report=test-results/installers.json
- name: Upload Windows process test timings
if: always()
uses: actions/upload-artifact@v4
@@ -314,7 +362,7 @@ jobs:
- name: Set up Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.6
bun-version: 1.3.13
- name: Verify npm lockfile
working-directory: webui
@@ -361,7 +409,7 @@ jobs:
- name: Set up Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.6
bun-version: 1.3.13
- name: Install WebUI dependencies
working-directory: webui
@@ -391,10 +439,12 @@ jobs:
tui:
needs: changes
if: needs.changes.outputs.tui_required == 'true'
if: needs.changes.outputs.tui_required == 'true' || needs.changes.outputs.python_required == 'true' || needs.changes.outputs.webui_required == 'true'
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
timeout-minutes: 10
# Native build + clean install + recovery/next-update journeys on Windows.
# Each subprocess is separately bounded by the acceptance harness.
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
@@ -439,11 +489,10 @@ jobs:
working-directory: tui
run: python3 scripts/pty_smoke.py
- name: Set up Python for ConPTY smoke test
if: runner.os == 'Windows'
- name: Set up Python for native package acceptance
uses: actions/setup-python@v5
with:
python-version: '3.13'
python-version: '3.11'
- name: Test TUI in a real ConPTY terminal
if: runner.os == 'Windows'
@@ -472,6 +521,58 @@ jobs:
bun scripts/release-notices.ts win32-x64
python scripts/package-release.py win32-x64
- name: Build and install the native application package
shell: bash
env:
NATIVE_TARGET: ${{ runner.os == 'Windows' && 'win32-x64' || 'linux-x64' }}
run: |
python -m pip install --disable-pip-version-check build
python -m build --outdir "$RUNNER_TEMP/python-dist"
# Archive verification shares the installed launcher's dependencies.
# Install the intermediate in this build environment, not the separate
# clean-home environment used by the public-installer acceptance probe.
python -m pip install --disable-pip-version-check "$(find "$RUNNER_TEMP/python-dist" -name '*.whl' -print -quit)"
python -m scripts.build_tui_wheels \
--wheel "$(find "$RUNNER_TEMP/python-dist" -name '*.whl' -print -quit)" \
--tui-dir tui/dist --target "$NATIVE_TARGET" --out-dir "$RUNNER_TEMP/native-wheel"
version="$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')"
python -I scripts/verify_installed_release.py \
--install-wheel "$(find "$RUNNER_TEMP/native-wheel" -name '*.whl' -print -quit)" \
--version "$version" --commit "$(git rev-parse HEAD)" --gateway \
--report "$RUNNER_TEMP/native-install-report.json"
- name: Exercise updates with the default Windows path policy
if: runner.os == 'Windows'
shell: pwsh
run: |
# Only this disposable runner changes. Do not require users to enable
# machine-wide long paths for an ordinary update's atomic temp files.
$key = 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem'
Set-ItemProperty -Path $key -Name LongPathsEnabled -Value 0
if ((Get-ItemPropertyValue -Path $key -Name LongPathsEnabled) -ne 0) {
throw 'Native update acceptance requires LongPathsEnabled=0'
}
Write-Output 'Packaged update/recovery acceptance: LongPathsEnabled=0'
- name: Verify packaged upgrades and automatic service recovery
shell: bash
run: |
python -I scripts/verify_packaged_update.py \
--wheel "$(find "$RUNNER_TEMP/native-wheel" -name '*.whl' -print -quit)" \
--commit "$(git rev-parse HEAD)" --output "$RUNNER_TEMP/packaged-update"
- name: Retain the native package acceptance report
if: always()
uses: actions/upload-artifact@v4
with:
name: native-install-${{ runner.os }}-${{ github.run_id }}-${{ github.run_attempt }}
path: |
${{ runner.temp }}/native-install-report.json
${{ runner.temp }}/packaged-update/packaged-update-report.json
${{ runner.temp }}/packaged-update/*/result.json
if-no-files-found: error
retention-days: 3
docker:
needs: changes
if: needs.changes.outputs.docker_required == 'true'
+87
View File
@@ -0,0 +1,87 @@
name: Approve Exact Release
# No schedule, release trigger or PR token. Repository administrators must first
# protect main and release-approval, then explicitly enable the repository var.
# This produces a signature only: it never uploads release assets or writes a feed.
on:
workflow_dispatch:
inputs:
version:
description: Exact previously tested version (without v)
required: true
type: string
manifest_sha256:
description: SHA-256 from the independently reviewed candidate evidence
required: true
type: string
source_commit:
description: Reviewed full source SHA
required: true
type: string
candidate_commit:
description: Tested full candidate SHA
required: true
type: string
permissions: {}
concurrency:
group: release-approval
cancel-in-progress: false
jobs:
approve:
if: >-
github.repository == 'HKUDS/nanobot' && github.ref == 'refs/heads/main' &&
vars.NANOBOT_RELEASE_SIGNING_ENABLED == 'true'
environment: release-approval
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
id-token: write
env:
RELEASE_VERSION: ${{ inputs.version }}
MANIFEST_SHA256: ${{ inputs.manifest_sha256 }}
SOURCE_COMMIT: ${{ inputs.source_commit }}
CANDIDATE_COMMIT: ${{ inputs.candidate_commit }}
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
persist-credentials: false
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: '3.11'
- name: Install hash-locked signing tools, not the candidate
run: |
python -m pip install --require-hashes --only-binary=:all: -r .github/release-signing-requirements.txt
- name: Fetch only the proposed manifest
env:
GH_TOKEN: ${{ github.token }}
run: |
[[ "$RELEASE_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(\.dev[0-9]+|\.post[0-9]+)?$ ]]
gh release download "v$RELEASE_VERSION" --repo "$GITHUB_REPOSITORY" \
--pattern release-manifest.json --dir "$RUNNER_TEMP/approval"
- name: Bind the signature to reviewed evidence
run: |
python -m scripts.verify_release_approval \
--manifest "$RUNNER_TEMP/approval/release-manifest.json" \
--sha256 "$MANIFEST_SHA256" --version "$RELEASE_VERSION" \
--source-commit "$SOURCE_COMMIT" --candidate-commit "$CANDIDATE_COMMIT"
- name: Sign and verify the exact manifest
run: |
python -m sigstore sign --no-default-files \
--bundle "$RUNNER_TEMP/approval/release-manifest.json.sigstore.json" \
"$RUNNER_TEMP/approval/release-manifest.json"
python -m sigstore verify identity \
--cert-identity 'https://github.com/HKUDS/nanobot/.github/workflows/release-approve.yml@refs/heads/main' \
--cert-oidc-issuer 'https://token.actions.githubusercontent.com' \
--bundle "$RUNNER_TEMP/approval/release-manifest.json.sigstore.json" \
"$RUNNER_TEMP/approval/release-manifest.json"
- name: Retain small approval proof for the separate publication handoff
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: release-approval-${{ github.run_id }}-${{ github.run_attempt }}
path: ${{ runner.temp }}/approval/*
if-no-files-found: error
retention-days: 3
+188
View File
@@ -0,0 +1,188 @@
name: Verify Release Candidate
# Preparation only: no cron, tags, GitHub Releases, PyPI or channel-feed writes.
on:
workflow_dispatch:
inputs:
next_stable:
description: Next stable base (for example 0.3.6); must not have a stable tag
required: true
type: string
retain_installable:
description: Retain this exact installable candidate and source for 1 day (~400 MB); not publication
required: false
default: false
type: boolean
permissions:
contents: read
concurrency:
group: release-candidate
cancel-in-progress: false
jobs:
candidate:
runs-on: ubuntu-latest
timeout-minutes: 45
env:
SOURCE_COMMIT: ${{ github.sha }}
NEXT_STABLE: ${{ inputs.next_stable }}
PREVIEW_SEQUENCE: ${{ github.run_number }}
steps:
- name: Set candidate directory
run: echo "CANDIDATE_DIR=$RUNNER_TEMP/candidate" >> "$GITHUB_ENV"
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: astral-sh/setup-uv@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.13
- name: Install isolated build and verification tools
run: |
uv venv "$RUNNER_TEMP/release-tools"
uv pip install --python "$RUNNER_TEMP/release-tools/bin/python" -e '.[dev]' build twine
echo "$RUNNER_TEMP/release-tools/bin" >> "$GITHUB_PATH"
- name: Prepare an exact, separate candidate
run: |
python -m scripts.release_candidate prepare \
--source-commit "$SOURCE_COMMIT" --base "$NEXT_STABLE" \
--sequence "$PREVIEW_SEQUENCE" --output "$CANDIDATE_DIR" \
> "$RUNNER_TEMP/candidate.json"
- name: Verify packaging and selection contracts
working-directory: ${{ env.CANDIDATE_DIR }}
run: |
python -m pytest tests/test_release_candidate.py tests/test_releases.py \
tests/test_release_install_guide.py tests/test_installed_release_probe.py tests/cli/test_tui_wheels.py \
tests/cli/test_tui_release_packaging.py -q
- name: Check WebUI and build Python distributions
working-directory: ${{ env.CANDIDATE_DIR }}
run: |
cd webui
bun install --frozen-lockfile
bun run lint
bun run test
cd ..
uv build --out-dir "$RUNNER_TEMP/python-dist"
- name: Check and cross-build the five native targets
working-directory: ${{ env.CANDIDATE_DIR }}/tui
run: |
bun install --frozen-lockfile
bun run check
bun run test
for target in darwin-arm64 darwin-x64 linux-arm64 linux-x64 win32-x64; do
bun scripts/prepare-target.ts "$target"
bun run build -- "$target"
done
- name: Ad-hoc sign macOS arm64
uses: indygreg/apple-code-sign-action@44d0985b7f4363198e80b6fea63ac3e9dd3e9957
with:
input_path: ${{ env.CANDIDATE_DIR }}/tui/dist/nanobot-tui-darwin-arm64
rcodesign_version: 0.29.0
- name: Ad-hoc sign macOS x64
uses: indygreg/apple-code-sign-action@44d0985b7f4363198e80b6fea63ac3e9dd3e9957
with:
input_path: ${{ env.CANDIDATE_DIR }}/tui/dist/nanobot-tui-darwin-x64
rcodesign_version: 0.29.0
- name: Package licensed native archives
working-directory: ${{ env.CANDIDATE_DIR }}/tui
run: |
for target in darwin-arm64 darwin-x64 linux-arm64 linux-x64 win32-x64; do
bun scripts/prepare-target.ts "$target"
bun scripts/release-notices.ts "$target"
python scripts/package-release.py "$target"
done
- name: Assemble and verify the complete candidate
working-directory: ${{ env.CANDIDATE_DIR }}
run: |
version="${NEXT_STABLE}.dev${PREVIEW_SEQUENCE}"
python -m scripts.release_candidate assemble --source-commit "$SOURCE_COMMIT" \
--wheel "$RUNNER_TEMP/python-dist/nanobot_ai-${version}-py3-none-any.whl" \
--sdist "$RUNNER_TEMP/python-dist/nanobot_ai-${version}.tar.gz" \
--tui-dir tui/dist --output "$RUNNER_TEMP/release-artifacts"
python -m twine check "$RUNNER_TEMP/release-artifacts/"*.whl \
"$RUNNER_TEMP/release-artifacts/"*.tar.gz
- name: Install and probe the Linux wheel without frontend build tools
working-directory: ${{ env.CANDIDATE_DIR }}
run: |
version="${NEXT_STABLE}.dev${PREVIEW_SEQUENCE}"
uv_bin="$(command -v uv)"
uv venv --python 3.11 "$RUNNER_TEMP/installed-candidate"
mkdir "$RUNNER_TEMP/empty-install-path"
env PATH="$RUNNER_TEMP/empty-install-path" "$uv_bin" pip install \
--python "$RUNNER_TEMP/installed-candidate/bin/python" --only-binary :all: \
"$RUNNER_TEMP/release-artifacts/nanobot_ai-${version}-py3-none-manylinux_2_17_x86_64.whl"
uv pip check --python "$RUNNER_TEMP/installed-candidate/bin/python"
"$RUNNER_TEMP/installed-candidate/bin/python" -I scripts/verify_installed_release.py \
--version "$version" --commit "$(git rev-parse HEAD)" --gateway \
--report "$RUNNER_TEMP/installed-candidate-report.json"
- name: Generate the exact candidate installation handoff
working-directory: ${{ env.CANDIDATE_DIR }}
run: |
python -m scripts.release_candidate instructions --source-commit "$SOURCE_COMMIT" \
--artifacts "$RUNNER_TEMP/release-artifacts" \
--output "$RUNNER_TEMP/install-candidate.md"
- name: Verify packaged Linux upgrades and service recovery
working-directory: ${{ env.CANDIDATE_DIR }}
run: |
version="${NEXT_STABLE}.dev${PREVIEW_SEQUENCE}"
python -I scripts/verify_packaged_update.py \
--wheel "$RUNNER_TEMP/release-artifacts/nanobot_ai-${version}-py3-none-manylinux_2_17_x86_64.whl" \
--commit "$(git rev-parse HEAD)" --output "$RUNNER_TEMP/packaged-update"
# Keep the default preflight cheap: no ~400 MB archive upload per manual run.
# These reports are not installable releases or publication approvals.
- name: Retain identity, structural and native Linux probe reports
uses: actions/upload-artifact@v4
with:
name: candidate-report-${{ github.run_number }}-${{ github.run_attempt }}
path: |
${{ runner.temp }}/candidate.json
${{ runner.temp }}/release-artifacts/release-manifest.json
${{ runner.temp }}/installed-candidate-report.json
${{ runner.temp }}/packaged-update/packaged-update-report.json
${{ runner.temp }}/install-candidate.md
if-no-files-found: error
retention-days: 3
# Explicit, short-lived release handoff only. This is the documented
# exception to report-only preflight; never enable it on a daily schedule.
- name: Preserve the verified bytes and independent candidate source
if: ${{ inputs.retain_installable }}
working-directory: ${{ env.CANDIDATE_DIR }}
run: |
python -m scripts.release_candidate retain --source-commit "$SOURCE_COMMIT" \
--artifacts "$RUNNER_TEMP/release-artifacts" \
--output "$RUNNER_TEMP/retained-candidate"
- name: Retain installable candidate for approved release handoff
if: ${{ inputs.retain_installable }}
uses: actions/upload-artifact@v4
with:
name: installable-candidate-${{ github.run_number }}-${{ github.run_attempt }}
path: ${{ runner.temp }}/retained-candidate
if-no-files-found: error
compression-level: 0
retention-days: 1
+1 -2
View File
@@ -92,5 +92,4 @@ jobs:
if [[ "$TARGET" == win32-* ]]; then asset="${asset}.exe"; fi
gh release upload "$TAG" \
"tui/dist/${asset}.zip" \
"tui/dist/${asset}.zip.sha256" \
--clobber
"tui/dist/${asset}.zip.sha256"