Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Polish setup and update Harness with one action (#734)

Deef1d4b1a0e23d
diff --git a/.github/workflows/os.yml b/.github/workflows/os.yml
index fa1500bbd..1e61ada2f 100644
--- a/.github/workflows/os.yml
+++ b/.github/workflows/os.yml
@@ -47,11 +47,11 @@ on:
default: false
type: boolean
checks:
- description: 'Image journey, lock/suspend, Wi-Fi/audio essentials, or offline hardware installation; image_run_id reuses an image'
+ description: 'Image journey, browser focus, lock/suspend, Wi-Fi/audio, or offline hardware installation; image_run_id reuses an image'
required: false
default: image
type: choice
- options: [image, session, essentials, hardware]
+ options: [image, browser, session, essentials, hardware]
push:
branches: ['os/**']
paths: ['os/**', 'tui/**', 'cli/**', '.github/workflows/os.yml']
@@ -61,7 +61,7 @@ permissions:
actions: read
concurrency:
- group: programmer-os-${{ github.ref }}-${{ inputs.memory_mib || '2048' }}-${{ inputs.live_transport || 'cdrom' }}-${{ inputs.development_update && 'update' || inputs.checks == 'session' && 'session' || inputs.checks == 'essentials' && 'essentials' || inputs.checks == 'hardware' && 'hardware' || inputs.dsh && 'dsh' || inputs.workloads && 'workloads' || 'image' }}
+ group: programmer-os-${{ github.ref }}-${{ inputs.memory_mib || '2048' }}-${{ inputs.live_transport || 'cdrom' }}-${{ inputs.development_update && 'update' || inputs.checks == 'browser' && 'browser' || inputs.checks == 'session' && 'session' || inputs.checks == 'essentials' && 'essentials' || inputs.checks == 'hardware' && 'hardware' || inputs.dsh && 'dsh' || inputs.workloads && 'workloads' || 'image' }}
cancel-in-progress: false
jobs:
@@ -182,8 +182,11 @@ jobs:
sudo apt-get update -qq
sudo apt-get install -y qemu-system-x86 qemu-utils ovmf python3-pil tesseract-ocr
if test -e /dev/kvm; then sudo chmod a+rw /dev/kvm; fi
+ - name: Install the disposable browser observer
+ if: ${{ inputs.checks == 'browser' }}
+ run: sudo apt-get install -y wlrctl
- name: Check the focused session test and workflow
- if: ${{ inputs.checks == 'session' }}
+ if: ${{ inputs.checks == 'session' || inputs.checks == 'browser' }}
run: |
make -C os check
go run github.com/rhysd/actionlint/cmd/[email protected] .github/workflows/os.yml
@@ -196,7 +199,7 @@ jobs:
run-id: ${{ inputs.workload_seed_run_id }}
github-token: ${{ github.token }}
- name: Boot, operate, install and reboot the real image
- if: ${{ inputs.checks != 'session' }}
+ if: ${{ inputs.checks != 'session' && inputs.checks != 'browser' }}
env:
OS_WORKLOAD_SOURCE_RUN: ${{ inputs.workload_seed_run_id }}
OS_MEMORY_MIB: ${{ inputs.memory_mib || '2048' }}
@@ -205,6 +208,11 @@ jobs:
- name: Exercise password lock and actual suspend/resume
if: ${{ inputs.checks == 'session' }}
run: python3 os/tests/session_vm.py --iso os/dist/*.iso --firmware '${{ matrix.firmware }}' --session-file os/root/usr/lib/harness-os/session --theme-directory os/root/usr/share/plymouth/themes/harness
+ - name: Exercise installed browser focus and physical keyboard routing
+ if: ${{ inputs.checks == 'browser' }}
+ env:
+ OS_MEMORY_MIB: ${{ inputs.memory_mib || '2048' }}
+ run: python3 os/tests/browser_vm.py --iso os/dist/*.iso --firmware '${{ matrix.firmware }}' --memory-mib "$OS_MEMORY_MIB" --wlrctl /usr/bin/wlrctl --browser-script os/root/usr/bin/hn-browser --compositor-config os/root/usr/share/harness-os/labwc/rc.xml
- name: Show machine failure diagnostics
if: failure()
run: |
diff --git a/docs/naming-system.md b/docs/naming-system.md
index a2dd687f1..b64d255ab 100644
--- a/docs/naming-system.md
+++ b/docs/naming-system.md
@@ -115,6 +115,10 @@ configuration where it affects a decision.
| Installer action | **Install Harness** |
| Installation completion | **Harness is installed.** |
| Completion actions | **Shut down**, **Back to Harness** |
+| Defer installed Wi-Fi setup | **Set up later** |
+| Apply available OS/runtime releases | **Update** |
+| Update needs a reboot | **Updated. Restart when ready.** |
+| Update completion actions | **Done**, **Restart** |
| Default account | `me` |
| Default computer name | `harness` |
| Default shell identity | `me@harness` |
diff --git a/os/DEVELOPMENT.md b/os/DEVELOPMENT.md
index 3346786d3..54dcf0a23 100644
--- a/os/DEVELOPMENT.md
+++ b/os/DEVELOPMENT.md
@@ -5,10 +5,11 @@ boot changes. Reflashing is a release/install test, not the intended way to try
every interface fix. Keep the development tools on the build/test host; the
installed OS keeps the same minimal interface.
-Preview 10, its small update bundle, and the installed system update channel are
-published. Its native upgrade from preview 9 passed; earlier preview 6 coverage
-includes upgrades from previews 4 and 5. Remote-launcher argument
-tests passed but remote display/SSH interaction is still unverified.
+The USB image and the small installed-system update bundle ship separately.
+Each candidate must pass native installation and upgrade checks before publication.
+Preview 12 adds one-action updates, including mouse activation, while preserving
+running agents and terminals. Remote-launcher argument tests passed but remote
+display/SSH interaction is still unverified.
## Next release priorities
@@ -57,6 +58,20 @@ keys, and checks DHCP, DNS, HTTP, reconnection and non-silent audio output. Acce
point tools are installed only inside the disposable guest, never in the ISO.
Physical radio, backlight, speaker and microphone tests remain separate.
+`checks=browser` with an `image_run_id` exercises the installed terminal/browser
+session in BIOS/plain and UEFI/encrypted VMs. It records and applies only the
+candidate `hn-browser` script and labwc configuration over the checksum-verified
+image. The observer checks actual Wayland window states, local-page rendering,
+keyboard input destinations, repeated Super+b switching, an explicit URL request,
+and browser close/reopen while the same terminal process remains alive. The host's
+`wlrctl` binary is copied to the disposable guest's `/tmp`; it is not added to the
+image. Every candidate and observer hash is retained with screenshots and input
+logs. These focused checks do not replace a changed image's release acceptance.
+
+Boot readiness is recorded before first-use Wi-Fi and model conversations. Keep
+password wait, diagnostic login, onboarding, and active model latency separate
+when reporting startup. Native VM timings do not establish laptop power-on times.
+
The **Harness OS optional local AI assessment** workflow reuses an exact image
artifact and installs it to an encrypted disposable disk. Its two independent
checks add packages only inside their guests:
@@ -257,31 +272,36 @@ OS windows use hn's local session storage (`HARNESS_TUI_DESK=off`), so their
layout and pane references survive reconnects without signing into the cloud.
This setting is confined to the OS launcher; ordinary hn installs are unchanged.
-The installed system keeps hn's standard status bar. Super+u opens the keyboard
-update action (Ctrl+b, Shift+u remains an alias). Enter applies the prepared
-runtime through a transient user service. An hn-only change reconnects just the
-screen; a CLI change also restarts its supervised service. Failure restores the
-previous selection. Restore previous version holds the rejected versions until
-a newer release arrives. Ordinary macOS/Linux hn shortcuts are unchanged.
-
-This fast track is independent of OS releases. The system channel is checked
-once daily; S in Updates installs the published OS package with an administrator
-password. Root independently fetches the official release metadata, verifies a
-private download, makes a checkpoint, updates any required Arch base first, and
-rebuilds the encrypted boot image. System packages never apply or reboot on a
-timer. After an OS package changes, fast updates wait for a reboot. Publishing an
-ISO is not a requirement for a TUI update. The public preview
-4 ISO predates this feature and needs the small integration bundle from the
-validated preview 5 release; it does not need to be flashed again.
-
-`development_update=true` builds a private, deliberately unpublished `999.0.1`
-hn/CLI fixture. The installed VM's actual timer stages it, then real Super+u and
-Enter keys apply hn and CLI independently. Acceptance checks the same terminal
-process, a live OpenCode process, keyboard input, rollback and an unchanged boot
-ID. Those fixture binaries are never included in the package or public channel.
-The same installed VM restores the public package and upgrades through a private
-loopback OS channel, rejects a corrupt asset, keeps its running agent alive, and
-reboots the rebuilt encrypted image. This does not depend on a public test release.
+The installed system keeps hn's standard status bar. Super+u records an update
+request and selects the Updates terminal; the request starts checking/applying
+without another key. `harness updates` opens the same screen for inspection,
+with a clickable **Update** button. An hn-only change reconnects the screen;
+a CLI change also restarts its supervised service. Failure restores the previous
+selection. `harness updates rollback` restores the previous runtime and holds
+rejected versions until a newer release arrives. Ordinary macOS/Linux hn is unchanged.
+
+The system channel is checked daily. The same action applies an available OS
+package first, using `sudo -n harness upgrade`. A narrowly scoped sudoers rule
+permits only that exact command and `harness rollback`, with no extra arguments.
+Root independently fetches official metadata, verifies a private download,
+creates a checkpoint, updates any required Arch base and rebuilds initramfs.
+A local bundle, custom feed or arbitrary administrator command still requires
+normal authentication. No blanket passwordless sudo is installed.
+
+A system update leaves the current processes alone. **Done** is selected by
+default; **Restart** is a separate deliberate action. The user's update request
+is retained with the new base identity and original boot ID. After a real reboot,
+the timer prepares compatible hn/CLI releases against that base and completes
+that one requested update. Failures require attention, not repeated activation.
+Ordinary later checks download without activating. Publishing an ISO remains
+independent from frequent TUI releases.
+
+`development_update=true` builds private, unpublished `999.0.1` hn/CLI releases.
+The native fixture exercises timer staging, Super+u alone, a real mouse click on
+Update, failed activation/rollback, live terminal and OpenCode PIDs, keyboard input
+and boot identity. The same installed VM tests the OS channel, cleared sudo
+credentials, a corrupt asset and the encrypted reboot. Fixture binaries and
+loopback feeds never enter a published package.
The OS feed is `os-preview-updates/metadata.json` in the repository's release
assets. It names the exact package and manifest, their byte sizes and SHA-256
diff --git a/os/INSTALL.md b/os/INSTALL.md
index 032542bcf..33dc4982a 100644
--- a/os/INSTALL.md
+++ b/os/INSTALL.md
@@ -1,6 +1,6 @@
# Install Harness on a ThinkPad
-These instructions are for **0.1.0-preview.11**, using a Mac to prepare the USB.
+These instructions are for **0.1.0-preview.12**, using a Mac to prepare the USB.
The USB opens the installer directly. Installation begins only when you choose **Install Harness**
in the installer; it erases the entire selected disk.
@@ -21,20 +21,20 @@ compute still need testing on the actual hardware.
## 2. Download and verify on the Mac
-From the [preview 11 release](https://github.com/autonomous-ai/openharness/releases/tag/os-v0.1.0-preview.11),
+From the [preview 12 release](https://github.com/autonomous-ai/openharness/releases/tag/os-v0.1.0-preview.12),
download both files into the same folder:
-- `harness-0.1.0-preview.11-x86_64.iso`
-- `harness-0.1.0-preview.11-x86_64.iso.sha256`
+- `harness-0.1.0-preview.12-x86_64.iso`
+- `harness-0.1.0-preview.12-x86_64.iso.sha256`
If they are in Downloads, open Terminal and run:
```sh
cd ~/Downloads
-shasum -a 256 -c harness-0.1.0-preview.11-x86_64.iso.sha256
+shasum -a 256 -c harness-0.1.0-preview.12-x86_64.iso.sha256
```
-The result must say `harness-0.1.0-preview.11-x86_64.iso: OK`.
+The result must say `harness-0.1.0-preview.12-x86_64.iso: OK`.
If it does not, download the files again before flashing.
## 3. Flash the USB
@@ -119,7 +119,7 @@ disk. Changing the account password later does not change the disk password.
There is no cloud account that resets the disk password.
First boot opens OpenCode on the left and two terminal panes on the right.
-If disconnected, Wi-Fi opens first; you can connect or continue offline.
+If disconnected, Wi-Fi opens first; you can connect or choose **Set up later**.
Subsequent launches restore your existing work. **Super+w** opens network setup from any
pane. Ethernet connects automatically when available.
@@ -143,7 +143,7 @@ the next key. A capital letter in a prefix binding means Shift + letter.
| Super+b | Open/focus Chromium, or return to Harness |
| Super+Enter | Focus Harness |
| Super+l | Lock; unlock with the account password |
-| Super+u | Updates |
+| Super+u | Update Harness |
| `hn-browser http://localhost:3000` | Open a local project in the browser |
| `sudo systemctl poweroff` | Shut down |
@@ -152,26 +152,23 @@ install the tools the project needs. Save work under `~/projects`.
## 8. Updates
-Press **Super+u** to see available hn, CLI and system updates. New hn/CLI
-releases download in the background; press Enter in Updates to apply a ready runtime.
-The screen reconnects; your running agents and terminal processes remain.
-Use **r** in Updates to restore the previous runtime if needed.
-
-System updates use **s** in the same screen and ask for your account password.
-They retain a recovery checkpoint and rebuild the boot image. When the screen
-offers **Restart now**, save your work and press Enter when ready. Downloads do
-not restart the computer, and routine updates do not require another USB flash.
-
-Preview 5 through 10 can receive preview 11 through **Super+u**, then **s**.
-It includes the new network page, first-use workspace, lowercase project folders,
-and the fix preventing older public CLI releases from replacing the bundled
-OpenCode compatibility code. Running work is preserved; save before restarting.
-No reinstallation or USB flash is needed for these installed-system changes.
-
-Preview 11 boots the USB directly into installation. Wi-Fi setup happens after
-booting the installed system and advances into OpenCode and two terminals.
-USB startup changes require flashing the new ISO; existing installations keep
-their projects and receive system changes through Updates.
+Press **Super+u** to update. The **Update** button in `harness updates` does the
+same thing with a mouse. No confirmation or password is needed. New hn/CLI
+releases download in the background; applying them reconnects the screen while
+running agents and terminals stay alive.
+
+System updates retain a recovery checkpoint. If a restart is needed, keep
+working and choose **Restart** when ready. **Done** leaves the computer running.
+The approved update finishes any remaining runtime release after reboot.
+Routine updates do not need another USB flash.
+
+Preview 5 through 11 still use their old update screen to install this change:
+**Super+u**, then **s**, then the account password. After restarting, the simpler
+control is available. Projects are preserved.
+
+The USB starts installation directly. Wi-Fi setup runs after the first installed
+boot and advances into OpenCode and two terminals. USB installer changes need a
+new ISO; existing computers receive installed-system changes through Updates.
Preview 4 needs the 7.2 MB [preview 7 bootstrap bundle](https://github.com/autonomous-ai/openharness/releases/download/os-v0.1.0-preview.7/harness-update-0.1.0-preview.7-47872670a-x86_64.zip)
once. Verify and extract that bundle, open a terminal in its folder, and run:
diff --git a/os/README.md b/os/README.md
index 382294825..1cfe632de 100644
--- a/os/README.md
+++ b/os/README.md
@@ -11,7 +11,7 @@ audience, not its name.
Product names and interface copy follow the [Naming System](../docs/naming-system.md).
-**Preview 11:** the USB opens the installer directly. Installation works offline.
+**Preview 12:** the USB opens the installer directly. Installation works offline.
After shutdown, remove the USB and boot the installed disk. If disconnected,
the Wi-Fi page opens first and advances automatically when connected; Ethernet
skips that step. OpenCode starts on the left with two real terminals on the right.
@@ -26,12 +26,13 @@ The installer selects a disk, focuses Password, and has one full-width
**Install Harness** action, one row tall and aligned with the fields. Progress shows the Harness wordmark above the current step; encrypted boot shows the
Harness wordmark and a masked password prompt.
Both the live and installed system use `me@harness`.
-`Super+u` opens Updates. Frequent hn/CLI releases download in the background;
-you choose when to reconnect the screen. Running agents and terminals stay alive.
+`Super+u` starts the update. Frequent hn/CLI releases download in the background;
+the shortcut or clickable **Update** button applies available updates without
+a confirmation or password prompt. Running agents and terminals stay alive.
The update checker records release ancestry so a source-built runtime cannot be
replaced by an older public CLI with a higher development version number.
-[Download preview 11](https://github.com/autonomous-ai/openharness/releases/tag/os-v0.1.0-preview.11)
+[Download preview 12](https://github.com/autonomous-ai/openharness/releases/tag/os-v0.1.0-preview.12)
· [Mac → USB → ThinkPad installation guide](INSTALL.md)
· [Standalone HTML/CSS landing page](../website/public/os/README.md)
· [Development feedback loop and Mac support targets](DEVELOPMENT.md)
@@ -182,11 +183,19 @@ normal Linux administrator control.
## Updates and recovery
The installed system prepares hn/CLI releases automatically and keeps hn's standard
-status bar. `Super+u` opens Updates; Enter activates an available runtime and
-reconnects the screen without a computer reboot. **r** restores the previous
-runtime. System updates use **s**, ask for the account password, retain a
-checkpoint and offer a restart when ready. Neither channel automatically
-interrupts working agents. See [update development](DEVELOPMENT.md#fast-hn-updates).
+status bar. **Super+u** checks and applies available updates. The **Update** button
+in `harness updates` is also clickable. Neither path asks for confirmation or a
+password. Running agents and terminals stay alive; a runtime update reconnects
+the screen without rebooting the computer.
+
+System updates keep a recovery checkpoint. When one needs a restart, the screen
+says **Updated. Restart when ready.** Its default action is **Done**; restarting
+is always deliberate. After that reboot, the same update request finishes any
+remaining hn/CLI release against the new OS base. Later background checks return
+to downloading only. See [update development](DEVELOPMENT.md#fast-hn-updates).
+
+Earlier previews retain their existing controls until this update is installed:
+**Super+u**, then **s**, then the account password. No new USB flash is needed.
Preview 4 needs the matching bootstrap bundle from the
[preview 5 release](https://github.com/autonomous-ai/openharness/releases/tag/os-v0.1.0-preview.5)
@@ -242,9 +251,10 @@ owner. System guidance for agents lives at `/usr/share/harness-os/AGENTS.md`.
1. Installer input/disk safety tests, shell/Python/XML/JSON syntax, workflow lint.
2. Build a real ISO; check checksums, package inventory and configuration in its
actual SquashFS filesystem.
-3. Boot the ISO under BIOS and UEFI; verify hn is visible and Chromium is absent
- until requested. Test browser toggle, clipboard, terminal input, reconnect,
- last-pane behavior and frontend restart without terminating agent work.
+3. Boot the ISO under BIOS and UEFI; verify the installer opens directly and no
+ agent or browser starts. On the installed disk, test browser focus and keyboard
+ routing, clipboard, terminal input, reconnect, last-pane behavior and screen
+ restart without terminating agent work.
4. Operate the real installer form on a guest terminal: disk picker, encryption
toggle, masked passwords, Back/Esc, a single explicit Install action and persistent completion.
Install from the offline image to disposable VM disks, encrypted and plain;
diff --git a/os/installer.py b/os/installer.py
index 1f8765ff1..dda79ae17 100644
--- a/os/installer.py
+++ b/os/installer.py
@@ -16,6 +16,7 @@ import shutil
import subprocess
import sys
import tempfile
+import textwrap
import time
MIN_DISK_BYTES = 12 * 1024**3
@@ -507,15 +508,26 @@ class InstallForm:
except curses.error:
pass
- def line(self, row, text, active=False, bold=False, accent=False):
+ def line(self, row, text, active=False, bold=False, accent=False, offset=0, span=None):
height, width = self.screen.getmaxyx()
row += self.top
- if row >= height or width < 5:
+ length = min(self.width - offset, width - self.left - offset - 1)
+ if span is not None:
+ length = min(length, span)
+ if not 0 <= row < height or length <= 0:
return
attr = (curses.A_REVERSE if active else self.accent if accent else curses.A_NORMAL) | (curses.A_BOLD if bold else 0)
if active:
- text = text.ljust(self.width)
- self.screen.addnstr(row, self.left, text, min(self.width, width - self.left - 1), attr)
+ text = text.ljust(length)
+ self.screen.addnstr(row, self.left + offset, text, length, attr)
+
+ def field(self, row, label, value, active=False):
+ self.line(row, f'{label:18}', span=18)
+ self.line(row, value, active=active, offset=18)
+
+ def button(self, row, text, active=False):
+ label = '[ ' + text + ' ]'
+ self.line(row, label, active=active, offset=(self.width - len(label)) // 2, span=len(label))
def cursor(self, visible):
if visible == self.cursor_visible:
@@ -621,14 +633,14 @@ class InstallForm:
duplicate = sum(disk_label(d) == disk_label(disk) for d in self.disks) > 1
suffix = ' ' + Path(disk['name']).name if duplicate else ''
label = disk_label(disk, self.width - 18 - len(suffix)) + suffix
- self.line(4, f"{'Disk':18}{label}", self.focus == 0)
- self.line(6, f"{'Encryption':18}[{'x' if self.encrypt else ' '}]", self.focus == 1)
+ self.field(4, 'Disk', label, self.focus == 0)
+ self.field(6, 'Encryption', f"[{'x' if self.encrypt else ' '}]", self.focus == 1)
capacity = self.width - 20
for index, label in enumerate(('Password', 'Repeat password')):
position = self.positions[index]
offset = max(0, position - capacity + 1)
mask = '*' * len(self.passwords[index][offset:offset + capacity])
- self.line(8 + index * 2, f'{label:<18}[{mask:<{capacity}}]', self.focus == index + 2)
+ self.field(8 + index * 2, label, f'[{mask:<{capacity}}]', self.focus == index + 2)
self.line(12, self.error)
self.line(14, 'Install Harness'.center(self.width), active=True, bold=self.focus == 4)
self.cursor(self.focus in (2, 3))
@@ -699,13 +711,14 @@ def completion(screen, boot=False):
view.cursor(False)
selected = 0
while True:
- if not view.begin('Harness is installed.'):
+ if not view.begin(''):
continue
- view.line(4, 'Remove the USB after shutdown.')
- view.line(5, 'Then turn on this computer.')
- view.line(8, '[ Shut down ]', active=selected == 0)
+ paragraph = 'Harness is installed. Shut down, remove the USB, then turn on your computer.'
+ for row, line in enumerate(textwrap.wrap(paragraph, min(48, view.width))):
+ view.line(4 + row, line.center(view.width))
+ view.button(8, 'Shut down', active=selected == 0)
if not boot:
- view.line(10, 'Back to Harness', active=selected == 1)
+ view.button(10, 'Back to Harness', active=selected == 1)
screen.refresh()
key = screen.get_wch()
if key in ('\x1b', '\x03') and not boot:
diff --git a/os/live_update.py b/os/live_update.py
index 39822962e..b02a24354 100644
--- a/os/live_update.py
+++ b/os/live_update.py
@@ -35,6 +35,8 @@ FILES = ('harness-tui', 'cli.mjs', 'notify.mjs')
LIMIT = 64 * 1024 * 1024
RESTART_REQUIRED = Path('/run/harness-os-restart-required')
SYSTEM_LOCK = Path('/run/lock/hn-os.lock')
+BOOT_ID = Path('/proc/sys/kernel/random/boot_id')
+WORDMARK = ('█ █ ▄▀█ █▀█ █▄ █ █▀▀ █▀ █▀', '█▀█ █▀█ █▀▄ █ ▀█ ██▄ ▄█ ▄█')
def version(value):
@@ -340,7 +342,7 @@ def check(feeds=None, progress=lambda _: None, force_system=False):
system = check_system(force_system) if feeds is None else {}
notice('Update ready · Super+u' if available or system.get('available') else '')
prune()
- if errors and not available:
+ if errors and not available and not system.get('available'):
raise ValueError('Could not check for updates. Connect to the internet and try again.')
return available
@@ -454,89 +456,206 @@ def apply(rollback=False):
prune()
-def screen(window):
+def finish_approved_update():
+ """Finish one explicitly approved update after its OS package reboot.
+
+ A new OS base must prepare its own compatible runtime before activation.
+ Ordinary timer checks still only download; this receipt is written solely
+ after an update request and a successful privileged update, and is consumed once.
+ """
+ approval = read(STATE / 'approved.json', {})
+ if approval.get('status') != 'after-reboot' or RESTART_REQUIRED.exists():
+ return
+ if approval.get('boot_id') == BOOT_ID.read_text().strip():
+ return
+ try:
+ if approval.get('base_sha256') != digest(BASE_ID):
+ raise ValueError('The system changed since this update. Open Updates to check again.')
+ ready = prepared()
+ if ready and ready != selected():
+ apply()
+ if read(STATE / 'check.json', {}).get('errors') or read(STATE / 'system.json', {}).get('error'):
+ raise ValueError('Some updates could not be checked. Open Updates to try again.')
+ (STATE / 'approved.json').unlink(missing_ok=True)
+ except (ValueError, OSError, subprocess.SubprocessError) as error:
+ write(STATE / 'approved.json', dict(approval, status='failed', error=str(error)))
+ notice('Update needs attention · Super+u')
+ raise
+
+
+def update_all():
+ """One user decision; root still verifies its own official release assets."""
+ if RESTART_REQUIRED.exists():
+ raise ValueError('Restart when ready to finish the update.')
+ if read(STATE / 'system.json', {}).get('available'):
+ # Do not reconnect an old session using a new OS package. Its included
+ # runtime takes effect on reboot; finish any independent public release
+ # against that new base afterward, under this same explicit approval.
+ subprocess.run(['sudo', '-n', '/usr/bin/harness', 'upgrade'], check=True)
+ (STATE / 'system.json').unlink(missing_ok=True)
+ if read(RESTART_REQUIRED, {}).get('status') == 'ready':
+ write(STATE / 'approved.json', dict(status='after-reboot',
+ boot_id=BOOT_ID.read_text().strip(), base_sha256=digest(BASE_ID)))
+ return
+ ready = prepared()
+ if ready and ready != selected():
+ # The unit survives reconnecting the screen. The Updates terminal
+ # process waits for its real result and survives with the other panes.
+ run('systemd-run', '--user', '--wait', '--collect', '--unit=harness-apply-update',
+ '/usr/bin/python3', '/usr/lib/harness-os/live_update.py', 'apply', timeout=240)
+ (STATE / 'approved.json').unlink(missing_ok=True)
+
+
+def screen(window, message='', refresh=False):
curses.curs_set(0)
window.keypad(True)
- message = ''
+ window.timeout(500)
+ curses.mousemask(curses.ALL_MOUSE_EVENTS)
+ curses.mouseinterval(150)
+ choice = 0
+ targets = []
+ accent = curses.A_BOLD
+ try:
+ if curses.has_colors():
+ curses.start_color()
+ curses.use_default_colors()
+ curses.init_pair(1, curses.COLOR_YELLOW, -1)
+ accent |= curses.color_pair(1)
+ except curses.error:
+ pass
+
def draw(status=''):
window.erase()
height, width = window.getmaxyx()
ready = prepared()
- available = ready is not None and ready != selected()
+ available = (ready is not None and ready != selected()) or read(STATE / 'system.json', {}).get('available')
checked = read(STATE / 'check.json', {})
- system = read(STATE / 'system.json', {})
- failed = read(STATE / 'transaction.json', {}).get('status') == 'failed'
system_state = read(RESTART_REQUIRED, {}).get('status')
- reboot = system_state == 'ready'
- recovery = system_state == 'failed'
- if system_state:
- available = False
- summary = 'Could not check for updates.' if checked.get('errors') else (
- 'Harness is up to date.' if checked.get('checked_at') else 'Updates are checked automatically.')
- lines = ['harness', '', status or message or (
- 'Restore the previous system to recover.' if recovery else
- 'Restart to finish the system update.' if reboot else
- 'The system is updating…' if system_state else
- 'Update failed. Previous version restored.' if failed else 'An update is ready.' if available else summary), '',
- 'Enter Restart now' if reboot else 'Enter Try update again' if available and failed else
- 'Enter Update now' if available else 'C Check for updates',
- 'R Restore previous system' if recovery else
- 'R Restore previous version' if not system_state and read(STATE / 'applied.json') else '',
- 'S System update ready' if system.get('available') else 'S System updates', '', 'Esc Back']
- top, left = max(0, (height - len(lines)) // 2), max(0, (width - 46) // 2)
+ errors = checked.get('errors') or read(STATE / 'system.json', {}).get('error') or read(STATE / 'approved.json', {}).get('status') == 'failed'
+ if system_state == 'failed':
+ title, choices = 'The update needs recovery.', [('Restore', 'restore-system'), ('Back', None)]
+ elif system_state == 'ready':
+ title, choices = 'Updated. Restart when ready.', [('Done', None), ('Restart', 'reboot')]
+ elif system_state:
+ title, choices = 'The system is updating…', [('Back', None)]
+ elif available:
+ title, choices = 'Update available.', [('Update', 'update')]
+ elif errors or message:
+ title, choices = 'Could not finish checking for updates.', [('Retry', 'check'), ('Back', None)]
+ else:
+ title, choices = 'Harness is up to date.', [('Done', None)]
+ lines = [*WORDMARK, '', '', status or title]
+ if message and not status:
+ lines += ['', message]
+ top = max(0, (height - len(lines) - 4) // 2)
for index, line in enumerate(lines):
if top + index < height - 1:
- window.addnstr(top + index, left, line, max(0, width - left - 1), curses.A_BOLD if index == 0 else 0)
+ left = max(0, (width - len(line)) // 2)
+ window.addnstr(top + index, left, line, max(0, width - left - 1), accent if index < 2 else 0)
+ labels = ['[ ' + label + ' ]' for label, _ in choices]
+ left = max(0, (width - sum(map(len, labels)) - 4 * (len(labels) - 1)) // 2)
+ row = top + len(lines) + 2
+ targets.clear()
+ if row < height - 1 and not status:
+ for index, label in enumerate(labels):
+ window.addnstr(row, left, label, max(0, width - left - 1),
+ curses.A_REVERSE if index == choice % len(choices) else 0)
+ targets.append((row, left, min(width - 1, left + len(label)), choices[index][1]))
+ left += len(label) + 4
window.refresh()
- return available
+ return choices
+
+ def refresh_releases():
+ check(progress=draw, force_system=True)
+ # An explicit retry supersedes a failed post-reboot request. Otherwise
+ # even a successful recheck with nothing left to apply stays on Retry.
+ if read(STATE / 'approved.json', {}).get('status') == 'failed':
+ (STATE / 'approved.json').unlink(missing_ok=True)
+
+ if refresh and not RESTART_REQUIRED.exists():
+ draw('Checking for updates…')
+ try:
+ refresh_releases()
+ except (ValueError, OSError, subprocess.SubprocessError) as error:
+ message = str(error)
while True:
- available = draw()
+ choices = draw()
+ requested = STATE / 'request.json'
+ if requested.exists():
+ requested.unlink(missing_ok=True)
+ if not RESTART_REQUIRED.exists():
+ # The shortcut starts updating. A ready download needs no
+ # further network round trip; otherwise discover it now.
+ if choices[0][1] != 'update' and not refresh:
+ draw('Checking for updates…')
+ try:
+ refresh_releases()
+ message = ''
+ except (ValueError, OSError, subprocess.SubprocessError) as error:
+ message = str(error)
+ choices = draw()
+ if choices[0][1] == 'update':
+ return 'update'
+ refresh = False
key = window.getch()
if key in (27, ord('q')):
return
- try:
- if key in (10, 13) and read(RESTART_REQUIRED, {}).get('status') == 'ready':
- return 'reboot'
- if key in (ord('r'), ord('R')) and read(RESTART_REQUIRED, {}).get('status') == 'failed':
- return 'restore-system'
- if key in (ord('c'), ord('C')) or key in (10, 13) and not available:
- draw('Checking for updates…')
- check(progress=draw, force_system=True)
- message = ''
- elif key in (10, 13) and available or key in (ord('r'), ord('R')):
- action = 'rollback' if key in (ord('r'), ord('R')) else 'apply'
- draw('Updating… Your agents keep running.')
- # A transient unit survives the screen it restarts; no extra daemon.
- run('systemd-run', '--user', '--collect', '--unit=harness-apply-update',
- '/usr/bin/python3', '/usr/lib/harness-os/live_update.py', action)
- return
- elif key in (ord('s'), ord('S')):
- return 'system'
- except (ValueError, OSError, subprocess.SubprocessError) as error:
- message = str(error)
+ if key in (9, curses.KEY_BTAB, curses.KEY_LEFT, curses.KEY_RIGHT):
+ choice = (choice + 1) % len(choices)
+ elif key in (10, 13, curses.KEY_ENTER):
+ return choices[choice % len(choices)][1]
+ elif key == curses.KEY_MOUSE:
+ try:
+ _, x, y, _, buttons = curses.getmouse()
+ if buttons & (curses.BUTTON1_CLICKED | curses.BUTTON1_RELEASED):
+ for row, left, right, action in targets:
+ if y == row and left <= x < right:
+ return action
+ except curses.error:
+ pass
def main(argv=None):
parser = argparse.ArgumentParser(description=__doc__)
- parser.add_argument('action', choices=['check', 'screen', 'apply', 'rollback', 'status'], nargs='?', default='screen')
+ parser.add_argument('action', choices=['check', 'screen', 'request', 'apply', 'rollback', 'status'], nargs='?', default='screen')
parser.add_argument('--feeds', type=Path, help='Explicit developer feed map; never used by the installed timer')
args = parser.parse_args(argv)
if os.geteuid() == 0 or Path('/etc/harness-live').exists():
parser.error('Open Updates as your normal user on an installed Harness system.')
STATE.mkdir(parents=True, exist_ok=True, mode=0o700)
- if args.action == 'check':
+ if args.action == 'request':
+ write(STATE / 'request.json', {'requested_at': time.time()})
+ elif args.action == 'check':
check(read(args.feeds) if args.feeds else None)
+ finish_approved_update()
elif args.action == 'screen':
+ message = ''
+ # A prepared release can be applied immediately. Otherwise check now
+ # instead of exposing another command or making the user wait for a timer.
+ refresh = not (prepared() or read(STATE / 'system.json', {}).get('available'))
while True:
- action = curses.wrapper(screen)
- if action == 'reboot':
- subprocess.run(['systemctl', 'reboot'], check=True)
- break
- if action not in ('system', 'restore-system'):
+ action = curses.wrapper(screen, message, refresh)
+ if action is None:
break
- subprocess.run(['sudo', '/usr/bin/harness', 'rollback' if action == 'restore-system' else 'upgrade'], check=False)
- (STATE / 'system.json').unlink(missing_ok=True)
- input('Press Enter to return to Updates.')
+ message, refresh = '', action == 'check'
+ try:
+ if action == 'check':
+ # Retry means finish updating, without another confirmation
+ # after the connection or release has recovered.
+ write(STATE / 'request.json', {'requested_at': time.time()})
+ if action == 'reboot':
+ subprocess.run(['systemctl', 'reboot'], check=True)
+ break
+ if action == 'update':
+ print('Updating Harness… Your agents keep running.', flush=True)
+ update_all()
+ elif action == 'restore-system':
+ subprocess.run(['sudo', '-n', '/usr/bin/harness', 'rollback'], check=True)
+ (STATE / 'system.json').unlink(missing_ok=True)
+ (STATE / 'approved.json').unlink(missing_ok=True)
+ except (ValueError, OSError, subprocess.SubprocessError) as error:
+ write(STATE / 'error.json', {'at': time.time(), 'error': str(error)})
+ message = 'The update did not finish. Try again.'
elif args.action in ('apply', 'rollback'):
apply(rollback=args.action == 'rollback')
else:
diff --git a/os/lock.json b/os/lock.json
index 996429f2e..3b92e9d2c 100644
--- a/os/lock.json
+++ b/os/lock.json
@@ -1,8 +1,12 @@
{
- "version": "0.1.0-preview.11",
+ "version": "0.1.0-preview.12",
"arch_snapshot": "2026/10/01",
"architecture": "x86_64",
"upgrades_from": [
+ {
+ "version": "0.1.0-preview.11",
+ "arch_snapshot": "2026/10/01"
+ },
{
"version": "0.1.0-preview.10",
"arch_snapshot": "2026/10/01"
diff --git a/os/network.py b/os/network.py
index 2da19c60f..7c554ae08 100644
--- a/os/network.py
+++ b/os/network.py
@@ -170,27 +170,36 @@ class NetworkPage:
except curses.error:
pass
- def line(self, row, text, selected=False, accent=False):
+ def line(self, row, text, selected=False, accent=False, offset=0, span=None):
height, width = self.screen.getmaxyx()
- if 0 <= row < height - 1 and width > 3:
- self.screen.addnstr(row, self.left, fit(text, self.width), self.width,
+ row += self.top
+ length = self.width - offset if span is None else min(span, self.width - offset)
+ if 0 <= row < height - 1 and width > 3 and length > 0:
+ self.screen.addnstr(row, self.left + offset, fit(text, length), length,
curses.A_REVERSE if selected else self.accent if accent else curses.A_NORMAL)
+ def button(self, row, text, selected=False):
+ label = '[ ' + text + ' ]'
+ self.line(row, label, selected, offset=max(0, (self.width - len(label)) // 2), span=len(label))
+
def begin(self):
self.screen.erase()
height, width = self.screen.getmaxyx()
- self.width = max(1, min(64, width - 4))
+ self.width = max(1, min(50, width - 4))
self.left = max(0, (width - self.width) // 2)
+ # Leave generous space on a laptop display while retaining room for the
+ # form on a 24-row terminal. All pages share this same text column.
+ self.top = max(1, (height - 26) // 2)
for row, text in enumerate(WORDMARK):
- self.line(row + 1, text.center(self.width), accent=True)
+ self.line(row, text.center(self.width), accent=True)
if self.first_use:
- self.line(4, 'The operating system built by agents, for agents.'.center(self.width))
- self.line(7, 'Connect to Wi-Fi to get started' if self.first_use else 'Connect to Wi-Fi')
+ self.line(3, 'The operating system built by agents, for agents.'.center(self.width))
+ self.line(6, 'Connect to Wi-Fi to get started' if self.first_use else 'Connect to Wi-Fi')
return height
def refresh(self):
self.begin()
- self.line(9, 'Finding Wi-Fi…')
+ self.line(8, 'Finding Wi-Fi…')
self.screen.refresh()
self.message = ''
try:
@@ -209,14 +218,17 @@ class NetworkPage:
value, error = '', ''
while True:
height = self.begin()
- self.line(8, clean(network['ssid']))
- self.line(10, 'Password ' + '*' * min(len(value), self.width - 11))
+ self.line(8, 'Network ' + clean(network['ssid']))
+ self.line(10, 'Password', span=12)
+ capacity = max(1, self.width - 14)
+ self.line(10, '[' + ('*' * min(len(value), capacity)).ljust(capacity) + ']',
+ selected=True, offset=12)
self.line(12, error)
- self.line(14, 'Connect'.center(self.width), True)
+ self.button(14, 'Connect')
try:
curses.curs_set(1)
- if height > 11:
- self.screen.move(10, self.left + min(10 + len(value), self.width - 1))
+ if height > self.top + 11:
+ self.screen.move(self.top + 10, self.left + min(13 + len(value), self.width - 2))
except curses.error:
pass
self.screen.refresh()
@@ -262,22 +274,24 @@ class NetworkPage:
curses.curs_set(0)
except curses.error:
pass
- # Keep the offline route visible even in a crowded Wi-Fi scan.
- listed = rows[:-1] if self.first_use else rows
- visible = max(1, height - (13 if self.first_use else 11))
- offset = max(0, min(self.selected, len(listed) - 1) - visible + 1)
- for index, (kind, value) in enumerate(listed[offset:offset + visible], start=offset):
- if kind == 'wifi':
- label = value['ssid'] + (' Connected' if value['active'] else f" {value['signal']}%")
- elif kind == 'wired':
- label = 'Ethernet ' + value[0]
- else:
- label = '[ Rescan ]'
- self.line(9 + index - offset, label, index == self.selected)
+ # Scroll networks only. Rescan, Ethernet and the offline escape stay
+ # below the list, even when a scan finds dozens of access points.
+ visible = max(1, min(10, height - self.top - 14 - len(self.wired) - (2 if self.first_use else 0)))
+ offset = max(0, min(self.selected, len(self.networks) - 1) - visible + 1)
+ networks = self.networks[offset:offset + visible]
+ for index, value in enumerate(networks, start=offset):
+ signal = 'Connected' if value['active'] else f"{value['signal']}%"
+ label = fit(value['ssid'], self.width - len(signal) - 2) + ' ' + signal
+ self.line(8 + index - offset, label, index == self.selected)
+ bottom = 9 + max(1, len(networks))
+ self.button(bottom, 'Rescan', self.selected == len(self.networks))
+ for index, device in enumerate(self.wired):
+ self.line(bottom + 2 + index, 'Ethernet ' + device[0],
+ self.selected == len(self.networks) + 1 + index)
if self.first_use:
- self.line(height - 4, '[ Install without connecting ]' if self.live else '[ Continue offline ]',
- self.selected == len(rows) - 1)
- self.line(height - 2, self.message or ('' if self.networks else 'No Wi-Fi networks found. Rescan or use Ethernet.'))
+ self.button(bottom + 3 + len(self.wired), 'Install without connecting' if self.live else 'Set up later',
+ self.selected == len(rows) - 1)
+ self.line(height - self.top - 2, self.message or ('' if self.networks else 'No Wi-Fi networks found. Rescan or use Ethernet.'))
self.screen.refresh()
try:
key = self.screen.get_wch()
diff --git a/os/root/etc/sudoers.d/30-harness-updates b/os/root/etc/sudoers.d/30-harness-updates
new file mode 100644
index 000000000..1268480d3
--- /dev/null
+++ b/os/root/etc/sudoers.d/30-harness-updates
@@ -0,0 +1,3 @@
+# Updates use the fixed official channel and root-owned recovery receipts.
+# Exact no-argument commands only: no local bundle, feed URL or arbitrary shell.
+%wheel ALL=(root) NOPASSWD: /usr/bin/harness upgrade, /usr/bin/harness rollback
diff --git a/os/root/usr/bin/hn-browser b/os/root/usr/bin/hn-browser
index fff6b5077..e3b51f338 100644
--- a/os/root/usr/bin/hn-browser
+++ b/os/root/usr/bin/hn-browser
@@ -1,4 +1,4 @@
#!/bin/sh
# Use the current display environment even from a long-lived agent or SSH pane.
# Chromium remains sandboxed and is started only by an explicit browser request.
-exec systemd-run --user --quiet --collect /usr/bin/chromium --ozone-platform=wayland --no-first-run --no-default-browser-check "$@"
+exec systemd-run --user --quiet --collect /usr/bin/chromium --ozone-platform=wayland --start-maximized --no-first-run --no-default-browser-check "$@"
diff --git a/os/root/usr/lib/harness-os/open-updates b/os/root/usr/lib/harness-os/open-updates
index 025044a65..f828c388e 100644
--- a/os/root/usr/lib/harness-os/open-updates
+++ b/os/root/usr/lib/harness-os/open-updates
@@ -1,4 +1,5 @@
#!/bin/sh
# Reuse hn's existing surface, including when the browser has focus.
[ ! -f /etc/harness-live ] || exit 0
+harness updates request || exit
hn select-window -t Updates 2>/dev/null || hn new-window -n Updates '/usr/bin/harness updates'
diff --git a/os/root/usr/lib/systemd/user/harness-update.service b/os/root/usr/lib/systemd/user/harness-update.service
index 43f752b41..309471534 100644
--- a/os/root/usr/lib/systemd/user/harness-update.service
+++ b/os/root/usr/lib/systemd/user/harness-update.service
@@ -5,5 +5,7 @@ ConditionPathExists=!/etc/harness-live
[Service]
Type=oneshot
ExecStart=/usr/bin/python3 /usr/lib/harness-os/live_update.py check
-TimeoutStartSec=3min
+# One requested system update may finish its runtime activation after reboot.
+# Allow the bounded download and activation checks to finish before terminating.
+TimeoutStartSec=6min
Nice=10
diff --git a/os/root/usr/share/harness-os/AGENTS.md b/os/root/usr/share/harness-os/AGENTS.md
index 7919a6243..b6f47dada 100644
--- a/os/root/usr/share/harness-os/AGENTS.md
+++ b/os/root/usr/share/harness-os/AGENTS.md
@@ -10,10 +10,12 @@ is required.
## System operations
-- `Super+u` opens Updates inside hn; `harness updates` is the shell equivalent.
+- `Super+u` starts the update inside hn. `harness updates` opens its screen;
+ click Update to start the same action. No confirmation or password is needed.
The user timer checks hn and CLI releases and prepares verified downloads.
Activation is explicit. An hn-only change restarts its screen, keeping terminal
- owners and agents alive. System packages use the separate checkpointed action.
+ owners and agents alive. The same action handles checkpointed system packages. A restart is always
+ deferred until the user chooses it; Done keeps working processes alive.
Do not replace `/usr/lib/harness` manually or enable the CLI's independent
daemon handoff updater: this OS supervises activation with systemd.
- This is Arch Linux with systemd, the LTS kernel, labwc, foot and Chromium.
@@ -41,7 +43,8 @@ is required.
first use `sudo cryptsetup open /dev/sda3 hn-recovery`, then use
`/dev/mapper/hn-recovery` in the recovery command. Device names vary; inspect
`lsblk -f` first. Recovery changes the installed system, not user projects.
-- The user's account has password-protected sudo. Do not disable authentication,
+- The user's account has password-protected sudo, with narrow exceptions for
+ the root-owned network form and official update/recovery commands. Do not disable authentication,
browser sandboxing, disk encryption or the session lock to make a task easier.
## Network and hardware
diff --git a/os/root/usr/share/harness-os/guide.md b/os/root/usr/share/harness-os/guide.md
index 564741496..eb9a296c2 100644
--- a/os/root/usr/share/harness-os/guide.md
+++ b/os/root/usr/share/harness-os/guide.md
@@ -113,7 +113,8 @@ conversation history. Describe only collaboration controls present in this TUI.
- Super+n opens New Harness; Super+t opens a terminal; Super+m connects a computer.
- Super+b switches between Harness and the browser. Super+Enter focuses Harness.
- Super+l locks the screen. Brightness and volume keys operate supported hardware.
-- Super+u opens Updates after installation. Updates keep projects and running
+- Super+u starts updates after installation; the Update button is clickable too.
+ No confirmation or password is needed. Restart only when ready. Updates keep projects and running
work; flashing another USB is not the everyday update workflow.
These shortcuts require no Shift and no Ctrl+b prefix. Super is the Windows-logo key on a PC keyboard and the Command key on a Mac
diff --git a/os/tests/browser_guest.py b/os/tests/browser_guest.py
new file mode 100644
index 000000000..2de26a6e6
--- /dev/null
+++ b/os/tests/browser_guest.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python3
+"""Local page and input observer for a disposable browser-session VM only."""
+from http.server import BaseHTTPRequestHandler, HTTPServer
+import json
+from pathlib import Path
+
+ROOT = Path('/tmp/harness-browser-probe')
+PAGE = '''<!doctype html><meta charset="utf-8"><title>Harness browser check</title>
+<style>html,body{background:rgb(230,245,236);color:black;margin:0}body{padding:24px}
+label{display:block;margin-bottom:8px}input{font-size:24px;width:70%}</style>
+<h1>Harness browser check</h1><label for="input">Keyboard</label>
+<input id="input" autofocus autocomplete="off">
+<script>
+const input = document.querySelector('input');
+let previous = '';
+function report() {
+ const data = JSON.stringify({
+ path:location.pathname, input:input.value, focused:document.hasFocus(),
+ inputFocused:document.activeElement === input,
+ innerWidth, innerHeight, outerWidth, outerHeight,
+ screenWidth:screen.width, screenHeight:screen.height
+ });
+ if (data !== previous) {
+ previous = data;
+ fetch('/observe', {method:'POST', body:data});
+ }
+}
+for (const name of ['load','resize','focus','blur']) addEventListener(name, report);
+input.addEventListener('input', report);
+// Wayland bounds and HTML autofocus can settle after load without another
+// resize event. Report state transitions instead of equating load with readiness.
+setInterval(report, 100);
+</script>'''
+
+
+class Handler(BaseHTTPRequestHandler):
+ def log_message(self, *_args):
+ pass
+
+ def do_GET(self):
+ data = PAGE.encode()
+ self.send_response(200)
+ self.send_header('Content-Type', 'text/html; charset=utf-8')
+ self.send_header('Content-Length', str(len(data)))
+ self.end_headers()
+ self.wfile.write(data)
+
+ def do_POST(self):
+ size = int(self.headers.get('Content-Length', '0'))
+ if self.path != '/observe' or not 0 < size < 4096:
+ self.send_error(400)
+ return
+ data = json.loads(self.rfile.read(size))
+ with (ROOT / 'events.jsonl').open('a') as output:
+ output.write(json.dumps(data) + '\n')
+ (ROOT / 'state.json.tmp').write_text(json.dumps(data))
+ (ROOT / 'state.json.tmp').replace(ROOT / 'state.json')
+ self.send_response(204)
+ self.end_headers()
+
+
+if __name__ == '__main__':
+ ROOT.mkdir(exist_ok=True)
+ HTTPServer(('127.0.0.1', 18782), Handler).serve_forever()
diff --git a/os/tests/browser_vm.py b/os/tests/browser_vm.py
new file mode 100644
index 000000000..03cc02541
--- /dev/null
+++ b/os/tests/browser_vm.py
@@ -0,0 +1,277 @@
+#!/usr/bin/env python3
+"""Observe browser sizing, focus and actual input on a disposable installed disk."""
+import argparse
+import hashlib
+import json
+import os
+from pathlib import Path
+import shlex
+import subprocess
+import time
+from PIL import Image
+from footprint_vm import copy_file
+from vm import VM
+from session_vm import screen_text
+
+
+class BrowserVM(VM):
+ def keys(self, *keys):
+ # Use explicit press/release events. send-key's delayed release follows
+ # the VM clock; a host sleep can finish while the guest is still holding
+ # Ctrl during a memory-heavy browser startup. Never paste probe text.
+ for down, sequence in [(True, keys), (False, reversed(keys))]:
+ self.monitor('input-send-event', events=[
+ {'type': 'key', 'data': {'down': down, 'key': {'type': 'qcode', 'data': key}}}
+ for key in sequence])
+ time.sleep(.06)
+
+
+TERMINAL = '''import os, pathlib, sys
+p = pathlib.Path('/tmp/harness-browser-probe')
+(p/'terminal-pid').write_text(str(os.getpid()))
+(p/'terminal-input').write_text('')
+print('HARNESS BROWSER RETURN CHECK', flush=True)
+for line in sys.stdin:
+ with (p/'terminal-input').open('a') as out: out.write(line)
+ print('received: ' + line.rstrip(), flush=True)
+'''
+
+
+def wait_command(vm, command, timeout=15):
+ vm.command('timeout ' + str(timeout) + ' sh -c ' + shlex.quote(
+ 'until ' + command + '; do sleep .1; done'), timeout=timeout + 5)
+
+
+def observe(vm, *args):
+ return 'systemd-run --user --quiet --wait --pipe --collect /tmp/harness-wlrctl ' + shlex.join(args)
+
+
+def focused(vm, app, name, timeout=15, title=None):
+ started = time.monotonic()
+ criteria = ['app_id:' + app, 'state:active']
+ if title:
+ criteria.append('title:' + title)
+ # wlrctl 0.2.2's contains_value rejects enum zero, which is the Wayland
+ # maximized state. Observe focus here; actual page pixels independently
+ # verify display coverage instead of trusting that broken query.
+ wait_command(vm, observe(vm, 'toplevel', 'find', *criteria), timeout)
+ vm.screenshot(name)
+ return round(time.monotonic() - started, 3)
+
+
+def new_tab_ready(vm, name):
+ # For Ctrl+n the old browser can still be active until the new window maps.
+ # Wait for that window's own title and its painted toolbar before typing.
+ focused(vm, 'chromium', name, timeout=45, title='New Tab - Chromium')
+ deadline = time.monotonic() + 15
+ while 'new tab' not in screen_text(vm, name):
+ assert time.monotonic() < deadline, 'The new browser window has not painted'
+ time.sleep(.1)
+
+
+def state(vm, *, path=None, value=None, ready=False, timeout=10):
+ expression = 'import json; d=json.load(open("/tmp/harness-browser-probe/state.json")); '
+ if path is not None:
+ expression += 'assert d["path"] == ' + repr(path) + '; '
+ if value is not None:
+ expression += 'assert d["input"] == ' + repr(value) + '; '
+ if ready:
+ expression += 'assert d["focused"] and d["inputFocused"] and d["outerWidth"] > 0; '
+ wait_command(vm, 'python3 -c ' + shlex.quote(expression), timeout)
+ return json.loads(vm.read_file('/tmp/harness-browser-probe/state.json'))
+
+
+def page_fills_display(vm, name):
+ # Read the actual rendered page, independently from the compositor's state.
+ # Below Chromium's toolbar the fixture color must reach both sides and bottom.
+ # A white frame can be Chromium's previous blank tab, before this page paints.
+ # HTTP load/input events can precede the next compositor frame. Observe a
+ # bounded render deadline, retaining every sample rather than assuming that
+ # receiving the page's event means its pixels are already on the display.
+ started = time.monotonic()
+ while True:
+ vm.screenshot(name)
+ with Image.open(vm.folder / (name + '.png')).convert('RGB') as frame:
+ width, height = frame.size
+ positions = [(3, height//2), (width-4, height//2), (3, height-4), (width-4, height-4)]
+ pixels = [frame.getpixel(position) for position in positions]
+ with (vm.folder / 'display-coverage.jsonl').open('a') as log:
+ log.write(json.dumps(dict(frame=name, seconds=time.monotonic()-started, pixels=pixels)) + '\n')
+ if all(all(abs(actual - expected) <= 3 for actual, expected in zip(pixel, (230, 245, 236)))
+ for pixel in pixels):
+ return
+ assert time.monotonic() - started < 5, (positions, pixels)
+ time.sleep(.1)
+
+
+def check_browser(vm, result):
+ vm.command('! pgrep -u "$(id -u)" -x chromium')
+ result['checks'].append('Browser is absent on installed boot')
+ vm.command('mkdir -p /tmp/harness-browser-probe')
+ copy_file(vm, TERMINAL.encode(), '/tmp/harness-browser-terminal.py')
+ copy_file(vm, Path(__file__).with_name('browser_guest.py').read_bytes(), '/tmp/harness-browser-page.py')
+ vm.command('systemd-run --user --quiet --collect --unit=harness-browser-probe python3 /tmp/harness-browser-page.py')
+ wait_command(vm, 'curl --fail --silent http://127.0.0.1:18782/ >/dev/null')
+ vm.command('hn new-window -n browser-check ' + shlex.quote('python3 /tmp/harness-browser-terminal.py'))
+ wait_command(vm, 'test -s /tmp/harness-browser-probe/terminal-pid')
+ focused(vm, 'hn', 'terminal-before-browser')
+ accepted = []
+
+ def terminal(word):
+ vm.type_probe(word)
+ vm.keys('ret')
+ accepted.append(word + '\n')
+ wait_command(vm, 'python3 -c ' + shlex.quote('from pathlib import Path; '
+ 'assert Path("/tmp/harness-browser-probe/terminal-input").read_text() == ' + repr(''.join(accepted))))
+ vm.command('kill -0 "$(cat /tmp/harness-browser-probe/terminal-pid)"')
+
+ terminal('before-browser')
+ vm.keys('meta_l', 'b')
+ result['cold_start_seconds_including_observer'] = focused(vm, 'chromium', 'browser-shortcut-cold', timeout=45)
+ new_tab_ready(vm, 'browser-shortcut-ready')
+ vm.keys('ctrl', 'l')
+ vm.type_probe('http://127.0.0.1:18782/first')
+ vm.keys('ret')
+ result['page'] = state(vm, path='/first')
+ page_fills_display(vm, 'browser-page-full-display')
+ # Select the actual rendered input label as a user would. HTML autofocus on
+ # first navigation is asynchronous and is not the OS focus contract.
+ vm.click_word('browser-input-click', 'Keyboard')
+ state(vm, path='/first', ready=True)
+ vm.type_probe('browser')
+ state(vm, value='browser')
+ result['checks'].append('Super+b cold-starts a maximized browser; its local page fills the display and receives real keyboard input')
+ result['toggles'] = []
+ for index in range(4):
+ vm.keys('meta_l', 'b')
+ to_terminal = focused(vm, 'hn', 'toggle-terminal-' + str(index))
+ terminal('terminal-' + str(index))
+ state(vm, value='browser' + 'x'*index)
+ vm.keys('meta_l', 'b')
+ to_browser = focused(vm, 'chromium', 'toggle-browser-' + str(index))
+ state(vm, ready=True)
+ vm.type_probe('x')
+ state(vm, value='browser' + 'x'*(index+1))
+ page_fills_display(vm, 'toggle-full-display-' + str(index))
+ result['toggles'].append(dict(to_terminal_seconds=to_terminal, to_browser_seconds=to_browser))
+ result['checks'].append('Repeated Super+b switching routes keyboard input only to the intended surface and preserves the terminal process and browser input')
+ vm.keys('meta_l', 'ret')
+ focused(vm, 'hn', 'explicit-request-terminal')
+ terminal('before-explicit-request')
+ # An explicit URL from an agent/terminal must display its result even while
+ # the existing browser is behind the fullscreen terminal.
+ vm.command('hn-browser http://127.0.0.1:18782/second')
+ focused(vm, 'chromium', 'explicit-url-browser')
+ state(vm, path='/second')
+ page_fills_display(vm, 'explicit-url-full-display')
+ result['checks'].append('An explicit hn-browser URL raises the already running browser from behind Harness')
+ vm.keys('ctrl', 'n')
+ new_tab_ready(vm, 'new-browser-window')
+ vm.keys('ctrl', 'l')
+ vm.type_probe('http://127.0.0.1:18782/new-window')
+ vm.keys('ret')
+ state(vm, path='/new-window')
+ page_fills_display(vm, 'new-window-full-display')
+ vm.keys('ctrl', 'shift', 'w')
+ focused(vm, 'chromium', 'original-browser-restored')
+ vm.keys('ctrl', 'shift', 'w')
+ focused(vm, 'hn', 'browser-closed-terminal')
+ terminal('after-browser-close')
+ wait_command(vm, '! pgrep -u "$(id -u)" -x chromium')
+ vm.keys('meta_l', 'b')
+ new_tab_ready(vm, 'browser-reopened')
+ vm.keys('ctrl', 'l')
+ vm.type_probe('http://127.0.0.1:18782/reopened')
+ vm.keys('ret')
+ state(vm, path='/reopened')
+ page_fills_display(vm, 'reopened-full-display')
+ vm.keys('meta_l', 'b')
+ focused(vm, 'hn', 'browser-final-return')
+ terminal('after-browser-reopen')
+ result['checks'].append('New browser windows maximize; close and reopen restores working keyboard focus without losing the terminal')
+
+
+def main():
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument('--iso', type=Path, required=True)
+ parser.add_argument('--firmware', choices=['bios', 'uefi'], required=True)
+ parser.add_argument('--memory-mib', type=int, choices=[1024, 2048, 4096], default=1024)
+ parser.add_argument('--wlrctl', type=Path, required=True)
+ parser.add_argument('--browser-script', type=Path, required=True)
+ parser.add_argument('--compositor-config', type=Path, required=True)
+ args = parser.parse_args()
+ if not os.access('/dev/kvm', os.R_OK | os.W_OK):
+ parser.error('Native x86 KVM is required')
+ iso = args.iso.resolve()
+ manifest = json.loads(iso.with_name('manifest.json').read_text())
+ with iso.open('rb') as handle:
+ assert hashlib.file_digest(handle, 'sha256').hexdigest() == manifest['iso']['sha256']
+ folder = Path(f'os/test-results/{args.firmware}-browser').resolve()
+ folder.mkdir(parents=True, exist_ok=False)
+ vm = BrowserVM(folder, iso, args.firmware, args.memory_mib, cpu='Nehalem')
+ config = dict(disk='/dev/vda', expected_serial='HN_OS_TEST', confirm_erase='/dev/vda', username='me',
+ hostname='harness', password='test-password-123', encrypt=args.firmware == 'uefi', serial_console=True)
+ result = dict(status='running', started_at=time.time(), checks=[], firmware=args.firmware,
+ image_source_commit=manifest['source_commit'], iso_sha256=manifest['iso']['sha256'],
+ test_source_commit=subprocess.check_output(['git','rev-parse','HEAD'],text=True).strip(),
+ memory_mib=args.memory_mib, candidates={},
+ observer=dict(sha256=hashlib.sha256(args.wlrctl.read_bytes()).hexdigest(),
+ version=subprocess.check_output([str(args.wlrctl),'--version'],text=True).strip()),
+ limitations=['Only the two recorded candidate files replace packaged files in the disposable guest.',
+ 'Native virtual display and physical-keyboard events; not a physical laptop or GPU claim.',
+ 'Observer and screenshot overhead are included in transition timings.'])
+ try:
+ vm.start(live=True)
+ vm.wait(r'root@[^\r\n]*[#] ', timeout=180)
+ vm.shell_ready = True
+ vm.command('stty -echo')
+ copy_file(vm, json.dumps(config).encode(), '/tmp/install-config.json')
+ vm.command('nmcli networking off')
+ output, _ = vm.command('harness install --config /tmp/install-config.json --yes-erase-disk', timeout=360)
+ (folder / 'install.log').write_text(output)
+ vm.command('sync')
+ vm.stop()
+ vm.start(live=False)
+ vm.login_installed(config)
+ result['installed_runtime_ready_seconds_including_test_login'] = round(time.monotonic() - vm.started, 3)
+ vm.command('printf %s ' + shlex.quote(config['password']+'\n') + ' | sudo -S -v')
+ vm.command('systemctl --user stop harness-update.timer harness-update.service')
+ copy_file(vm, args.wlrctl.read_bytes(), '/tmp/harness-wlrctl')
+ vm.command('chmod 700 /tmp/harness-wlrctl')
+ for source, target, mode in [(args.browser_script, '/usr/bin/hn-browser', '755'),
+ (args.compositor_config, '/usr/share/harness-os/labwc/rc.xml', '644')]:
+ data = source.read_bytes()
+ base = vm.read_file(target)
+ result['candidates'][target] = dict(source=str(source), sha256=hashlib.sha256(data).hexdigest(),
+ original_sha256=hashlib.sha256(base).hexdigest(), changed=data != base)
+ copy_file(vm, data, '/tmp/browser-candidate')
+ vm.command('sudo install -m ' + mode + ' /tmp/browser-candidate ' + shlex.quote(target))
+ vm.command('systemd-run --user --quiet --wait --pipe --collect labwc --reconfigure')
+ check_browser(vm, result)
+ result['status'] = 'passed'
+ except BaseException as error:
+ result.update(status='failed', error=repr(error))
+ try:
+ vm.screenshot('failure')
+ output, _ = vm.command(observe(vm, 'toplevel', 'list'), check=False)
+ (folder / 'failure-windows.txt').write_text(output)
+ output, _ = vm.command('sudo -n journalctl -b --no-pager -n 150; '
+ 'cat /proc/meminfo; ps -u 1000 -o pid,ppid,rss,args --width 200', check=False)
+ (folder / 'failure-journal.log').write_text(output)
+ except Exception as diagnostic:
+ result['diagnostic_error'] = repr(diagnostic)
+ raise
+ finally:
+ if vm.shell_ready:
+ for name in ['events.jsonl', 'state.json', 'terminal-input']:
+ try:
+ (folder / name).write_bytes(vm.read_file('/tmp/harness-browser-probe/' + name))
+ except Exception:
+ pass
+ result['finished_at'] = time.time()
+ (folder / 'receipt.json').write_text(json.dumps(result,indent=2)+'\n')
+ vm.stop()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/os/tests/essentials_vm.py b/os/tests/essentials_vm.py
index a78c3ab33..55d4d6068 100644
--- a/os/tests/essentials_vm.py
+++ b/os/tests/essentials_vm.py
@@ -100,7 +100,7 @@ def wireless(vm, result, installed=False):
vm.command('! ip route show default | grep -v "dev $(cat /run/harness-station)"')
form = 'sudo python3 /usr/lib/harness-os/network.py --first-use; result=$?; printf %s "$result" > /tmp/wifi-form-result; exec bash -l'
vm.command(USER_ENV + 'hn new-window -n Wi-Fi ' + shlex.quote(form))
- offline_label = 'continue offline' if installed else 'install without connecting'
+ offline_label = 'set up later' if installed else 'install without connecting'
wait_screen(vm, ['harness-test', offline_label], 'wifi-01-networks')
vm.keys('esc')
wait_screen(vm, ['harness-test'], 'wifi-01-escape-keeps-welcome')
diff --git a/os/tests/fast_update_vm.py b/os/tests/fast_update_vm.py
index bf2d5b952..0244347e9 100644
--- a/os/tests/fast_update_vm.py
+++ b/os/tests/fast_update_vm.py
@@ -31,6 +31,19 @@ def wait_text(vm, text, name, status_bar=False):
def exercise(vm, fixture, host_url):
+ # Observe the actual curses event and hit targets without changing mouse
+ # modes, coordinates or dispatch. This runs only in the disposable guest;
+ # restore the packaged module before the separate system-channel checks.
+ source_path = '/usr/lib/harness-os/live_update.py'
+ original = vm.read_file(source_path).decode()
+ marker = ' _, x, y, _, buttons = curses.getmouse()\n'
+ assert original.count(marker) == 1
+ traced = original.replace(marker, marker +
+ " with open('/tmp/harness-update-mouse.jsonl', 'a') as trace:\n" +
+ " trace.write(json.dumps(dict(x=x, y=y, buttons=buttons, targets=targets)) + '\\n')\n")
+ put(vm, '/tmp/live-update-observed.py', traced)
+ put(vm, '/tmp/live-update-packaged.py', original)
+ vm.command('sudo install -m 755 /tmp/live-update-observed.py ' + source_path)
vm.command('sudo nmcli networking on')
vm.command('nm-online -q --timeout=30', timeout=35)
vm.command('mkdir -p /tmp/fast-updates')
@@ -72,8 +85,10 @@ def exercise(vm, fixture, host_url):
vm.command('hn show-options -gv status-right > /tmp/fast-footer.txt')
footer = vm.read_file('/tmp/fast-footer.txt').decode()
assert 'local_machine' in footer and '%H:%M' in footer and '@harness-update' not in footer, footer
- vm.keys('meta_l', 'u')
- wait_text(vm, 'an update is ready', 'fast-01-ready')
+ # Opening the command screen permits inspection without starting an update.
+ # The OS shortcut itself is the user's request to apply it immediately.
+ vm.command("hn new-window -n Updates '/usr/bin/harness updates'")
+ wait_text(vm, 'update available', 'fast-01-ready')
vm.keys('esc')
# Closing the shell is asynchronous. The OS shortcut reuses a named Updates
# window, so reopening before its removal can select the closing window and
@@ -104,15 +119,28 @@ assert (root/'heartbeat').stat().st_mtime_ns != before
' ~/projects/session-probe/input && exit 0; sleep .1; done; exit 1')
vm.screenshot(name + '-accepted-input')
- def activate(expect_failure=False):
- vm.keys('meta_l', 'u')
- # After a failed activation the same screen offers a retry.
- wait_text(vm, 'system updates', 'fast-02-update-action')
- vm.keys('ret')
+ def activate(expect_failure=False, mouse=False):
+ if mouse:
+ vm.command("hn select-window -t Updates || hn new-window -n Updates '/usr/bin/harness updates'")
+ wait_text(vm, 'update available', 'fast-02-update-action')
+ vm.click_word('fast-02-click-update', 'Update')
+ else:
+ vm.keys('meta_l', 'u')
condition = ('grep -q ' + shlex.quote('"status": "failed"') + ' ' + state + '/transaction.json' if expect_failure else
'test ! -e ' + state + '/ready.json && test -s ' + state + '/applied.json')
- vm.command('for n in $(seq 1 120); do ' + condition + ' && systemctl --user is-active --quiet hn-screen && exit 0; sleep .5; done; '
- 'sudo journalctl _UID=1000 --no-pager; exit 1', timeout=90)
+ try:
+ vm.command('for n in $(seq 1 120); do ' + condition + ' && systemctl --user is-active --quiet hn-screen && exit 0; sleep .5; done; '
+ 'sudo journalctl _UID=1000 --no-pager; exit 1', timeout=90)
+ finally:
+ if mouse:
+ vm.command('touch /tmp/harness-update-mouse.jsonl')
+ observed = vm.read_file('/tmp/harness-update-mouse.jsonl')
+ (vm.folder / 'update-mouse-events.log').write_bytes(observed)
+ if mouse:
+ events = [json.loads(line) for line in observed.splitlines()]
+ assert any(event['y'] == row and left <= event['x'] < right and action == 'update'
+ for event in events for row, left, right, action in event['targets']), \
+ 'The actual curses mouse event did not reach the Update hit target'
# A real systemd start failure for the new binary must restore the old
# selection and layout. The fault is a private guest-only unit override.
@@ -126,18 +154,18 @@ assert (root/'heartbeat').stat().st_mtime_ns != before
checks.append('A real new-screen start failure restores the previous binary and visible tabs while the same agent and terminal remain alive')
vm.command('rm ~/.config/systemd/user/hn-screen.service.d/fixture.conf; systemctl --user daemon-reload')
- activate()
+ activate(mouse=True)
vm.command('hn --version | grep -F "999.0.1"')
vm.command('test "$(systemctl --user show harness-daemon -p MainPID --value)" = "$(cat /tmp/fast-original-daemon)"')
alive('hn-update')
- checks.append('Super+U and Enter activate the real new hn binary; daemon PID, live OpenCode, terminal PID, keyboard input and boot ID survive')
+ checks.append('Clicking Update activates the real new hn binary with no confirmation; daemon PID, live OpenCode, terminal PID, keyboard input and boot ID survive')
# Add a CLI release through the same channel, independently of hn's version.
vm.command('harness updates check --feeds /tmp/fast-updates/feeds-both.json', timeout=90)
activate()
vm.command('test "$(harness version)" = 999.0.1')
vm.command('test "$(systemctl --user show harness-daemon -p MainPID --value)" != "$(cat /tmp/fast-original-daemon)"')
alive('cli-update')
- checks.append('A separate CLI release restarts its supervised service while the same OpenCode and terminal processes remain alive')
+ checks.append('Super+u alone activates a separate CLI release while the same OpenCode and terminal processes remain alive')
vm.command('systemd-run --user --collect --unit=harness-test-rollback /usr/bin/python3 /usr/lib/harness-os/live_update.py rollback')
vm.command('for n in $(seq 1 120); do test "$(harness version)" != 999.0.1 && '
'systemctl --user is-active --quiet hn-screen && exit 0; sleep .5; done; exit 1', timeout=90)
@@ -146,6 +174,7 @@ assert (root/'heartbeat').stat().st_mtime_ns != before
output, _ = vm.command('harness updates status; systemctl --user status harness-update.timer --no-pager; '
'sudo journalctl _UID=1000 --no-pager')
(vm.folder / 'fast-updates.log').write_text(output)
+ vm.command('sudo install -m 755 /tmp/live-update-packaged.py ' + source_path)
receipt = {'status': 'passed', 'fixture': json.loads((fixture / 'fixture.json').read_text()), 'checks': checks}
(vm.folder / 'fast-update-receipt.json').write_text(json.dumps(receipt, indent=2) + '\n')
return receipt
diff --git a/os/tests/release_update_vm.py b/os/tests/release_update_vm.py
index fec151e1e..1786b9319 100644
--- a/os/tests/release_update_vm.py
+++ b/os/tests/release_update_vm.py
@@ -1,14 +1,17 @@
"""Exercise the actual OS release transport on a disposable installed VM."""
import json
import shlex
-from session_vm import put
+import time
+from session_vm import put, PROBE
-def exercise(vm, manifest):
+def exercise(vm, manifest, config):
# Retain the new bootstrap outside pacman-owned paths before restoring the
# public preview. It has no updater; this is its one-time migration path.
vm.command('mkdir -p /tmp/system-channel; cp /usr/lib/harness-os/release_update.py '
- '/usr/lib/harness-os/runtime_update.py /tmp/system-channel/')
+ '/usr/lib/harness-os/runtime_update.py /usr/lib/harness-os/live_update.py '
+ '/usr/lib/harness-os/open-updates /tmp/system-channel/; '
+ 'sudo cat /etc/sudoers.d/30-harness-updates > /tmp/system-channel/30-harness-updates')
vm.command('cp /home/me/update-bundle/package-manifest.json /tmp/fast-updates/; '
'cp /home/me/update-bundle/' + shlex.quote(manifest['package']['name']) + ' /tmp/fast-updates/')
builder = '''import hashlib, json, pathlib
@@ -23,32 +26,108 @@ metadata = dict(schema=1, channel='preview', architecture='x86_64',
'''
put(vm, '/tmp/system-channel/make-feed.py', builder)
vm.command('python3 /tmp/system-channel/make-feed.py')
+ vm.command('systemctl --user stop harness-update.timer harness-update.service; '
+ 'mkdir -p ~/update-test; cp -R /tmp/system-channel ~/update-test/; '
+ 'cp -R /tmp/fast-updates ~/update-test/')
vm.command('sudo harness rollback', timeout=180)
+ # A rollback requires a real reboot just like an upgrade. Keep this guard
+ # intact, then start fresh running-work probes on the restored OS.
+ vm.command('sync')
+ vm.stop()
+ vm.start(live=False)
+ vm.login_installed(config)
+ vm.command('printf %s ' + shlex.quote(config['password'] + '\n') + ' | sudo -S -v')
+ vm.command('systemctl --user stop harness-update.timer harness-update.service; '
+ 'cp -R ~/update-test/system-channel ~/update-test/fast-updates /tmp/; '
+ 'test ! -e /run/harness-os-restart-required')
+ # The preceding independent rollback test deliberately rejects its 999.x
+ # runtime. Reset only that private fixture hold for this combined-update
+ # case; production checks must continue to honor a user's rejected version.
+ vm.command('rm -f ~/.local/state/harness-os/updates/ignored.json')
+ vm.command('systemd-run --user --collect --unit=harness-test-feed python3 -m http.server 19447 '
+ '--bind 127.0.0.1 --directory /tmp/fast-updates')
+ vm.command('for n in $(seq 1 30); do curl -fsS http://127.0.0.1:19447/fixture.json && exit 0; sleep .2; done; exit 1')
+ put(vm, '/tmp/update-session-probe.py', PROBE)
+ vm.command('rm -f ~/projects/session-probe/pid; '
+ 'hn new-window -n channel-probe ' + shlex.quote('python3 /tmp/update-session-probe.py'))
+ vm.command('for n in $(seq 1 40); do test -s ~/projects/session-probe/pid && exit 0; sleep .25; done; exit 1;')
+ vm.command('cp ~/projects/session-probe/pid /tmp/fast-original-pid; '
+ 'cat /proc/sys/kernel/random/boot_id > /tmp/fast-original-boot; '
+ 'hn new-window -n channel-agent opencode')
+ vm.command('for n in $(seq 1 80); do pgrep -u 1000 -x opencode > /tmp/fast-original-agent && exit 0; sleep .25; done; exit 1')
feed = ' --feed http://127.0.0.1:19447/os-metadata.json'
updater = 'python3 /tmp/system-channel/release_update.py '
def available(expected):
vm.command(updater + 'check' + feed + ' > /tmp/system-channel/discovery.json')
vm.command('python3 -c ' + shlex.quote("import json; assert json.load(open('/tmp/system-channel/discovery.json'))['available'] is " + str(expected)))
available(True)
- checks = ['Restored public preview discovers the newer real OS package through the verified release manifest']
+ checks = ['Restored public preview reboots and discovers the newer real OS package through the verified release manifest']
package = '/tmp/fast-updates/' + manifest['package']['name']
vm.command('cp ' + shlex.quote(package) + ' /tmp/good-os-package; printf broken > ' + shlex.quote(package))
_, status = vm.command('sudo ' + updater + 'apply' + feed, timeout=180, check=False)
assert status != 0, 'A corrupt channel package was accepted'
checks.append('A corrupt download is rejected before the package transaction')
vm.command('cp /tmp/good-os-package ' + shlex.quote(package))
- output, _ = vm.command('sudo ' + updater + 'apply' + feed, timeout=180)
- (vm.folder / 'system-channel-apply.log').write_text(output)
+ # Restore the candidate UI on the old package solely to exercise its new
+ # combined action. Only the root helper's parser default uses the private
+ # loopback feed; the shipped helper never accepts a user-owned feed cache.
+ vm.command('sudo install -m 644 /tmp/system-channel/live_update.py /usr/lib/harness-os/live_update.py; '
+ 'sudo install -m 755 /tmp/system-channel/open-updates /usr/lib/harness-os/open-updates; '
+ # The old package does not own the new policy path. Use a
+ # fixture-only name so pacman can install its actual owned file
+ # without an unrelated "exists in filesystem" collision.
+ 'sudo install -m 440 /tmp/system-channel/30-harness-updates /etc/sudoers.d/99-harness-test-updates')
+ helper = vm.read_file('/tmp/system-channel/release_update.py').decode().replace(
+ "parser.add_argument('--feed', default=FEED,", "parser.add_argument('--feed', default='http://127.0.0.1:19447/os-metadata.json',")
+ put(vm, '/tmp/system-channel/test-release-helper.py', helper)
+ vm.command('sudo install -m 644 /tmp/system-channel/test-release-helper.py /usr/lib/harness-os/release_update.py; '
+ 'sudo visudo -c -f /etc/sudoers')
+ vm.command('mkdir -p ~/.local/state/harness-os/updates; printf %s ' + shlex.quote(json.dumps(
+ {'available': True, 'checked_at': time.time(), 'version': manifest['package']['version']})) +
+ ' > ~/.local/state/harness-os/updates/system.json')
+ # A live Updates window may still be executing the pre-rollback module.
+ # Close only that fixture's UI pane before opening the candidate with Super+u.
+ vm.command('hn kill-window -t Updates 2>/dev/null || true')
+ vm.command('sudo -K')
+ for denied in ['/usr/bin/true', '/usr/bin/harness upgrade /tmp/untrusted-update']:
+ output, status = vm.command('sudo -n ' + denied, check=False)
+ assert status != 0 and 'password' in output.lower(), output
+ vm.keys('meta_l', 'u')
+ vm.command('for n in $(seq 1 360); do test -s ~/.local/state/harness-os/updates/approved.json && '
+ 'grep -q after-reboot ~/.local/state/harness-os/updates/approved.json && exit 0; sleep .5; done; exit 1', timeout=190)
+ vm.screenshot('system-channel-single-action-no-password')
vm.command('test "$(pacman -Q harness-os)" = ' + shlex.quote('harness-os ' + manifest['package']['version']))
+ # The new package now owns its real policy. Remove the bootstrap fixture
+ # only after passwordless activation has been independently established.
+ vm.command('printf %s ' + shlex.quote(config['password'] + '\n') + ' | sudo -S -v; '
+ 'sudo rm /etc/sudoers.d/99-harness-test-updates; sudo -K')
vm.command('while read -r pid; do kill -0 "$pid" || exit 1; done < /tmp/fast-original-agent; '
'kill -0 "$(cat /tmp/fast-original-pid)"; cmp /tmp/fast-original-boot /proc/sys/kernel/random/boot_id')
vm.command('python3 -c ' + shlex.quote("import json; assert json.load(open('/run/harness-os-restart-required'))['status'] == 'ready'"))
available(False)
- checks.append('Private root download applies offline from loopback, rebuilds initramfs, preserves live processes and offers no duplicate update')
+ checks.append('Super+u alone applies the verified OS package with no sudo credential, confirmation or password; unrelated root commands and local bundles remain denied')
+ checks.append('Private root download rebuilds initramfs and preserves live processes; no duplicate update is offered')
_, status = vm.command('harness updates apply', check=False)
assert status != 0, 'Fast runtime changed before the OS restart'
checks.append('Fast activation stays paused until the OS reboot')
+ # Keep the private release server outside volatile /tmp for the one approved
+ # post-reboot runtime step. This is test-only, never part of the OS image.
+ vm.command('mkdir -p ~/update-test; cp -R /tmp/fast-updates/. ~/update-test/; '
+ 'printf %s ' + shlex.quote('[Service]\nExecStart=\nExecStart=/usr/bin/python3 /usr/lib/harness-os/live_update.py check --feeds /home/me/update-test/feeds-both.json\n') +
+ ' > ~/.config/systemd/user/harness-update.service.d/fixture.conf; systemctl --user daemon-reload')
receipt = {'status': 'passed', 'source_commit': manifest['source_commit'],
'package': manifest['package'], 'checks': checks}
(vm.folder / 'system-channel-receipt.json').write_text(json.dumps(receipt, indent=2) + '\n')
return receipt
+
+
+def finish_after_reboot(vm):
+ vm.command('systemd-run --user --collect --unit=harness-test-feed python3 -m http.server 19447 '
+ '--bind 127.0.0.1 --directory /home/me/update-test')
+ vm.command('for n in $(seq 1 30); do curl -fsS http://127.0.0.1:19447/fixture.json && exit 0; sleep .2; done; exit 1')
+ # The original approval authorizes this once. No second shortcut is sent.
+ vm.command('systemctl --user start harness-update.service', timeout=240)
+ vm.command('test ! -e ~/.local/state/harness-os/updates/approved.json; '
+ 'hn --version | grep -F 999.0.1; test "$(harness version)" = 999.0.1')
+ vm.screenshot('system-channel-approved-runtime-finished')
+ return 'The same update request finishes hn/CLI against the new OS base after encrypted reboot, without another confirmation or shortcut'
diff --git a/os/tests/test_installer.py b/os/tests/test_installer.py
index 6a10d983c..2feef9c4b 100644
--- a/os/tests/test_installer.py
+++ b/os/tests/test_installer.py
@@ -300,6 +300,7 @@ class Screen:
"""Capture drawn text and supply keys; never expose a real disk or terminal."""
def __init__(self):
self.keys, self.frames, self.drawn = [], [], []
+ self.drawn_rows, self.attributes = {}, []
self.size = (24, 80)
def getmaxyx(self):
@@ -307,17 +308,21 @@ class Screen:
def erase(self):
self.drawn = []
+ self.drawn_rows = {}
clear = erase
def addnstr(self, row, column, text, length, attr=0):
self.drawn.append(text[:length])
+ self.drawn_rows.setdefault(row, []).append((column, text[:length]))
+ self.attributes.append((row, column, text[:length], attr))
def addstr(self, row, column, text, attr):
self.drawn.append(text)
def refresh(self):
- self.frames.append('\n'.join(self.drawn))
+ self.frames.append('\n'.join(''.join(text for _, text in sorted(parts))
+ for _, parts in sorted(self.drawn_rows.items())))
def keypad(self, enabled):
pass
@@ -358,7 +363,7 @@ class InstallationCompletion(unittest.TestCase):
self.assertEqual(installer.completion(screen), shutdown)
flush.assert_called_once()
self.assertIn('Harness is installed.', screen.frames[0])
- self.assertIn('Remove the USB after shutdown.', screen.frames[0])
+ self.assertIn('remove the USB', screen.frames[0])
class InteractiveInstall(unittest.TestCase):
@@ -405,6 +410,9 @@ class InteractiveInstall(unittest.TestCase):
self.assertEqual(config['expected_serial'], 'HN_TEST')
self.assertEqual(config['password'], self.secret)
self.assertIn('Encryption [x]', self.screen.frames[0])
+ for _, _, text, attr in self.screen.attributes:
+ if text.strip() in ('Disk', 'Encryption', 'Password', 'Repeat password'):
+ self.assertFalse(attr & installer.curses.A_REVERSE)
first = self.screen.frames[0]
for clutter in ('me@', '/dev/', 'HN_TEST', 'Tab move', 'Space toggle', 'eight characters'):
self.assertNotIn(clutter, first)
diff --git a/os/tests/test_live_update.py b/os/tests/test_live_update.py
index 8c94b3638..0f17ce493 100644
--- a/os/tests/test_live_update.py
+++ b/os/tests/test_live_update.py
@@ -1,4 +1,5 @@
import hashlib
+import curses
import fcntl
import importlib.util
import json
@@ -26,6 +27,7 @@ class FastUpdates(unittest.TestCase):
(self.bundled / name).write_bytes(('old ' + name).encode())
self.patches = [patch.object(update, 'STATE', self.state), patch.object(update, 'BUNDLED', self.bundled),
patch.object(update, 'BASE_ID', self.base),
+ patch.object(update, 'BOOT_ID', self.root / 'boot-id'),
patch.object(update, 'RESTART_REQUIRED', self.root / 'restart-required'),
patch.object(update, 'SYSTEM_LOCK', self.root / 'system.lock'),
patch.object(update, 'check_system', return_value={}),
@@ -34,6 +36,7 @@ class FastUpdates(unittest.TestCase):
for item in self.patches:
item.start()
self.addCleanup(item.stop)
+ update.BOOT_ID.write_text('first-boot')
def versions(self, folder):
return {component: '1.1.0' if (folder / name).read_bytes().startswith(b'new') else '1.0.0'
@@ -229,6 +232,101 @@ class FastUpdates(unittest.TestCase):
update.prune()
self.assertTrue(old_runtime.is_dir())
+ def show(self, keys, mouse=None, refresh=False):
+ class Window:
+ def __init__(self): self.drawn, self.keys = [], iter(keys)
+ def keypad(self, _): pass
+ def timeout(self, _): pass
+ def getmaxyx(self): return 30, 90
+ def erase(self): self.drawn.clear()
+ def refresh(self): pass
+ def addnstr(self, row, col, text, length, style): self.drawn.append((row, col, text[:length]))
+ def getch(self): return next(self.keys)
+ window = Window()
+ def event():
+ row, col, text = next(item for item in window.drawn if item[2] == '[ Update ]')
+ return 0, col + (2 if mouse == 'inside' else len(text) + 1), row, 0, curses.BUTTON1_CLICKED
+ with patch.object(update.curses, 'curs_set'), patch.object(update.curses, 'has_colors', return_value=False), \
+ patch.object(update.curses, 'mousemask'), patch.object(update.curses, 'mouseinterval'), \
+ patch.object(update.curses, 'getmouse', side_effect=event):
+ return update.screen(window, refresh=refresh)
+
+ def test_update_button_click_and_keyboard_use_the_same_action_without_a_confirmation(self):
+ with self.feed(): update.check()
+ self.assertEqual(self.show([10]), 'update')
+ self.assertEqual(self.show([curses.KEY_MOUSE], mouse='inside'), 'update')
+ self.assertIsNone(self.show([curses.KEY_MOUSE, 27], mouse='outside'))
+ self.assertIsNone(self.show([27]))
+ self.assertEqual(update.selected(), self.bundled)
+
+ def test_shortcut_request_starts_update_without_waiting_for_a_key(self):
+ with self.feed(): update.check()
+ update.write(self.state / 'request.json', {'requested_at': 1})
+ self.assertEqual(self.show([]), 'update')
+ self.assertFalse((self.state / 'request.json').exists())
+
+ def test_restart_is_never_the_default_action_or_triggered_by_update_shortcut(self):
+ self.state.mkdir()
+ update.RESTART_REQUIRED.write_text('{"status":"ready"}')
+ update.write(self.state / 'request.json', {'requested_at': 1})
+ self.assertIsNone(self.show([10]))
+ self.assertEqual(self.show([curses.KEY_RIGHT, 10]), 'reboot')
+
+ def test_one_action_uses_exact_passwordless_system_command_and_defers_runtime_until_reboot(self):
+ with self.feed(): update.check()
+ update.write(self.state / 'system.json', {'available': True})
+ def system(args, **kwargs):
+ self.assertEqual(args, ['sudo', '-n', '/usr/bin/harness', 'upgrade'])
+ self.assertTrue(kwargs['check'])
+ update.RESTART_REQUIRED.write_text('{"status":"ready"}')
+ with patch.object(update.subprocess, 'run', side_effect=system), patch.object(update, 'apply') as apply:
+ update.update_all()
+ update.finish_approved_update()
+ apply.assert_not_called()
+ self.assertEqual(update.read(self.state / 'approved.json')['status'], 'after-reboot')
+ update.RESTART_REQUIRED.unlink()
+ update.BOOT_ID.write_text('second-boot')
+ with patch.object(update, 'restart') as restart:
+ update.finish_approved_update()
+ self.assertEqual(restart.call_count, 1)
+ update.finish_approved_update()
+ self.assertEqual(restart.call_count, 1)
+ self.assertFalse((self.state / 'approved.json').exists())
+
+ def test_failed_privileged_update_does_not_authorize_later_activation(self):
+ self.state.mkdir()
+ update.write(self.state / 'system.json', {'available': True})
+ with patch.object(update.subprocess, 'run', side_effect=subprocess.CalledProcessError(1, 'sudo')):
+ with self.assertRaises(subprocess.CalledProcessError): update.update_all()
+ self.assertFalse((self.state / 'approved.json').exists())
+
+ def test_later_timer_cannot_activate_without_a_request_or_after_base_changes(self):
+ with self.feed(): update.check()
+ with patch.object(update, 'apply') as apply:
+ update.finish_approved_update()
+ apply.assert_not_called()
+ update.write(self.state / 'approved.json', {'status':'after-reboot', 'boot_id':'earlier', 'base_sha256':'changed'})
+ with patch.object(update, 'apply') as apply, self.assertRaisesRegex(ValueError, 'system changed'):
+ update.finish_approved_update()
+ apply.assert_not_called()
+ self.assertEqual(update.read(self.state / 'approved.json')['status'], 'failed')
+
+ def test_explicit_recheck_clears_failed_completion_when_no_updates_remain(self):
+ self.state.mkdir()
+ update.write(self.state / 'approved.json', {'status': 'failed'})
+ with patch.object(update, 'check', return_value=False):
+ self.assertIsNone(self.show([10], refresh=True))
+ self.assertFalse((self.state / 'approved.json').exists())
+
+ def test_retry_keeps_the_request_so_recovered_downloads_apply_without_another_key(self):
+ with patch.object(update.os, 'geteuid', return_value=1000), \
+ patch.object(update.curses, 'wrapper', side_effect=['check', None]):
+ update.main(['screen'])
+ self.assertTrue((self.state / 'request.json').exists())
+ with self.feed():
+ self.assertEqual(self.show([], refresh=True), 'update')
+ self.assertFalse((self.state / 'request.json').exists())
+
if __name__ == '__main__':
unittest.main()
diff --git a/os/tests/test_network.py b/os/tests/test_network.py
index 468cf5bd3..00cde81b5 100644
--- a/os/tests/test_network.py
+++ b/os/tests/test_network.py
@@ -20,14 +20,18 @@ WIFI = dict(ssid='a:network', device='wlan0', security='WPA2', active=False, sig
class Screen:
def __init__(self, keys):
self.keys, self.lines = iter(keys), []
+ self.size, self.frames, self.current = (24, 80), [], []
def keypad(self, value): pass
def timeout(self, value): pass
- def refresh(self): pass
- def erase(self): pass
+ def refresh(self): self.frames.append(list(self.current))
+ def erase(self): self.current = []
def move(self, *args): pass
- def getmaxyx(self): return 24, 80
+ def getmaxyx(self): return self.size
def get_wch(self): return next(self.keys)
- def addnstr(self, row, column, text, width, style): self.lines.append((row, text.rstrip()))
+ def addnstr(self, row, column, text, width, style):
+ assert 0 <= row < self.size[0] and 0 <= column < self.size[1] and column + width < self.size[1]
+ self.lines.append((row, text.rstrip()))
+ self.current.append((row, column, text, style))
class Network(unittest.TestCase):
@@ -112,6 +116,24 @@ class Network(unittest.TestCase):
self.assertEqual(page.run(), 0)
scan.assert_not_called()
+ def test_crowded_scan_scrolls_to_last_network_and_keeps_escape_reachable(self):
+ for size in [(24, 54), (45, 160)]:
+ screen, page = self.page([], live=False)
+ screen.size = size
+ networks = [dict(WIFI, ssid=f'network-{i:02}') for i in range(23)]
+ # 23 networks, Rescan, Ethernet, Set up later. Move directly to the
+ # last network, escape its password, then wrap to Set up later.
+ screen.keys = iter([curses.KEY_DOWN] * 22 + ['\n', '\x1b', curses.KEY_DOWN, curses.KEY_DOWN, curses.KEY_DOWN, '\n'])
+ with patch.object(network, 'scan', return_value=networks), patch.object(network, 'connect', return_value=False) as connect:
+ self.assertEqual(page.run(), network.OFFLINE)
+ self.assertEqual(connect.call_args.args[0]['ssid'], 'network-22')
+ for frame in screen.frames:
+ names = [text for _, _, text, _ in frame if text.startswith('network-')]
+ self.assertLessEqual(len(names), 10)
+ if names:
+ self.assertTrue(any('Rescan' in text for _, _, text, _ in frame))
+ self.assertTrue(any('Set up later' in text for _, _, text, _ in frame))
+
def test_open_network_failure_does_not_ask_for_a_nonexistent_password(self):
screen, page = self.page(['\n', 'i'])
with patch.object(network, 'scan', return_value=[dict(WIFI, security='--')]), \
diff --git a/os/tests/update_vm.py b/os/tests/update_vm.py
index 6d8ca8b49..de430d016 100644
--- a/os/tests/update_vm.py
+++ b/os/tests/update_vm.py
@@ -102,12 +102,14 @@ def main():
from fast_update_vm import exercise
receipt['fast_updates'] = exercise(vm, args.fast_fixture, url)
from release_update_vm import exercise as release_exercise
- receipt['system_channel'] = release_exercise(vm, manifest)
+ receipt['system_channel'] = release_exercise(vm, manifest, config)
vm.command('sync')
vm.stop()
vm.start(live=False)
vm.login_installed(config)
vm.command('test ! -e /run/harness-os-restart-required; test -s ~/projects/update-survivor/keep.txt')
+ from release_update_vm import finish_after_reboot
+ receipt['system_channel']['checks'].append(finish_after_reboot(vm))
receipt['system_channel']['reboot_keyboard'] = check_graphical_keyboard(vm, 'system-channel-reboot')
receipt['checks'].append('The OS-channel update boots its rebuilt encrypted image and accepts keyboard input')
receipt['status'] = 'passed'
@@ -116,7 +118,12 @@ def main():
receipt['error'] = str(error)
try:
vm.screenshot('failure')
- output, _ = vm.command('sudo journalctl _UID=1000 --no-pager; '
+ # Collect diagnostics after the failed assertion. The actual update
+ # test cleared credentials; never block its error path on a prompt.
+ vm.command('printf %s ' + shlex.quote(config['password'] + '\n') + ' | sudo -S -v')
+ output, _ = vm.command('sudo -n journalctl _UID=1000 --no-pager; '
+ 'sudo -n cat /var/lib/harness-os/runtime-updates/*/receipt.json; '
+ 'tail -n 100 /var/log/pacman.log; hn capture-pane -p -S -200 -t Updates; '
'cat ~/.local/state/harness-os/updates/*.json; hn list-windows -a; hn list-panes -a; '
'ps -u 1000 -o pid,ppid,args --width 200', timeout=30, check=False)
(folder / 'update-diagnostics.log').write_text(output)
diff --git a/os/tests/vm.py b/os/tests/vm.py
index 90303e557..35139f428 100644
--- a/os/tests/vm.py
+++ b/os/tests/vm.py
@@ -287,17 +287,24 @@ class VM:
{'type': 'abs', 'data': {'axis': 'x', 'value': x}},
{'type': 'abs', 'data': {'axis': 'y', 'value': y}},
])
+ # Move before pressing, as a person does. A QMP acknowledgement queues
+ # input; it does not establish that the guest compositor has delivered
+ # the pointer's enter/motion before the following button event.
+ time.sleep(.2)
for down in [True, False]:
self.monitor('input-send-event', events=[{'type': 'btn', 'data': {'button': 'left', 'down': down}}])
time.sleep(.15)
def type_probe(self, text):
# Send display keyboard events, not hn's CLI input path. Probe commands
- # deliberately need only these unshifted US-layout characters.
- if not re.fullmatch(r'[a-z0-9 -]+', text):
+ # use this bounded US-layout set, including browser URL punctuation.
+ if not re.fullmatch(r'[a-z0-9 .:/-]+', text):
raise ValueError('Keyboard probe contains unsupported characters.')
for char in text:
- self.keys({' ': 'spc', '-': 'minus'}.get(char, char))
+ if char == ':':
+ self.keys('shift', 'semicolon')
+ else:
+ self.keys({' ': 'spc', '-': 'minus', '.': 'dot', '/': 'slash'}.get(char, char))
def stop(self):
if self.process and self.process.poll() is None:
@@ -978,6 +985,8 @@ assert str(i.live_payload()) == '/run/archiso/copytoram/airootfs.sfs'
vm.monitor('set_link', name='hnnet', up=False)
unlock_delay = 100 if config['encrypt'] else 0
vm.login_installed(config, unlock_delay=unlock_delay)
+ # First-use network setup and model turns are not OS boot time.
+ result['installed_hn_ready_seconds_including_test_login'] = round(time.monotonic() - vm.started, 3)
if direct:
trial_project = check_first_use(vm, lambda command: command, folder, installed=True)
result['checks'].append('Installed Wi-Fi first use advances into three real panes and the bundled default agent answers keyboard input')
@@ -1005,7 +1014,6 @@ assert str(i.live_payload()) == '/run/archiso/copytoram/airootfs.sfs'
if unlock_delay:
result['installed_unlock_prompt_seconds'] = vm.unlock_prompt_seconds
result['checks'].append('Harness unlock screen renders, masks input, accepts a retry after a wrong password, and unlocks after the deliberate 100-second wait')
- result['installed_hn_ready_seconds_including_test_login'] = round(time.monotonic() - vm.started, 3)
result['installed_keyboard_readiness'] = check_graphical_keyboard(vm, 'installed')
result['checks'].append('Installed graphical hn accepts physical-keyboard shell input, returns output and returns home after closing the pane')
if config['encrypt']:
diff --git a/os/tools/inspect_image.py b/os/tools/inspect_image.py
index 074e7bf59..e3249fa36 100644
--- a/os/tools/inspect_image.py
+++ b/os/tools/inspect_image.py
@@ -80,7 +80,7 @@ def inspect(iso):
expected_version = re.escape(version.replace('-preview.', 'pre')) + r'\.r\d+\.g' + manifest['source_commit'][:10] + '-1'
assert re.fullmatch(expected_version, package_version), 'OS package version differs from the image source'
assert package_version == manifest['package_version'], 'OS package version differs from the manifest'
- assert set(manifest['capabilities']) == {'runtime-updates', 'system-updates', 'broadcom-offline', 'install-first'}, 'Image capabilities differ from the manifest'
+ assert set(manifest['capabilities']) == {'runtime-updates', 'system-updates', 'single-action-updates', 'broadcom-offline', 'install-first'}, 'Image capabilities differ from the manifest'
hardware_root = 'usr/share/harness-os/hardware/broadcom/'
hardware = json.loads(read(hardware_root + 'manifest.json'))
assert hardware == manifest['hardware']['broadcom'], 'Hardware manifest differs from the payload'
diff --git a/os/tools/manifest.py b/os/tools/manifest.py
index 8e8c13c32..565a12e10 100644
--- a/os/tools/manifest.py
+++ b/os/tools/manifest.py
@@ -27,6 +27,8 @@ if all((root / path).is_file() for path in [
capabilities.append('runtime-updates')
if (root / 'usr/lib/harness-os/release_update.py').is_file():
capabilities.append('system-updates')
+if (root / 'etc/sudoers.d/30-harness-updates').is_file():
+ capabilities.append('single-action-updates')
hardware = root / 'usr/share/harness-os/hardware/broadcom/manifest.json'
if hardware.is_file():
capabilities.append('broadcom-offline')
diff --git a/os/tools/publish.py b/os/tools/publish.py
index 250e4713d..4c44bf59c 100644
--- a/os/tools/publish.py
+++ b/os/tools/publish.py
@@ -204,6 +204,7 @@ def main():
interactive_install = all(any(c.startswith('Keyboard disk selection, encryption checkbox') for c in r['checks']) for r in receipts)
update_retry = all(any(c.startswith('Failed full update blocks package changes') for c in r['checks']) for r in receipts)
in_place_updates = {'runtime-updates', 'system-updates'}.issubset(manifest.get('capabilities', []))
+ single_action_updates = 'single-action-updates' in manifest.get('capabilities', [])
project_source_runs = sorted({str(r['workload_project_source_run_id']) for r in receipts if r.get('workload_project_source_run_id')})
reuse_note = ('Completed project sources were retained from ' + ', '.join(
f'[run {source}](https://github.com/{args.repo}/actions/runs/{source})' for source in project_source_runs) +
@@ -218,7 +219,7 @@ To install: follow the included `INSTALL.md` for Mac → USB → ThinkPad instru
{'Interrupted full OS updates block ordinary package transactions until a full retry succeeds. Retrying keeps the original recovery checkpoint. This was exercised with a real failed repository refresh, blocked package upgrade, successful retry, and offline recovery. hn-os update upgrades Arch packages.' if update_retry else ''}
-{'Super+u opens Updates. hn and CLI releases are prepared automatically; Enter activates an available runtime update. hn reconnects to the local tabs while agent processes keep running. System updates are a separate action in the same screen, with a checkpoint and a restart when you are ready. Neither channel automatically interrupts your work. Older preview 4 installations need the matching small bootstrap bundle once; routine updates do not require reflashing.' if in_place_updates else ''}
+{'Super+u starts the update immediately. The Update button is clickable too. No confirmation or password prompt is needed. Running agents and terminals stay alive; system updates keep a recovery checkpoint and leave restarting to you. After that reboot, the same request finishes any remaining runtime update. Background checks otherwise prepare downloads without activating them. Older previews use their existing Super+u, then s action to receive this change once; routine updates do not require reflashing.' if single_action_updates else 'Super+u opens Updates. hn and CLI releases are prepared automatically; Enter activates an available runtime update. System updates are a separate action in the same screen, with a checkpoint and a restart when ready. Routine updates do not require reflashing.' if in_place_updates else ''}
BIOS/plain and UEFI/encrypted VM boot, clipboard, browser switching, offline installation and package-checkpoint recovery passed. The BIOS VM uses a Nehalem CPU profile without AVX2, starts bundled OpenCode, installs the other agent executables, installs a compiler on demand, builds C, and serves a local Node preview. See `validation.json` and `machine-evidence.zip` for the exact checks and measurements.