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.

Open the USB installer directly and onboard on the installed system (#729)

Deea2d623b7a295
diff --git a/docs/naming-system.md b/docs/naming-system.md
index 0c0d9f100..a2dd687f1 100644
--- a/docs/naming-system.md
+++ b/docs/naming-system.md
@@ -106,8 +106,8 @@ configuration where it affects a decision.
| First-use description | **The operating system built by agents, for agents.** |
| Disk unlock prompt | **Enter your password** |
| USB install action | **Install Harness** |
-| Offline USB action | **Install without connecting** |
-| USB dock invitation | **Make Harness your OS.** |
+| USB startup | Open **Install Harness** directly; no trial choice or network step. |
+| First installed boot | **Connect to Wi-Fi to get started** when disconnected, then the agent workspace. |
| USB session label | Omit from the single installation footer. |
| Connect another execution machine | **Connect a computer** |
| Installer title | Omit the redundant heading; label the action. |
@@ -123,11 +123,11 @@ configuration where it affects a decision.
| OS page description | **A Linux operating system built by agents, for agents.** |
| Audience description | **Built for programmers first.** |
-The USB opens network setup when disconnected, with **Install without connecting**
-always available. Once connected, it opens the bundled agent and keeps the
-installation dock visible. An installed system and
-ordinary hn on macOS or another Linux distribution never show the USB installation
-actions. The `harness install` system command belongs to the OS integration.
+The USB opens the installer directly and works offline. There is no trial option.
+After rebooting the installed disk, the existing Wi-Fi page appears when needed;
+a working connection advances to the agent and two terminal panes. Ordinary hn
+on macOS or another Linux distribution never shows OS installation actions.
+The `harness install` system command belongs to the OS integration.
Write OS shortcuts with lowercase letters: **Super+n**, **Super+t**, **Super+m**,
**Super+i**, **Super+w**, **Super+b**, **Super+u**, **Super+l**. They require no Shift
diff --git a/os/DEVELOPMENT.md b/os/DEVELOPMENT.md
index c6f705c35..3346786d3 100644
--- a/os/DEVELOPMENT.md
+++ b/os/DEVELOPMENT.md
@@ -17,7 +17,7 @@ Keep the existing terminal, agents and optional browser. Hardware integration mu
not introduce a desktop, control panel or extra launcher. Update checks use a
short-lived user timer; there is no resident update process.
-1. Refine USB welcome, offline installation, Wi-Fi setup, trial, first conversation
+1. Refine direct USB installation, first-boot Wi-Fi setup, first conversation
and disk unlock. Review actual screens, keyboard navigation, narrow displays,
cancellation and recoverable errors. Keep the Naming System and text artwork
consistent across these steps.
@@ -362,15 +362,20 @@ change, explicitly approved for all platforms. Publishing the ISO did not releas
these through the general TUI channel. The small updater adds no changes to `tui/`
or `cli/`.
-## Agent-led USB onboarding
+## Installation and first-use onboarding
-The live launcher starts `hn-os welcome` in one real terminal pane. While offline,
-a small curses step offers Wi-Fi or the native installer without needing a model.
-Once connected, it execs packaged OpenCode immediately. The OS-only TUI integration
-adds two starter panels and a one-row install dock. `hn os-action` is a private
-integration command, guarded by OS mode; install additionally requires live mode.
-All install entry points create or focus one local form even if a remote pane has
-focus. Super bindings live in labwc; the shared Ctrl+b key tables are preserved.
+The USB starts `harness-install.service`: foot runs the offline installer directly.
+The agent daemon, hn screen, idle lock and update timer do not start on live media.
+The compositor has a small installation-only key configuration. A failed graphical
+startup opens the same installer on the console. Cancelling resets the form;
+success keeps Shut down visible. A failed shutdown never restarts installation.
+There is no trial choice, network prerequisite, dock or agent session on the USB.
+
+The installed system starts the usual hn screen. On first use, `hn-os welcome`
+opens the existing full-page Wi-Fi form when disconnected. Working Ethernet or a
+saved connection skips that form; connection success advances automatically to
+OpenCode on the left and two terminal panes on the right. Later launches restore
+work. The standard hn footer and shared Ctrl+b shortcuts remain intact.
OpenCode reads the packaged guide through its global
`~/.config/opencode/AGENTS.md`, linked to `/usr/share/harness-os/guide.md`.
@@ -388,17 +393,15 @@ Independent background agent updates remain future work and must preserve the
packaged fallback, validate provenance, avoid downgrades, and activate on a later
launch rather than replacing an active executable.
-Trial transfer reads only `~/projects` as the live user, using a private staging
-directory on the destination disk. It preserves saved bytes, modes, times, Git
-history and symlinks without following them. Special files and detected concurrent
-writes fail explicitly. The installed home gets a per-file hash receipt. It is a
-saved-file transfer, not a migration of processes or the live home/credentials.
+The previous trial-file transfer helper remains compatible with explicit installer
+commands from older sessions. It does not create a trial path in the new USB UX.
-Validation must cover offline entry/cancellation, Ethernet skip, the real default
-agent answering TUI questions and creating a project, agent-requested installation,
-keyboard and mouse controls, plain/encrypted offline installation, post-boot file
-hashes, and ordinary Mac/Linux TUI isolation. Native VM screenshots are required
-before publication; local unit tests alone do not establish this experience.
+Validation covers boot directly into the installer with networking disabled,
+masked keyboard entry, cancellation and errors, graphical fallback, plain and
+encrypted installation, installed Wi-Fi and Ethernet skip, the three-pane layout,
+real default-agent conversation, browser use, updates and recovery. Image manifests
+identify this journey with `install-first`; historical trial images retain their
+own acceptance checks. Native screenshots are required before publication.
## Optional remote VM controls
@@ -465,7 +468,7 @@ or network addresses. No additional daemon or settings application is needed.
| Raspberry Pi | Evaluate a maintained ARM64 board kernel, firmware and boot image with the same Harness session | Separate board image required; not covered by the PC ISO or an ARM VM |
| Native Harness app/TUI on macOS | Existing arm64 and x64 app/runtime releases | Separate from installing the Linux OS |
-The initial Intel scope excludes 32-bit-only CPUs/EFI. The bundled OpenCode trial
+The initial Intel scope excludes 32-bit-only CPUs/EFI. Bundled OpenCode
also requires SSE4.2. October 3 CPU checks used the unchanged preview 4 ISO under
QEMU TCG with `-cpu core2duo`: a Core 2 Duo T7700 instruction set with SSSE3,
without SSE4.1, SSE4.2 or AVX. The later check used 4 GiB of guest RAM and installed
@@ -484,10 +487,11 @@ These checks establish specific CPU startup limits, not physical Mac support,
authenticated agent turns or full browser/media/GPU compatibility. They do not
replace preview 6 installation testing or show that every future vendor binary
will retain the same baseline. Codex and pi still need real model-turn validation
-on this CPU before being recommended as its trial path.
+on this CPU before being recommended as its first-agent path.
-The OS Try action detects the OpenCode limitation before Wi-Fi setup and explains
-it, instead of launching a binary that immediately fails with an illegal instruction.
+The agent launcher detects the OpenCode limitation and explains it instead of
+launching a binary that immediately fails with an illegal instruction. This does
+not make Core 2 a supported bundled-agent target.
[Bun's executable targets](https://bun.com/docs/bundler/executables) document the
SSE4.2 baseline used by its compiled runtime.
diff --git a/os/INSTALL.md b/os/INSTALL.md
index 5513e3c54..032542bcf 100644
--- a/os/INSTALL.md
+++ b/os/INSTALL.md
@@ -1,16 +1,16 @@
# Install Harness on a ThinkPad
-These instructions are for **0.1.0-preview.10**, using a Mac to prepare the USB.
-The USB starts a live session. Installation begins only when you choose **Install Harness**
+These instructions are for **0.1.0-preview.11**, 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.
## 1. Prepare
- An x86-64 Intel or AMD ThinkPad with SSE4.2 for bundled OpenCode. Core 2 and
- 32-bit-only CPUs are outside the default agent trial's supported baseline.
+ 32-bit-only CPUs are outside the bundled agent's supported baseline.
- A USB stick of at least 4 GB. Flashing replaces its contents.
- An internal disk of at least 12 GiB, with important files backed up elsewhere.
-- AC power. Installation works offline; trying a cloud agent needs a connection.
+- AC power. Installation works offline; using a cloud agent after installation needs a connection.
Start with 2 GiB RAM or more. Preview 4 passed installation, reboot, recovery
and a first OpenCode conversation in 1 GiB VMs; each new image repeats the native
@@ -21,20 +21,20 @@ compute still need testing on the actual hardware.
## 2. Download and verify on the Mac
-From the [preview 10 release](https://github.com/autonomous-ai/openharness/releases/tag/os-v0.1.0-preview.10),
+From the [preview 11 release](https://github.com/autonomous-ai/openharness/releases/tag/os-v0.1.0-preview.11),
download both files into the same folder:
-- `harness-0.1.0-preview.10-x86_64.iso`
-- `harness-0.1.0-preview.10-x86_64.iso.sha256`
+- `harness-0.1.0-preview.11-x86_64.iso`
+- `harness-0.1.0-preview.11-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.10-x86_64.iso.sha256
+shasum -a 256 -c harness-0.1.0-preview.11-x86_64.iso.sha256
```
-The result must say `harness-0.1.0-preview.10-x86_64.iso: OK`.
+The result must say `harness-0.1.0-preview.11-x86_64.iso: OK`.
If it does not, download the files again before flashing.
## 3. Flash the USB
@@ -58,42 +58,28 @@ or **Eject**. Do not initialize it.
3. Select the USB. Prefer its UEFI entry when available; legacy BIOS also works.
4. If firmware rejects the image, enter setup with **F1** and disable **Secure
Boot**. This preview is unsigned. Leave TPM enabled.
-5. Choose the default **Harness** boot entry.
+5. Choose the default **Install Harness** boot entry.
The exact menu wording varies by model. See Lenovo's
[boot-menu instructions](https://docs.lenovocdrt.com/ref/bios/startup_menu/).
If the USB is absent, try another USB port and check that USB boot is enabled.
-The USB opens a full-page Wi-Fi list with **Install without connecting** always
-visible. Choose a network and enter its password; a successful connection advances
-automatically. Ethernet
-skips this step when already connected. No Harness account is needed.
+The USB opens the install form immediately, with the first eligible disk selected
+and Password focused. Installation needs no network connection or Harness account.
-OpenCode starts with its default model selection on the left, beside two real
-terminal panes on the right. **Super+n** starts another harness; **Super+m**
-connects a computer. Ask the agent
-about Harness, its shortcuts, or something you want to build. The footer keeps
-**Install Harness** visible throughout the trial, beside the window list on one row.
-
-Create projects under `~/projects`. The installer preserves and verifies these
-saved files, including Git history. Files elsewhere, running processes and agent
-credentials outside projects are not copied. Save and stop project writes before
-installing, or copy important work to another drive.
-
-### Trying an older Intel Mac
+### Installing on an older Intel Mac
Intel Macs with a 64-bit EFI and no T2 chip are an experimental target. The USB
includes optional support for selected Broadcom radios, but no physical Mac
model has passed our complete hardware checks yet. This image is not the
-Apple Silicon or T2 installation path. Core 2 CPUs cannot run bundled OpenCode;
-Try explains that limitation before attempting to start it.
+Apple Silicon or T2 installation path. Core 2 CPUs cannot run bundled OpenCode; this is not a supported bundled-agent target.
Shut down, insert the USB, then hold **Option (⌥)** while turning on the Mac.
Choose the external **EFI Boot** entry. Apple's
[startup-key guide](https://support.apple.com/en-us/102603) describes that menu.
-Connect and try the agent first; check built-in keyboard, trackpad,
-Wi-Fi, brightness and sound before choosing the internal disk. Installation uses
-the same form below and erases the whole selected disk, including macOS.
+Installation uses the same form below and erases the whole selected disk, including
+macOS. Keyboard, Wi-Fi, brightness and sound still need physical validation for
+each Mac family; the generic PC image does not establish that compatibility.
For a hardware report, open a terminal and run `harness hardware`. Keep that
report with the Mac's model and the behavior you observed. It contains device
@@ -101,10 +87,7 @@ IDs and driver names, without serial numbers or Wi-Fi passwords.
## 5. Install
-Choose **Install without connecting** at the network step, click **Install Harness**
-in the footer, press **Super+i**, or ask the agent to open installation.
-F10 focuses Install Harness in the footer; Enter opens it. All routes open
-the same native form, with four fields:
+The USB opens the native form with four fields:
1. **Disk:** the first eligible disk is selected. Check its model and capacity.
To change it, focus Disk and press Enter. The live USB is excluded.
@@ -118,16 +101,12 @@ length restriction.
Check the selected disk, then choose **Install Harness** and press Enter. **This immediately
erases that disk. There is no second confirmation screen.** Choosing a disk alone
-does not start installation. Esc leaves the picker or cancels the main form.
+does not start installation. Esc leaves the picker or resets the main form without writing to the disk.
The account and computer name are set to **`me@harness`**. Installation works offline.
When **Harness is installed.** appears, choose **Shut down**. Once the ThinkPad is
off, remove the USB and power it on.
-The existing **Ctrl+b, then Shift+i** shortcut also opens the installer.
-`harness install` opens the form from a conversation or terminal; disk selection
-and passwords stay in the form. `sudo harness install` runs it directly.
-
## 6. First boot
With encryption enabled, the Harness logo appears with **Enter your password**.
@@ -161,7 +140,6 @@ the next key. A capital letter in a prefix binding means Shift + letter.
| Super+t | New terminal: open a shell directly |
| Super+m | Connect a computer |
| Super+w | Connect to Wi-Fi |
-| Super+i | Install Harness (USB only) |
| Super+b | Open/focus Chromium, or return to Harness |
| Super+Enter | Focus Harness |
| Super+l | Lock; unlock with the account password |
@@ -184,16 +162,16 @@ 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 9 can receive preview 10 through **Super+u**, then **s**.
+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 10 fixes repeated Wi-Fi setup and the final encrypted-device cleanup
-timeout. The USB bar is green; installed Harness keeps its normal status bar.
-Ctrl+b, then c opens a terminal tab. USB improvements require flashing the new ISO;
-an already installed computer can receive the OS changes through Updates.
+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.
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:
@@ -209,9 +187,9 @@ same folder before trying again.
## 9. First manual test
-1. Boot with the USB removed. Confirm disk unlock and the Harness home screen.
-2. Connect Wi-Fi, open a terminal, type a command, and exit with Ctrl+D.
-3. Start OpenCode and ask it to build a small website in `~/projects/hello`, run
+1. Boot with the USB removed. Confirm disk unlock.
+2. Connect Wi-Fi if needed. Confirm OpenCode and two terminals appear.
+3. Ask OpenCode to build a small website in `~/projects/hello`, run
its server, and give you the address. Open it with `hn-browser ADDRESS`.
4. Ask an agent to build and test a command-line program, installing tools as needed.
5. Switch between Harness and the browser. Lock and unlock the computer.
diff --git a/os/README.md b/os/README.md
index 7745c03e1..382294825 100644
--- a/os/README.md
+++ b/os/README.md
@@ -11,14 +11,16 @@ audience, not its name.
Product names and interface copy follow the [Naming System](../docs/naming-system.md).
-**Preview 10:** the USB opens a short network step
-or goes straight into bundled OpenCode when already connected. **Install without
-connecting** opens the same native installer offline. OpenCode starts on the left with two real terminal panes on the right.
-The single green USB footer holds the window list on the left and **Make Harness your OS.
-[ Install Harness ]** on the right. Installed first boot uses the same workspace;
-later launches restore existing work. The installed system keeps hn’s standard status bar. Ctrl+b, then c opens a terminal in a new tab. Saved `~/projects` files are copied
-and verified during installation. The full TUI reference and OS guide are bundled
-for agent questions. **Super+n/t/m/i/w** require no Shift; Ctrl+b bindings still work.
+**Preview 11:** 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.
+There is no trial choice or installation dock.
+
+Later launches restore existing work. The installed system keeps hn’s standard
+status bar. Ctrl+b, then c opens a terminal in a new tab. Projects live under
+`~/projects`. The full TUI reference and OS guide are bundled for agent questions.
+**Super+n/t/m/w** require no Shift; Ctrl+b bindings still work.
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
@@ -29,7 +31,7 @@ you choose when to reconnect the screen. 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 10](https://github.com/autonomous-ai/openharness/releases/tag/os-v0.1.0-preview.10)
+[Download preview 11](https://github.com/autonomous-ai/openharness/releases/tag/os-v0.1.0-preview.11)
· [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)
@@ -113,7 +115,7 @@ records that check; machine validation is still required afterward.
There is no publication to
the normal Harness CLI/TUI update channels.
-## Try and install
+## Install
To experiment with the PC image in a Mac window, install QEMU with
`brew install qemu`, download the ISO and its `manifest.json` into `os/dist/`,
@@ -140,23 +142,12 @@ or full-experience demonstration.
Write the **whole ISO** to a USB stick using an image writer such as Etcher, then
boot an x86-64 PC with Secure Boot disabled. TPM can remain enabled. A 32-bit-only
ThinkPad cannot boot this image. Bundled OpenCode also requires SSE4.2: a Core 2
-machine can reach Harness but is not supported for the bundled agent trial.
+machine can reach Harness but is not supported for the bundled agent.
The [installation guide](INSTALL.md) covers the
Mac download, checksum, flashing and ThinkPad boot menu in full.
-In the current source, the USB asks for a network connection before opening
-OpenCode. Choose **Install without connecting** to install immediately offline.
-Ethernet skips the network step when already connected. During a trial, click
-**Install Harness**, press **Super+i**, or ask the agent to open installation.
-F10 focuses Install Harness in the footer; Enter opens the form. Use Super+n for another agent or Super+m to connect a computer. The two right
-panes are ordinary terminals.
-
-Saved files under `~/projects`, including Git history, are transferred into the
-installed home and verified by hash. Work elsewhere remains temporary. Running
-processes and agent credentials outside projects are not transferred. Stop writes
-to a project before installing; files changing during transfer are an error.
-Preview 6's older welcome uses Enter to install or T to try and does not transfer
-trial files; use the installation guide shipped with your image.
+The USB opens the installer directly. There is no trial screen or network step
+before installation. It uses the image on the USB and works offline.
The installer uses `me@harness`. Choose **Disk**, leave **Encryption** enabled or
change it, then enter **Password** and **Repeat password**. **Install immediately
@@ -165,7 +156,7 @@ confirmation screen. The live USB and mounted disks are excluded. Selecting a
disk alone does not write to it. Passwords must be nonempty; this preview uses a
US keyboard layout, including at disk unlock.
-Completion stays visible until **Shut down** or **Back to Harness** is chosen.
+Completion stays visible until **Shut down** is chosen.
Remove the USB after shutdown and boot the internal disk. An encrypted install
shows the Harness logo and **Enter your password**, then enters hn. An unencrypted
install requires login as `me`. The password initially protects both the account
@@ -177,12 +168,14 @@ and, when enabled, the disk. There is no first-boot account wizard.
`--config` file, set `username`, `hostname` and `encrypt` in that file instead.
Ordinary hn on macOS or another Linux distribution does not expose OS installation.
-The installed system's first workspace opens OpenCode on the left and two terminal
-panes on the right; later launches restore existing work. Super+n starts New
-Harness, Super+t opens a shell directly, Super+m connects a computer, Super+w
-opens Wi-Fi and Super+l locks the session. These require no Shift or prefix.
-The shared TUI shortcuts still work: Ctrl+b, then Shift+n/t/w for the corresponding
-actions. Ordinary hn on macOS and other Linux distributions retains its usual UI.
+On the installed system's first boot, the existing Wi-Fi page opens when there
+is no connection. Connecting advances automatically to OpenCode on the left and
+two terminal panes on the right. Working Ethernet skips Wi-Fi setup. Later boots
+reconnect to saved Wi-Fi and restore existing work. Super+n starts New Harness,
+Super+t opens a shell directly, Super+m connects a computer, Super+w opens Wi-Fi
+and Super+l locks the session. These require no Shift or prefix. The shared TUI
+shortcuts still work; ordinary hn on macOS and other Linux distributions retains
+its usual UI.
Recovery remains available through another console or the USB; the owner retains
normal Linux administrator control.
diff --git a/os/build.sh b/os/build.sh
index a35e89fc2..3bb0bc92c 100644
--- a/os/build.sh
+++ b/os/build.sh
@@ -87,7 +87,7 @@ for d in ['syslinux', 'efiboot', 'grub']:
try: s = f.read_text()
except UnicodeDecodeError: continue
s = s.replace('vmlinuz-linux', 'vmlinuz-linux-lts').replace('initramfs-linux.img', 'initramfs-linux-lts.img')
- s = s.replace('Arch Linux install medium', 'Harness - try or install')
+ s = s.replace('Arch Linux install medium', 'Install Harness')
# The 256 MiB Archiso default cannot install even one current agent.
# tmpfs grows on demand; this is a ceiling, not reserved memory.
s = s.replace('archisobasedir=%INSTALL_DIR%', 'archisobasedir=%INSTALL_DIR% cow_spacesize=50%')
diff --git a/os/installer.py b/os/installer.py
index 634a79836..1f8765ff1 100644
--- a/os/installer.py
+++ b/os/installer.py
@@ -689,9 +689,11 @@ def interactive(username='me', hostname='harness', encrypt=True):
return curses.wrapper(lambda screen: InstallForm(screen, candidates, username, hostname, encrypt).run())
-def completion(screen):
+def completion(screen, boot=False):
"""Keep success visible when the installer owns an hn pane, then shut down on request."""
screen.keypad(True)
+ if boot:
+ curses.raw()
curses.flushinp()
view = InstallForm(screen, [], 'me', 'harness', True)
view.cursor(False)
@@ -702,12 +704,13 @@ def completion(screen):
view.line(4, 'Remove the USB after shutdown.')
view.line(5, 'Then turn on this computer.')
view.line(8, '[ Shut down ]', active=selected == 0)
- view.line(10, 'Back to Harness', active=selected == 1)
+ if not boot:
+ view.line(10, 'Back to Harness', active=selected == 1)
screen.refresh()
key = screen.get_wch()
- if key in ('\x1b', '\x03'):
+ if key in ('\x1b', '\x03') and not boot:
return False
- if key in ('\t', curses.KEY_BTAB, curses.KEY_UP, curses.KEY_DOWN):
+ if key in ('\t', curses.KEY_BTAB, curses.KEY_UP, curses.KEY_DOWN) and not boot:
selected = 1 - selected
elif InstallForm.enter(key):
return selected == 0
@@ -756,7 +759,27 @@ def arguments():
parser.add_argument('--no-encryption', action='store_true', help='Explicitly install without disk encryption')
parser.add_argument('--yes-erase-disk', action='store_true')
parser.add_argument('--source', type=Path, help='Override the automatically detected live system image')
- return parser.parse_args()
+ parser.add_argument('--boot', action='store_true', help=argparse.SUPPRESS)
+ args = parser.parse_args()
+ if args.boot and (args.config or not Path('/etc/harness-live').is_file()):
+ parser.error('--boot is only for the interactive Harness USB installer.')
+ return args
+
+
+def finish_installation(boot=False):
+ # A failed poweroff must return to success, never restart disk installation.
+ while curses.wrapper(lambda screen: completion(screen, boot=boot)):
+ try:
+ run('systemctl', 'poweroff')
+ return
+ except (OSError, subprocess.SubprocessError) as error:
+ if not boot:
+ raise
+ print(f'Harness is installed. Could not shut down: {error}', file=sys.stderr)
+ try:
+ input('Press Enter to try shutting down again.')
+ except (EOFError, KeyboardInterrupt):
+ pass
def main(args=None):
@@ -783,32 +806,34 @@ def main(args=None):
install(config, source, Path('/mnt/harness-os'))
else:
curses.wrapper(lambda screen: install_with_progress(screen, config, source, Path('/mnt/harness-os')))
- if curses.wrapper(completion):
- run('systemctl', 'poweroff')
+ finish_installation(boot=getattr(args, 'boot', False))
def entrypoint():
args = arguments()
- try:
- main(args)
- except KeyboardInterrupt:
- return 130
- except (ValueError, OSError, curses.error, subprocess.SubprocessError) as error:
- print(f'Installation stopped: {error}', file=sys.stderr, flush=True)
- for note in getattr(error, '__notes__', ()):
- print(note, file=sys.stderr, flush=True)
- if not args.config and LAST_LOG is not None:
- print(f'Details: {LAST_LOG}', file=sys.stderr, flush=True)
- # An installer launched from the USB welcome owns its pane. Retain the
- # error until it has been read instead of closing the pane immediately.
- # Unattended configuration files and piped callers never wait for input.
- if not args.config and sys.stdin.isatty() and sys.stderr.isatty():
- try:
- input('Press Enter to return to Harness.')
- except (EOFError, KeyboardInterrupt):
- pass
- return 1
- return 0
+ boot = getattr(args, 'boot', False)
+ while True:
+ try:
+ main(args)
+ return 0
+ except KeyboardInterrupt:
+ if not boot:
+ return 130
+ except (ValueError, OSError, curses.error, subprocess.SubprocessError) as error:
+ print(f'Installation stopped: {error}', file=sys.stderr, flush=True)
+ for note in getattr(error, '__notes__', ()):
+ print(note, file=sys.stderr, flush=True)
+ if not args.config and LAST_LOG is not None:
+ print(f'Details: {LAST_LOG}', file=sys.stderr, flush=True)
+ # Interactive failures stay visible until acknowledged. On USB,
+ # cancellation or failure returns to a fresh form, never a trial.
+ if not args.config and sys.stdin.isatty() and sys.stderr.isatty():
+ try:
+ input('Press Enter to try again.' if boot else 'Press Enter to return to Harness.')
+ except (EOFError, KeyboardInterrupt):
+ pass
+ if not boot:
+ return 1
if __name__ == '__main__':
diff --git a/os/lock.json b/os/lock.json
index bc94e72a6..996429f2e 100644
--- a/os/lock.json
+++ b/os/lock.json
@@ -1,8 +1,12 @@
{
- "version": "0.1.0-preview.10",
+ "version": "0.1.0-preview.11",
"arch_snapshot": "2026/10/01",
"architecture": "x86_64",
"upgrades_from": [
+ {
+ "version": "0.1.0-preview.10",
+ "arch_snapshot": "2026/10/01"
+ },
{
"version": "0.1.0-preview.9",
"arch_snapshot": "2026/10/01"
diff --git a/os/onboarding.py b/os/onboarding.py
index 5ce24549b..25060662a 100644
--- a/os/onboarding.py
+++ b/os/onboarding.py
@@ -7,26 +7,21 @@ import subprocess
def welcome():
live = Path('/etc/harness-live').is_file()
+ if live:
+ os.execv('/usr/lib/harness-os/open-install', ['open-install'])
+ return
while True:
- # The network page advances as soon as connected. The live account can
- # run it without an administrator password.
+ # The installed first-use page advances as soon as connected.
result = subprocess.run(['sudo', '/usr/bin/python3', '/usr/lib/harness-os/network.py', '--first-use'])
if result.returncode == 0:
break
- if result.returncode == 11 and not live:
+ if result.returncode == 11:
break
- if result.returncode == 10 and live:
- try:
- subprocess.run(['hn', 'os-action', 'install'], check=True, timeout=15)
- except (OSError, subprocess.SubprocessError):
- print('Could not open Install Harness. Press Super+i to try again.')
- input('Press Enter to return to Wi-Fi.')
- continue
raise SystemExit('Could not open Wi-Fi. Press Super+w to try again, or Super+t for a terminal.')
pane = os.environ.get('TMUX_PANE', '')
try:
result = subprocess.run(['hn', 'os-action', 'ready', pane], check=False, timeout=15)
- if result.returncode == 0 and not live:
+ if result.returncode == 0:
state = Path.home() / '.local/state/harness-os'
state.mkdir(parents=True, exist_ok=True)
(state / 'onboarded').touch()
diff --git a/os/root/usr/lib/harness-os/open-install b/os/root/usr/lib/harness-os/open-install
index c2f9d7dca..d852377d9 100644
--- a/os/root/usr/lib/harness-os/open-install
+++ b/os/root/usr/lib/harness-os/open-install
@@ -1,5 +1,5 @@
#!/bin/sh
-# Agent requests, compositor keys and the dock all open the same local form.
+# Reuse the USB's existing installer; never interrupt an active disk operation.
set -eu
[ -f /etc/harness-live ] || { printf '%s\n' 'Installation is available from the Harness USB.' >&2; exit 1; }
-exec hn os-action install
+exec systemctl --user start harness-install.service
diff --git a/os/root/usr/lib/harness-os/session b/os/root/usr/lib/harness-os/session
index 8a2bba97e..b139146f1 100644
--- a/os/root/usr/lib/harness-os/session
+++ b/os/root/usr/lib/harness-os/session
@@ -30,7 +30,11 @@ restore_tty() {
}
trap restore_tty EXIT
if [ -n "$tty_state" ]; then stty -echo -icanon -isig; fi
-if labwc -C /usr/share/harness-os/labwc > "$HOME/.local/state/harness-os/display.log" 2>&1; then
+compositor_config=/usr/share/harness-os/labwc
+if [ -f /etc/harness-live ]; then
+ compositor_config=/usr/share/harness-os/labwc-install
+fi
+if labwc -C "$compositor_config" > "$HOME/.local/state/harness-os/display.log" 2>&1; then
exit 0
fi
restore_tty
@@ -38,6 +42,9 @@ trap - EXIT
# A missing/broken GPU driver must not strand the programmer at a blank screen.
# Stay in hn on the Linux console; an agent can install drivers and arrange a reboot.
systemctl --user stop harness-os.target || true
+if [ -f /etc/harness-live ]; then
+ exec sudo /usr/bin/python3 /usr/lib/harness-os/install.py --boot
+fi
systemctl --user start harness-daemon.service || true
printf '%s\n' 'Graphics unavailable; continuing in hn on the console.'
cd "$HOME/projects"
diff --git a/os/root/usr/lib/systemd/user/harness-daemon.service b/os/root/usr/lib/systemd/user/harness-daemon.service
index df457f6f8..bac03be9c 100644
--- a/os/root/usr/lib/systemd/user/harness-daemon.service
+++ b/os/root/usr/lib/systemd/user/harness-daemon.service
@@ -1,5 +1,6 @@
[Unit]
Description=Harness agent runtime
+ConditionPathExists=!/etc/harness-live
[Service]
Type=exec
diff --git a/os/root/usr/lib/systemd/user/harness-idle.service b/os/root/usr/lib/systemd/user/harness-idle.service
index d2e2639f4..63f5a8f6a 100644
--- a/os/root/usr/lib/systemd/user/harness-idle.service
+++ b/os/root/usr/lib/systemd/user/harness-idle.service
@@ -1,5 +1,6 @@
[Unit]
Description=Lock before suspend
+ConditionPathExists=!/etc/harness-live
PartOf=harness-os.target
[Service]
diff --git a/os/root/usr/lib/systemd/user/harness-install.service b/os/root/usr/lib/systemd/user/harness-install.service
new file mode 100644
index 000000000..f62e7be81
--- /dev/null
+++ b/os/root/usr/lib/systemd/user/harness-install.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Harness USB installer
+ConditionPathExists=/etc/harness-live
+PartOf=harness-os.target
+StartLimitIntervalSec=0
+
+[Service]
+Type=exec
+ExecStart=/usr/bin/foot --config=/usr/share/harness-os/foot.ini /usr/bin/sudo /usr/bin/python3 /usr/lib/harness-os/install.py --boot
+Restart=on-failure
+RestartSec=1
+
+[Install]
+WantedBy=harness-os.target
diff --git a/os/root/usr/lib/systemd/user/harness-os.target b/os/root/usr/lib/systemd/user/harness-os.target
index 0a05254e0..7fe9b7ac9 100644
--- a/os/root/usr/lib/systemd/user/harness-os.target
+++ b/os/root/usr/lib/systemd/user/harness-os.target
@@ -1,4 +1,4 @@
[Unit]
Description=The hn screen
-Wants=hn-screen.service harness-idle.service harness-update.timer
+Wants=hn-screen.service harness-install.service harness-idle.service harness-update.timer
After=graphical-session-pre.target
diff --git a/os/root/usr/lib/systemd/user/hn-screen.service b/os/root/usr/lib/systemd/user/hn-screen.service
index 8e90eab2d..6806ee00d 100644
--- a/os/root/usr/lib/systemd/user/hn-screen.service
+++ b/os/root/usr/lib/systemd/user/hn-screen.service
@@ -1,5 +1,6 @@
[Unit]
Description=Persistent hn terminal surface
+ConditionPathExists=!/etc/harness-live
PartOf=harness-os.target
Wants=harness-daemon.service
After=harness-daemon.service
diff --git a/os/root/usr/share/harness-os/guide.md b/os/root/usr/share/harness-os/guide.md
index b7b625084..564741496 100644
--- a/os/root/usr/share/harness-os/guide.md
+++ b/os/root/usr/share/harness-os/guide.md
@@ -23,26 +23,23 @@ This is a full Arch-based OS, with ordinary development tools installed as neede
- Read `/usr/share/harness-os/AGENTS.md` before changing system configuration.
Do not describe planned hardware support as physically tested support.
-## First conversation and installation
+## First conversation
+
+Harness is already installed when the first agent opens. The USB goes directly
+to the offline installer. After installation and reboot, Wi-Fi setup appears if
+needed, then this agent opens beside two terminals. Do not suggest trying the OS
+or ask the user to install it again.
Help the user accomplish something small: build a page, fix code, explore a repo,
-or ask about Harness. Answer directly; offer the relevant next action. The USB
-Install dock already keeps installation visible, so do not repeat a sales pitch
-in every answer or interrupt useful work with installation reminders.
-
-If the user asks to install, run `harness install` without sudo or arguments.
-It opens the real installer in Harness and returns to the conversation. The user
-chooses Disk, Encryption, Password and Repeat password, then selects Install Harness.
-Encryption starts enabled. The account is `me` and the computer is `harness`.
-Installation erases the entire selected disk. Explain this when discussing installation.
-Never ask for disk/password details in chat, guess a target disk, or construct an
-unattended install configuration. Never type the user's password for them.
-Installation works offline. Do not require a model, account or network to install.
-
-USB work is temporary until saved elsewhere or installed. Create trial projects
-under `~/projects` so the installer can carry their files into the installed home.
-This does not preserve running processes. Keep API keys in the agent's normal
-credential storage, outside projects; do not put secrets in example source files.
+or ask about Harness. Answer directly and offer the relevant next action.
+Create projects under `~/projects`. Work is saved on this computer's installed disk.
+Keep API keys in the agent's normal credential storage, outside source files.
+
+If asked about installation, explain that the USB form has Disk, Encryption,
+Password and Repeat password. Encryption starts enabled; the default identity is
+`me@harness`. Installation erases the whole selected disk. Passwords belong in the
+masked native form, never in chat. Do not construct unattended install configs,
+guess disks, or type passwords for the user. Installation works offline.
## Multiple agents, panes and tabs
@@ -112,8 +109,6 @@ conversation history. Describe only collaboration controls present in this TUI.
## OS keys and essentials
-- Super+i opens Install on the live USB. The persistent Install button does too.
- F10 focuses Install Harness in the footer; Enter opens installation.
- Super+w opens Wi-Fi. Ethernet connects automatically when available.
- 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.
diff --git a/os/root/usr/share/harness-os/labwc-install/autostart b/os/root/usr/share/harness-os/labwc-install/autostart
new file mode 100644
index 000000000..f8296e40e
--- /dev/null
+++ b/os/root/usr/share/harness-os/labwc-install/autostart
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/share/harness-os/labwc/autostart
diff --git a/os/root/usr/share/harness-os/labwc-install/rc.xml b/os/root/usr/share/harness-os/labwc-install/rc.xml
new file mode 100644
index 000000000..6e28ea77c
--- /dev/null
+++ b/os/root/usr/share/harness-os/labwc-install/rc.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<labwc_config>
+ <core><decoration>server</decoration><gap>0</gap></core>
+ <theme><cornerRadius>0</cornerRadius><keepBorder>no</keepBorder></theme>
+ <desktops><number>1</number><popupTime>0</popupTime></desktops>
+ <keyboard>
+ <repeatRate>35</repeatRate><repeatDelay>250</repeatDelay>
+ <keybind key="XF86MonBrightnessUp"><action name="Execute" command="brightnessctl set +5%" /></keybind>
+ <keybind key="XF86MonBrightnessDown"><action name="Execute" command="brightnessctl set 5%-" /></keybind>
+ </keyboard>
+ <mouse><context name="Root"><mousebind button="Right" action="Press"><action name="None" /></mousebind></context></mouse>
+ <windowRules><windowRule identifier="hn" serverDecoration="no" /></windowRules>
+</labwc_config>
diff --git a/os/tests/essentials_vm.py b/os/tests/essentials_vm.py
index 9fc64b63c..a78c3ab33 100644
--- a/os/tests/essentials_vm.py
+++ b/os/tests/essentials_vm.py
@@ -87,7 +87,7 @@ def wait_screen(vm, words, name, timeout=20):
time.sleep(.25)
-def wireless(vm, result):
+def wireless(vm, result, installed=False):
print('Preparing simulated WPA2 access point inside the disposable guest', flush=True)
vm.command('systemctl start harness-keyring', timeout=240)
output, _ = vm.command('pacman -S --needed --noconfirm hostapd dnsmasq iw', timeout=180)
@@ -100,7 +100,8 @@ def wireless(vm, result):
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))
- wait_screen(vm, ['harness-test', 'install without connecting'], 'wifi-01-networks')
+ offline_label = 'continue offline' 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')
vm.keys('ctrl', 'c')
@@ -161,10 +162,15 @@ def wireless(vm, result):
# not strand a first-time user in an empty shell.
vm.command('nmcli device disconnect "$(cat /run/harness-station)"')
vm.command(USER_ENV + 'hn new-window -n Offline ' + shlex.quote(form.replace('/tmp/wifi-form-result', '/tmp/wifi-offline-result')))
- wait_screen(vm, ['install without connecting'], 'wifi-05-offline-install')
- vm.keys('i')
- vm.command('for n in $(seq 1 40); do test "$(cat /tmp/wifi-offline-result 2>/dev/null)" = 10 && exit 0; sleep .25; done; exit 1')
- result['checks'].append('First-use Wi-Fi always offers offline installation, and selecting it exits with the native install action')
+ wait_screen(vm, [offline_label], 'wifi-05-offline')
+ if installed:
+ vm.keys('shift', 'tab')
+ vm.keys('ret')
+ else:
+ vm.keys('i')
+ expected = 11 if installed else 10
+ vm.command('for n in $(seq 1 40); do test "$(cat /tmp/wifi-offline-result 2>/dev/null)" = ' + str(expected) + ' && exit 0; sleep .25; done; exit 1')
+ result['checks'].append('Installed Wi-Fi can continue to offline work without exposing installation' if installed else 'First-use Wi-Fi always offers offline installation, and selecting it exits with the native install action')
vm.command('nmcli connection up ' + SSID, timeout=60)
vm.monitor('set_link', name='hnnet', up=True)
vm.command('while read -r dev; do nmcli device set "$dev" managed yes; nmcli device connect "$dev"; done < /run/harness-ethernet')
@@ -235,12 +241,28 @@ def main():
vm.wait(r'root@[^\r\n]*[#] ')
vm.shell_ready = True
vm.command('stty -echo')
+ installed = 'install-first' in manifest.get('capabilities', [])
+ if installed:
+ config = dict(disk='/dev/vda', expected_serial='HN_OS_TEST', confirm_erase='/dev/vda',
+ username='me', hostname='harness', password='test-password-123', encrypt=True, serial_console=True)
+ put(vm, '/tmp/essentials-install.json', json.dumps(config))
+ vm.command('nmcli networking off')
+ vm.command('harness install --config /tmp/essentials-install.json --yes-erase-disk', timeout=360)
+ 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.send('sudo -n -i\n')
+ vm.wait(r'root@[^\r\n]*[#] ')
+ vm.command('stty -echo')
+ result['checks'].append('Wi-Fi and audio checks run on an encrypted installed system after offline USB installation')
vm.command(USER_ENV + '/usr/lib/harness-os/wait-runtime')
vm.command(USER_ENV + 'sh -c ' + shlex.quote('for n in $(seq 1 60); do systemctl --user is-active --quiet hn-screen && pgrep -u 1000 -x foot >/dev/null && exit 0; sleep .25; done; exit 1'))
- wireless(vm, result)
+ wireless(vm, result, installed=installed)
sound(vm, result)
vm.stop()
- with wave.open(str(folder / 'audio-1.wav'), 'rb') as recording:
+ with wave.open(str(folder / ('audio-2.wav' if installed else 'audio-1.wav')), 'rb') as recording:
samples = array.array('h', recording.readframes(recording.getnframes()))
assert samples and max(abs(v) for v in samples) > 100, 'The virtual audio backend received silence'
result['captured_audio'] = {'sample_rate': recording.getframerate(), 'frames': recording.getnframes(),
diff --git a/os/tests/install_first.py b/os/tests/install_first.py
new file mode 100644
index 000000000..4e7446abc
--- /dev/null
+++ b/os/tests/install_first.py
@@ -0,0 +1,115 @@
+"""Native checks for installer-only USB startup and the installed workspace."""
+import json
+import os
+import re
+import shlex
+import subprocess
+import time
+
+
+def wait_installer_screen(vm, pattern, name, timeout=30):
+ deadline = time.monotonic() + timeout
+ while True:
+ vm.screenshot(name)
+ started = time.monotonic()
+ remaining = deadline - started
+ if remaining <= 0:
+ raise AssertionError('Screen did not render ' + pattern + ' before its deadline')
+ try:
+ # OCR is a host observer. A slow early frame must not shorten the
+ # browser's readiness budget or compete with QEMU for every CPU.
+ text = subprocess.check_output(['tesseract', str(vm.folder / (name + '.png')),
+ 'stdout', '--psm', '11'], text=True,
+ stderr=subprocess.DEVNULL, timeout=min(10, remaining),
+ env=dict(os.environ, OMP_THREAD_LIMIT='1'))
+ except subprocess.TimeoutExpired:
+ text = '[OCR exceeded the per-frame deadline]'
+ with (vm.folder / (name + '-ocr.jsonl')).open('a') as log:
+ log.write(json.dumps({'seconds': round(time.monotonic() - started, 3),
+ 'matched': bool(re.search(pattern, text, re.I)),
+ 'text': text}) + '\n')
+ (vm.folder / (name + '.txt')).write_text(text)
+ if re.search(pattern, text, re.I):
+ return text
+ if time.monotonic() >= deadline:
+ raise AssertionError('Installer did not render ' + pattern + '; saw ' + text)
+ time.sleep(.25)
+
+
+def check_usb_installer(vm, user, folder):
+ vm.command(user('sh -c ' + shlex.quote('for n in $(seq 1 60); do '
+ 'systemctl --user is-active --quiet harness-install && pgrep -x foot >/dev/null && exit 0; '
+ 'sleep .5; done; exit 1')), timeout=40)
+ text = wait_installer_screen(vm, 'Repeat password', '01-usb-installer')
+ ready = round(time.monotonic() - vm.started, 3)
+ for absent in ['Try without installing', 'Connect to Wi-Fi', 'Make Harness your OS']:
+ assert absent not in text
+ vm.command('! pgrep -x "hn|harness-tui|opencode|chromium"')
+ vm.command(user('sh -c ' + shlex.quote('! systemctl --user is-active --quiet harness-daemon')))
+ vm.type_probe('discard-me')
+ vm.keys('esc')
+ wait_installer_screen(vm, 'Repeat password', '01-usb-cancel')
+ vm.command('test "$(lsblk -n -o TYPE /dev/vda | wc -l)" -eq 1')
+ # Failed graphics must still open the installer, not a trial or blank screen.
+ override = '/etc/profile.d/00-hn-test-broken-graphics.sh'
+ vm.command('printf %s ' + shlex.quote('export WLR_BACKENDS=hn-test-missing\n') +
+ ' > ' + override + '; systemctl restart [email protected]')
+ try:
+ vm.command('for n in $(seq 1 60); do ! pgrep -x labwc && ! pgrep -x foot && '
+ 'pgrep -f "[/]usr/lib/harness-os/install.py --boot" >/dev/null && exit 0; '
+ 'sleep .5; done; exit 1', timeout=40)
+ # The kernel console's bitmap font is correctly rendered, but OCR can
+ # read its "w" as "u". Keep the exact form label with that one known
+ # glyph ambiguity; the retained framebuffer remains the visual evidence.
+ wait_installer_screen(vm, r'Repeat pass[wu]ord', '01-usb-console-installer')
+ vm.keys('esc')
+ vm.command('test "$(lsblk -n -o TYPE /dev/vda | wc -l)" -eq 1')
+ finally:
+ vm.command('rm -f ' + override + '; systemctl restart [email protected]')
+ vm.command(user('sh -c ' + shlex.quote('for n in $(seq 1 60); do '
+ 'systemctl --user is-active --quiet harness-install && pgrep -x foot >/dev/null && exit 0; '
+ 'sleep .5; done; exit 1')), timeout=40)
+ wait_installer_screen(vm, 'Repeat password', '01-usb-graphics-restored')
+ return ready
+
+
+def check_installed_controls(vm, result, folder):
+ vm.command('! systemctl --user is-active --quiet harness-install')
+ vm.command('pacman -Si git chromium >/dev/null', timeout=60)
+ result['checks'].append('Dated package repositories are queryable before the first download')
+ vm.command('systemd-run --user --quiet --wait --pipe --collect /bin/sh -c ' +
+ shlex.quote('printf hn-clipboard-check | wl-copy; test "$(wl-paste --no-newline)" = hn-clipboard-check'))
+ result['checks'].append('Wayland clipboard round trip')
+ vm.keys('ctrl', 'b')
+ vm.keys('c')
+ time.sleep(.5)
+ vm.type_probe('echo prefix-tab-ready')
+ vm.keys('ret')
+ vm.command('for n in $(seq 1 30); do hn capture-pane -p | grep -qx prefix-tab-ready && exit 0; sleep .25; done; exit 1')
+ vm.screenshot('installed-prefix-terminal-tab')
+ vm.keys('ctrl', 'd')
+ for index in range(3):
+ vm.command('hn new-window -n quick-exit ' + shlex.quote(f'touch /tmp/hn-quick-exit-{index}'))
+ vm.command(f'for n in $(seq 1 20); do test -e /tmp/hn-quick-exit-{index} && exit 0; sleep .25; done; exit 1')
+ result['checks'].append('Closing the last terminal and immediately opening another works repeatedly')
+ survivor = 'echo $$ > /tmp/hn-survivor.pid; exec sleep 1800'
+ vm.command('hn new-window -n persistence ' + shlex.quote(survivor))
+ vm.command('for n in $(seq 1 20); do test -s /tmp/hn-survivor.pid && exit 0; sleep .25; done; exit 1')
+ clipboard = 'printf hn-pane-clipboard | wl-copy; test "$(wl-paste --no-newline)" = hn-pane-clipboard && touch /tmp/hn-pane-clipboard-passed'
+ vm.command('hn new-window -n clipboard ' + shlex.quote(clipboard))
+ vm.command('for n in $(seq 1 20); do test -e /tmp/hn-pane-clipboard-passed && exit 0; sleep .25; done; exit 1')
+ result['checks'].append('An hn terminal pane inherits the working Wayland clipboard environment')
+ vm.command('if hn detach; then exit 1; fi')
+ vm.command('if hn suspend-client; then exit 1; fi')
+ vm.command('kill -0 "$(cat /tmp/hn-survivor.pid)"')
+ result['checks'].append('OS surface refuses detach and suspend while work stays alive')
+ vm.command('systemctl --user restart hn-screen; sleep 3; kill -0 "$(cat /tmp/hn-survivor.pid)"')
+ vm.command('/usr/lib/harness-os/wait-runtime', timeout=160)
+ result['checks'].append('Terminal process survives screen restart')
+ vm.command("printf '%s' '<!doctype html><h1>Harness installed browser</h1>' > /tmp/hn-browser-check.html")
+ vm.command('hn-browser file:///tmp/hn-browser-check.html')
+ wait_installer_screen(vm, 'Harness installed browser', 'installed-browser', timeout=45)
+ vm.keys('meta_l', 'b')
+ vm.screenshot('installed-browser-return')
+ vm.command('pkill -x chromium')
+ result['checks'].append('Browser starts only on shortcut or explicit request; a local page renders and Super+b returns to hn')
diff --git a/os/tests/session_vm.py b/os/tests/session_vm.py
index e0d3f6150..5e86ed7d0 100644
--- a/os/tests/session_vm.py
+++ b/os/tests/session_vm.py
@@ -217,16 +217,17 @@ def main():
vm.wait(r'root@[^\r\n]*[#] ')
vm.shell_ready = True
vm.command('stty -echo')
- vm.command(user('/usr/lib/harness-os/wait-runtime'))
- vm.command(user('systemctl --user is-active --quiet hn-screen harness-idle'))
- time.sleep(2)
- try:
- result['live_lock_observations'] = live_lock(vm, user)
- except Exception as error:
- result['live_lock_error'] = str(error)
- vm.screenshot('live-lock-failure')
- # Recover this disposable fixture so installed locking can still be diagnosed.
- vm.command('pkill -u 1000 -x swaylock || true')
+ if 'install-first' not in manifest.get('capabilities', []):
+ vm.command(user('/usr/lib/harness-os/wait-runtime'))
+ vm.command(user('systemctl --user is-active --quiet hn-screen harness-idle'))
+ time.sleep(2)
+ try:
+ result['live_lock_observations'] = live_lock(vm, user)
+ except Exception as error:
+ result['live_lock_error'] = str(error)
+ vm.screenshot('live-lock-failure')
+ # Recover this disposable fixture so installed locking can still be diagnosed.
+ vm.command('pkill -u 1000 -x swaylock || true')
put(vm, '/tmp/install-config.json', json.dumps(config))
vm.command('nmcli networking off')
print('Installing offline into the disposable test disk', flush=True)
diff --git a/os/tests/test_installer.py b/os/tests/test_installer.py
index f7d091143..6a10d983c 100644
--- a/os/tests/test_installer.py
+++ b/os/tests/test_installer.py
@@ -332,6 +332,24 @@ class Screen:
class InstallationCompletion(unittest.TestCase):
+ def test_usb_success_has_only_shutdown_and_cannot_return_to_trial(self):
+ screen = Screen()
+ screen.keys = ['\x1b', '\x03', '\t', '\n']
+ with patch.object(installer.curses, 'curs_set'), patch.object(installer.curses, 'flushinp'), \
+ patch.object(installer.curses, 'raw'):
+ self.assertTrue(installer.completion(screen, boot=True))
+ self.assertNotIn('Back to Harness', '\n'.join(screen.frames))
+
+ def test_failed_usb_shutdown_keeps_success_and_does_not_reinstall(self):
+ with patch.object(installer.curses, 'wrapper', return_value=True) as view, \
+ patch.object(installer, 'run', side_effect=[OSError('fixture poweroff failure'), None]) as command, \
+ patch.object(installer, 'install') as install, patch('builtins.input'), \
+ patch.object(installer.sys, 'stderr'):
+ installer.finish_installation(boot=True)
+ self.assertEqual(view.call_count, 2)
+ self.assertEqual(command.call_count, 2)
+ install.assert_not_called()
+
def test_success_stays_visible_until_shutdown_or_return_is_chosen(self):
for keys, shutdown in [(['\n'], True), (['\t', '\n'], False), (['\x1b'], False)]:
screen = Screen()
@@ -547,6 +565,20 @@ class InteractiveInstall(unittest.TestCase):
class InstallerExit(unittest.TestCase):
+ def test_usb_cancel_or_failure_returns_to_installer(self):
+ for failure in [KeyboardInterrupt(), ValueError('Fixture disk disappeared')]:
+ with self.subTest(failure=failure), \
+ patch.object(installer, 'arguments', return_value=installer.argparse.Namespace(config=None, boot=True)), \
+ patch.object(installer, 'main', side_effect=[failure, None]) as main, \
+ patch.object(installer.sys.stdin, 'isatty', return_value=True), \
+ patch.object(installer.sys, 'stderr'), patch('builtins.input') as acknowledge:
+ self.assertEqual(installer.entrypoint(), 0)
+ self.assertEqual(main.call_count, 2)
+ if isinstance(failure, ValueError):
+ acknowledge.assert_called_once_with('Press Enter to try again.')
+ else:
+ acknowledge.assert_not_called()
+
def exercise(self, failure, config=None, tty=True):
with patch.object(installer, 'arguments', return_value=installer.argparse.Namespace(config=config)), \
patch.object(installer, 'main', side_effect=failure), \
diff --git a/os/tests/test_onboarding.py b/os/tests/test_onboarding.py
index 560246cd4..1ea58cc22 100644
--- a/os/tests/test_onboarding.py
+++ b/os/tests/test_onboarding.py
@@ -16,30 +16,27 @@ def result(code=0):
class Onboarding(unittest.TestCase):
- def test_network_page_opens_directly_then_agent_and_workspace_start(self):
- for live in [True, False]:
- with self.subTest(live=live), tempfile.TemporaryDirectory() as temp, \
- patch.object(onboarding.Path, 'is_file', return_value=live), \
- patch.object(onboarding.Path, 'home', return_value=Path(temp)), \
- patch.object(onboarding.subprocess, 'run', return_value=result()) as command, \
- patch.object(onboarding.os, 'execv') as execute, \
- patch.dict(os.environ, {'TMUX_PANE': '%4'}):
- onboarding.welcome()
- self.assertEqual(command.call_args_list[0].args[0],
- ['sudo', '/usr/bin/python3', '/usr/lib/harness-os/network.py', '--first-use'])
- self.assertEqual(command.call_args_list[1].args[0], ['hn', 'os-action', 'ready', '%4'])
- execute.assert_called_once_with('/usr/bin/hn-os', ['hn-os', 'try'])
- self.assertEqual((Path(temp) / '.local/state/harness-os/onboarded').exists(), not live)
+ def test_installed_network_page_advances_to_agent_and_workspace(self):
+ with tempfile.TemporaryDirectory() as temp, \
+ patch.object(onboarding.Path, 'is_file', return_value=False), \
+ patch.object(onboarding.Path, 'home', return_value=Path(temp)), \
+ patch.object(onboarding.subprocess, 'run', return_value=result()) as command, \
+ patch.object(onboarding.os, 'execv') as execute, \
+ patch.dict(os.environ, {'TMUX_PANE': '%4'}):
+ onboarding.welcome()
+ self.assertEqual(command.call_args_list[0].args[0],
+ ['sudo', '/usr/bin/python3', '/usr/lib/harness-os/network.py', '--first-use'])
+ self.assertEqual(command.call_args_list[1].args[0], ['hn', 'os-action', 'ready', '%4'])
+ execute.assert_called_once_with('/usr/bin/hn-os', ['hn-os', 'try'])
+ self.assertTrue((Path(temp) / '.local/state/harness-os/onboarded').exists())
- def test_offline_install_opens_native_form_and_returns_to_network_page(self):
+ def test_usb_never_opens_networking_or_an_agent(self):
with patch.object(onboarding.Path, 'is_file', return_value=True), \
- patch.object(onboarding.subprocess, 'run', side_effect=[result(10), result(), KeyboardInterrupt]) as command, \
+ patch.object(onboarding.subprocess, 'run') as command, \
patch.object(onboarding.os, 'execv') as execute:
- with self.assertRaises(KeyboardInterrupt):
- onboarding.welcome()
- self.assertEqual(command.call_args_list[1].args[0], ['hn', 'os-action', 'install'])
- self.assertEqual(command.call_args_list[0], command.call_args_list[2])
- execute.assert_not_called()
+ onboarding.welcome()
+ command.assert_not_called()
+ execute.assert_called_once_with('/usr/lib/harness-os/open-install', ['open-install'])
def test_installed_system_can_open_workspace_offline(self):
with tempfile.TemporaryDirectory() as temp, patch.object(onboarding.Path, 'is_file', return_value=False), \
@@ -58,12 +55,10 @@ class Onboarding(unittest.TestCase):
self.assertFalse((Path(temp) / '.local/state/harness-os/onboarded').exists())
execute.assert_called_once()
- def test_install_launch_failure_keeps_network_recoverable(self):
- with patch.object(onboarding.Path, 'is_file', return_value=True), \
- patch.object(onboarding.subprocess, 'run', side_effect=[result(10), subprocess.TimeoutExpired('hn', 15), KeyboardInterrupt]) as command, \
- patch('builtins.input') as acknowledge, patch.object(onboarding.os, 'execv') as execute:
- with self.assertRaises(KeyboardInterrupt):
+ def test_network_failure_does_not_claim_onboarding_or_start_agent(self):
+ with patch.object(onboarding.Path, 'is_file', return_value=False), \
+ patch.object(onboarding.subprocess, 'run', return_value=result(1)), \
+ patch.object(onboarding.os, 'execv') as execute:
+ with self.assertRaisesRegex(SystemExit, 'Could not open Wi-Fi'):
onboarding.welcome()
- acknowledge.assert_called_once()
- self.assertEqual(command.call_args_list[0], command.call_args_list[2])
execute.assert_not_called()
diff --git a/os/tests/test_publication.py b/os/tests/test_publication.py
index cabbb5eb9..ab4b82474 100644
--- a/os/tests/test_publication.py
+++ b/os/tests/test_publication.py
@@ -86,6 +86,25 @@ class PublicationGuards(unittest.TestCase):
with self.assertRaises(ValueError):
publish.validate_examples(root, 'dsh')
+ def test_install_first_requires_the_new_journey_and_installed_agent(self):
+ manifest = {'source_commit': 'source-one', 'iso': {'sha256': 'image-one'}, 'capabilities': ['install-first']}
+ extras = ['Harness unlock screen renders, masks input, accepts a retry',
+ 'Claude Code, Codex and pi install on demand; bundled OpenCode',
+ 'On-demand gcc/make installation']
+ receipts = [dict(firmware=fw, encrypted=encrypted, status='passed', iso_sha256='image-one',
+ image_source_commit='source-one', checks=publish.INSTALL_FIRST_CHECKS + extras)
+ for fw, encrypted in [('bios', False), ('uefi', True)]]
+ publish.validate_receipts(manifest, receipts)
+ for required in publish.INSTALL_FIRST_CHECKS:
+ bad = copy.deepcopy(receipts)
+ bad[0]['checks'].remove(required)
+ with self.subTest(missing=required), self.assertRaises(ValueError):
+ publish.validate_receipts(manifest, bad)
+ for row in receipts:
+ row['checks'] = publish.REQUIRED_CHECKS + extras
+ with self.assertRaises(ValueError):
+ publish.validate_receipts(manifest, receipts)
+
def test_only_complete_matching_machine_evidence_can_publish(self):
manifest = {'source_commit': 'source-one', 'iso': {'sha256': 'image-one'}}
receipts = [dict(firmware=fw, encrypted=encrypted, status='passed', iso_sha256='image-one',
diff --git a/os/tests/vm.py b/os/tests/vm.py
index 86ae179f5..90303e557 100644
--- a/os/tests/vm.py
+++ b/os/tests/vm.py
@@ -403,80 +403,90 @@ def check_console_fallback(vm, user, folder):
vm.screenshot('03b-graphics-restored')
-def check_first_use(vm, user, folder):
- """Operate the actual USB front door without a terminal command from the user."""
- vm.command('test "$(uname -n)" = harness && test "$(id -nu 1000)" = me && test -f /etc/harness-live')
- vm.command('nmcli networking off')
+def check_first_use(vm, user, folder, installed=False):
+ """Operate the installed first-use page or a historical USB trial."""
version, _ = vm.command(user('/usr/bin/opencode --version'))
(folder / 'bundled-opencode-version.txt').write_text(version)
defaults = json.loads(vm.read_file('/home/me/.config/opencode/opencode.json'))
assert not set(defaults) & {'model', 'provider', 'providers'}, 'The image must retain upstream model and provider defaults'
assert defaults.get('update') == 'disable', 'The packaged agent must remain managed by system updates'
- vm.command(user('sh -c ' + shlex.quote('for n in $(seq 1 30); do hn capture-pane -p | grep -q "Connect to Wi-Fi to get started" && exit 0; sleep 1; done; exit 1')), timeout=40)
- vm.screenshot('01a-network-first')
- vm.command('! pgrep -u 1000 -x opencode')
- # Escape cannot leave a first-use dead end. Offline install is in this page.
- vm.keys('esc')
- vm.command(user('hn capture-pane -p') + ' | grep -q "Install without connecting"')
- vm.keys('i')
- vm.command(user('sh -c ' + shlex.quote('for n in $(seq 1 30); do hn capture-pane -p | grep -q "Repeat password" && exit 0; sleep 1; done; exit 1')), timeout=40)
- vm.screenshot('01a-offline-install')
- vm.keys('esc')
- # The OS shortcut needs neither a prefix nor Shift, and works offline.
- vm.keys('meta_l', 'i')
- vm.command(user('sh -c ' + shlex.quote('for n in $(seq 1 30); do hn capture-pane -p | grep -q "Repeat password" && exit 0; sleep 1; done; exit 1')), timeout=40)
- vm.screenshot('01b-direct-install-offline')
- vm.keys('esc')
- vm.command('sleep 1; test "$(lsblk -n -o TYPE /dev/vda | wc -l)" -eq 1')
- # A preflight error must remain visible in a command-owned pane until read.
- vm.command(user('hn new-window -n install-error ' + shlex.quote('sudo /usr/bin/harness install --source /run/hn-missing-image')))
- vm.command(user('sh -c ' + shlex.quote('for n in $(seq 1 15); do hn capture-pane -p | grep -q "Press Enter to return to Harness" && exit 0; sleep 1; done; exit 1')), timeout=20)
- installer_process = '^/usr/bin/python3 /usr/lib/harness-os/install[.]py --source /run/hn-missing-image$'
- vm.command('pgrep -f ' + shlex.quote(installer_process))
- vm.screenshot('01b-install-error')
- vm.keys('ret')
- vm.command('for n in $(seq 1 15); do ! pgrep -f ' + shlex.quote(installer_process) + ' && exit 0; sleep 1; done; exit 1', timeout=20)
- # New terminal is a shell immediately, without agent/project/task fields.
- vm.keys('meta_l', 't')
- vm.type_probe('echo terminal-ready')
- vm.keys('ret')
- vm.command(user('sh -c ' + shlex.quote('for n in $(seq 1 20); do hn capture-pane -p | grep -qx terminal-ready && exit 0; sleep 1; done; exit 1')), timeout=30)
- vm.screenshot('01c-direct-terminal')
- # Allow a full discovery cycle, then ensure a live-overlay shell or
- # installer has not been promoted to an agent by rounded file identities.
- vm.command('sleep 6')
- identity_probe = '''const fs = require('node:fs');
-for (const path of ['/usr/bin/opencode', '/usr/bin/bash', '/usr/bin/python3', '/usr/bin/nmtui', '/usr/bin/sudo']) {
- const numeric = fs.statSync(path), exact = fs.statSync(path, {bigint: true});
- console.log(JSON.stringify({path, numberKey: `${numeric.dev}:${numeric.ino}`, exactKey: `${exact.dev}:${exact.ino}`}));
-}
-const rows = JSON.parse(fs.readFileSync('/home/me/.harness/cli/data/registry.json', 'utf8'));
-for (const row of rows) console.log(JSON.stringify({agentId: row.agentId, engine: row.engine, active: row.active, processIdentity: row.processIdentity}));
-if (rows.some(row => row.engine !== 'terminal')) throw new Error('A plain shell or installer was misidentified as an agent');
-'''
- output, identity_status = vm.command(user('node -e ' + shlex.quote(identity_probe)), check=False)
- (folder / 'live-process-identities.txt').write_text(output)
- assert identity_status == 0, 'Live USB executable discovery must distinguish shells and installers from agents'
- output, _ = vm.command(user('hn display-message -p "HN_FIRST_TERMINAL=#{pane_id}"'))
- pane = re.search(r'HN_FIRST_TERMINAL=(%\d+)', output)
- assert pane, 'New terminal must identify its actual pane'
- vm.keys('ctrl', 'd')
- vm.command(user('sh -c ' + shlex.quote('for n in $(seq 1 30); do '
- 'hn list-panes -a -F "#{pane_id}" | grep -Fx ' + shlex.quote(pane.group(1)) +
- ' >/dev/null || exit 0; sleep .25; done; exit 1')), timeout=15)
- # The OS opts into hn's existing shell-tab setting; test real prefix keys,
- # since invoking new-window through the CLI already opened a shell before.
- vm.keys('ctrl', 'b')
- vm.keys('c')
- time.sleep(1)
- vm.type_probe('echo prefix-tab-ready')
- vm.keys('ret')
- vm.command(user('sh -c ' + shlex.quote('for n in $(seq 1 20); do hn capture-pane -p | grep -qx prefix-tab-ready && exit 0; sleep .5; done; exit 1')), timeout=15)
- vm.screenshot('01c-prefix-terminal-tab')
- vm.keys('ctrl', 'd')
- time.sleep(.5)
+ if installed:
+ vm.command('test ! -e /etc/harness-live && test "$(id -un)" = me')
+ vm.command('for n in $(seq 1 40); do hn capture-pane -p | grep -q "Connect to Wi-Fi to get started" && exit 0; sleep .5; done; exit 1', timeout=30)
+ vm.screenshot('installed-network-first')
+ vm.command('! pgrep -u 1000 -x opencode')
+ vm.keys('esc')
+ vm.command('hn capture-pane -p | grep -q "Connect to Wi-Fi to get started"')
+ else:
+ vm.command('test "$(uname -n)" = harness && test "$(id -nu 1000)" = me && test -f /etc/harness-live')
+ vm.command('nmcli networking off')
+ vm.command(user('sh -c ' + shlex.quote('for n in $(seq 1 30); do hn capture-pane -p | grep -q "Connect to Wi-Fi to get started" && exit 0; sleep 1; done; exit 1')), timeout=40)
+ vm.screenshot('01a-network-first')
+ vm.command('! pgrep -u 1000 -x opencode')
+ # Escape cannot leave a first-use dead end. Offline install is in this page.
+ vm.keys('esc')
+ vm.command(user('hn capture-pane -p') + ' | grep -q "Install without connecting"')
+ vm.keys('i')
+ vm.command(user('sh -c ' + shlex.quote('for n in $(seq 1 30); do hn capture-pane -p | grep -q "Repeat password" && exit 0; sleep 1; done; exit 1')), timeout=40)
+ vm.screenshot('01a-offline-install')
+ vm.keys('esc')
+ # The OS shortcut needs neither a prefix nor Shift, and works offline.
+ vm.keys('meta_l', 'i')
+ vm.command(user('sh -c ' + shlex.quote('for n in $(seq 1 30); do hn capture-pane -p | grep -q "Repeat password" && exit 0; sleep 1; done; exit 1')), timeout=40)
+ vm.screenshot('01b-direct-install-offline')
+ vm.keys('esc')
+ vm.command('sleep 1; test "$(lsblk -n -o TYPE /dev/vda | wc -l)" -eq 1')
+ # A preflight error must remain visible in a command-owned pane until read.
+ vm.command(user('hn new-window -n install-error ' + shlex.quote('sudo /usr/bin/harness install --source /run/hn-missing-image')))
+ vm.command(user('sh -c ' + shlex.quote('for n in $(seq 1 15); do hn capture-pane -p | grep -q "Press Enter to return to Harness" && exit 0; sleep 1; done; exit 1')), timeout=20)
+ installer_process = '^/usr/bin/python3 /usr/lib/harness-os/install[.]py --source /run/hn-missing-image$'
+ vm.command('pgrep -f ' + shlex.quote(installer_process))
+ vm.screenshot('01b-install-error')
+ vm.keys('ret')
+ vm.command('for n in $(seq 1 15); do ! pgrep -f ' + shlex.quote(installer_process) + ' && exit 0; sleep 1; done; exit 1', timeout=20)
+ # New terminal is a shell immediately, without agent/project/task fields.
+ vm.keys('meta_l', 't')
+ vm.type_probe('echo terminal-ready')
+ vm.keys('ret')
+ vm.command(user('sh -c ' + shlex.quote('for n in $(seq 1 20); do hn capture-pane -p | grep -qx terminal-ready && exit 0; sleep 1; done; exit 1')), timeout=30)
+ vm.screenshot('01c-direct-terminal')
+ # Allow a full discovery cycle, then ensure a live-overlay shell or
+ # installer has not been promoted to an agent by rounded file identities.
+ vm.command('sleep 6')
+ identity_probe = '''const fs = require('node:fs');
+ for (const path of ['/usr/bin/opencode', '/usr/bin/bash', '/usr/bin/python3', '/usr/bin/nmtui', '/usr/bin/sudo']) {
+ const numeric = fs.statSync(path), exact = fs.statSync(path, {bigint: true});
+ console.log(JSON.stringify({path, numberKey: `${numeric.dev}:${numeric.ino}`, exactKey: `${exact.dev}:${exact.ino}`}));
+ }
+ const rows = JSON.parse(fs.readFileSync('/home/me/.harness/cli/data/registry.json', 'utf8'));
+ for (const row of rows) console.log(JSON.stringify({agentId: row.agentId, engine: row.engine, active: row.active, processIdentity: row.processIdentity}));
+ if (rows.some(row => row.engine !== 'terminal')) throw new Error('A plain shell or installer was misidentified as an agent');
+ '''
+ output, identity_status = vm.command(user('node -e ' + shlex.quote(identity_probe)), check=False)
+ (folder / 'live-process-identities.txt').write_text(output)
+ assert identity_status == 0, 'Live USB executable discovery must distinguish shells and installers from agents'
+ output, _ = vm.command(user('hn display-message -p "HN_FIRST_TERMINAL=#{pane_id}"'))
+ pane = re.search(r'HN_FIRST_TERMINAL=(%\d+)', output)
+ assert pane, 'New terminal must identify its actual pane'
+ vm.keys('ctrl', 'd')
+ vm.command(user('sh -c ' + shlex.quote('for n in $(seq 1 30); do '
+ 'hn list-panes -a -F "#{pane_id}" | grep -Fx ' + shlex.quote(pane.group(1)) +
+ ' >/dev/null || exit 0; sleep .25; done; exit 1')), timeout=15)
+ # The OS opts into hn's existing shell-tab setting; test real prefix keys,
+ # since invoking new-window through the CLI already opened a shell before.
+ vm.keys('ctrl', 'b')
+ vm.keys('c')
+ time.sleep(1)
+ vm.type_probe('echo prefix-tab-ready')
+ vm.keys('ret')
+ vm.command(user('sh -c ' + shlex.quote('for n in $(seq 1 20); do hn capture-pane -p | grep -qx prefix-tab-ready && exit 0; sleep .5; done; exit 1')), timeout=15)
+ vm.screenshot('01c-prefix-terminal-tab')
+ vm.keys('ctrl', 'd')
+ time.sleep(.5)
vm.monitor('set_link', name='hnnet', up=True)
- vm.command('nmcli networking on; for n in $(seq 1 30); do test "$(nmcli -t -f STATE general)" = connected && exit 0; sleep 1; done; exit 1', timeout=40)
+ if not installed:
+ vm.command('nmcli networking on')
+ vm.command('for n in $(seq 1 30); do test "$(nmcli -t -f STATE general)" = connected && exit 0; sleep 1; done; exit 1', timeout=40)
vm.command('for n in $(seq 1 90); do pgrep -u 1000 -x opencode >/dev/null && exit 0; sleep 1; done; exit 1', timeout=100)
time.sleep(5)
vm.screenshot('01d-bundled-opencode')
@@ -507,9 +517,12 @@ if (rows.some(row => row.engine !== 'terminal')) throw new Error('A plain shell
assert re.fullmatch(r'/home/me/projects/opencode-\d{4}-\d{2}-\d{2}-\d{2}-\d{2}(?:-\d+)*', agent_path), agent_path
vm.command(user('hn display-message -p "#{E:status-right}"') + ' > /tmp/hn-first-footer.txt')
footer = vm.read_file('/tmp/hn-first-footer.txt').decode()
- assert 'Make Harness your OS.' in footer and '[ Install Harness ]' in footer, footer
- vm.command(user('hn show-options -gv status-style') + ' > /tmp/hn-first-footer-style.txt')
- assert vm.read_file('/tmp/hn-first-footer-style.txt').strip() == b'fg=black,bg=green'
+ if installed:
+ assert 'Install Harness' not in footer, footer
+ else:
+ assert 'Make Harness your OS.' in footer and '[ Install Harness ]' in footer, footer
+ vm.command(user('hn show-options -gv status-style') + ' > /tmp/hn-first-footer-style.txt')
+ assert vm.read_file('/tmp/hn-first-footer-style.txt').strip() == b'fg=black,bg=green'
vm.command("! pgrep -f '[/]usr/lib/harness-os/network[.]py'")
for index, row in enumerate(right):
vm.command(user('hn select-pane -t ' + row[0]))
@@ -560,17 +573,18 @@ if (rows.some(row => row.engine !== 'terminal')) throw new Error('A plain shell
' >/dev/null && exit 0; sleep 1; done; exit 1', timeout=30)
vm.keys('ret')
time.sleep(1)
- # F10 reaches the dock without consuming the agent's ordinary Tab key.
- vm.keys('f10')
- vm.keys('ret')
- vm.command(user('sh -c ' + shlex.quote('for n in $(seq 1 30); do hn capture-pane -p | grep -q "Repeat password" && exit 0; sleep 1; done; exit 1')), timeout=40)
- vm.screenshot('01d-dock-install')
- vm.keys('esc')
- time.sleep(1)
- vm.click_word('01d-mouse-install', 'Install')
- vm.command(user('sh -c ' + shlex.quote('for n in $(seq 1 30); do hn capture-pane -p | grep -q "Repeat password" && exit 0; sleep 1; done; exit 1')), timeout=40)
- vm.command('test "$(lsblk -n -o TYPE /dev/vda | wc -l)" -eq 1')
- vm.keys('esc')
+ if not installed:
+ # F10 reaches the dock without consuming the agent's ordinary Tab key.
+ vm.keys('f10')
+ vm.keys('ret')
+ vm.command(user('sh -c ' + shlex.quote('for n in $(seq 1 30); do hn capture-pane -p | grep -q "Repeat password" && exit 0; sleep 1; done; exit 1')), timeout=40)
+ vm.screenshot('01d-dock-install')
+ vm.keys('esc')
+ time.sleep(1)
+ vm.click_word('01d-mouse-install', 'Install')
+ vm.command(user('sh -c ' + shlex.quote('for n in $(seq 1 30); do hn capture-pane -p | grep -q "Repeat password" && exit 0; sleep 1; done; exit 1')), timeout=40)
+ vm.command('test "$(lsblk -n -o TYPE /dev/vda | wc -l)" -eq 1')
+ vm.keys('esc')
# Exercise what a first-time user actually does after choosing Try: type
# into the visible agent and receive its answer, without a CLI/API shortcut.
vm.type_probe('what is six times seven reply with digits only')
@@ -597,21 +611,23 @@ if (rows.some(row => row.engine !== 'terminal')) throw new Error('A plain shell
assert guide_status == 0, 'Bundled OpenCode must explain the actual OS shortcuts from its local guide'
# Build inside the actual per-agent project, as a person does. A sibling
# directory would instead exercise OpenCode's external-directory permission.
- trial_project = agent_path + '/usb-trial/index.html'
- vm.type_probe('create the folder usb-trial in this project and an index html page inside it saying hello harness')
+ project_name = 'first-project' if installed else 'usb-trial'
+ trial_project = agent_path + '/' + project_name + '/index.html'
+ vm.type_probe('create the folder ' + project_name + ' in this project and an index html page inside it saying hello harness')
vm.keys('ret')
vm.command('for n in $(seq 1 120); do test -s ' + shlex.quote(trial_project) + ' && '
'grep -iq "hello harness" ' + shlex.quote(trial_project) + ' && exit 0; sleep 1; done; exit 1', timeout=140)
(folder / 'trial-project.html').write_bytes(vm.read_file(trial_project))
vm.screenshot('01g-agent-created-trial-project')
- # Test the agent-led install entry too. It may open the form; it must never
- # choose a disk or perform the destructive action from the conversation.
- vm.type_probe('open the harness installer for me but do not choose a disk or start installation')
- vm.keys('ret')
- vm.command(user('sh -c ' + shlex.quote('for n in $(seq 1 90); do hn capture-pane -p | grep -q "Repeat password" && exit 0; sleep 1; done; exit 1')), timeout=100)
- vm.command('test "$(lsblk -n -o TYPE /dev/vda | wc -l)" -eq 1')
- vm.screenshot('01h-agent-opened-installer')
- vm.keys('esc')
+ if not installed:
+ # Test the agent-led install entry too. It may open the form; it must never
+ # choose a disk or perform the destructive action from the conversation.
+ vm.type_probe('open the harness installer for me but do not choose a disk or start installation')
+ vm.keys('ret')
+ vm.command(user('sh -c ' + shlex.quote('for n in $(seq 1 90); do hn capture-pane -p | grep -q "Repeat password" && exit 0; sleep 1; done; exit 1')), timeout=100)
+ vm.command('test "$(lsblk -n -o TYPE /dev/vda | wc -l)" -eq 1')
+ vm.screenshot('01h-agent-opened-installer')
+ vm.keys('esc')
# No model flag/config, API key, account, or installer. Validate a real
# upstream-default reply; preserve all events rather than just the exit code.
prompt = 'What is six times seven? Reply with only the decimal number. Do not use tools.'
@@ -632,6 +648,8 @@ if (rows.some(row => row.engine !== 'terminal')) throw new Error('A plain shell
events.append(event)
reply = ''.join(e.get('part', {}).get('text', '') for e in events if e.get('type') == 'text').strip()
assert status == 0 and reply == '42', f'Bundled OpenCode default conversation failed: exit={status}, reply={reply!r}'
+ if installed:
+ return trial_project
vm.keys('ctrl', 'c')
time.sleep(.3)
vm.keys('ctrl', 'c')
@@ -643,7 +661,7 @@ if (rows.some(row => row.engine !== 'terminal')) throw new Error('A plain shell
return trial_project
-def install_interactively(vm, config, folder):
+def install_interactively(vm, config, folder, direct=False):
# Drive the actual graphical form. The sole installer addition is serial boot
# output so the following installed boot remains observable to this fixture.
bootstrap = f'''import importlib.util, traceback
@@ -659,6 +677,13 @@ def observed_install(actual, source, target, **kwargs):
actual['serial_console'] = True
return original_install(actual, source, target, **kwargs)
installer.install = observed_install
+original_run = installer.run
+def observed_run(*args, **kwargs):
+ if args == ('systemctl', 'poweroff'):
+ Path('/run/hn-shutdown-requested').touch()
+ return
+ return original_run(*args, **kwargs)
+installer.run = observed_run
status = 0
try:
installer.main()
@@ -675,11 +700,24 @@ if status:
vm.command(f"printf %s {shlex.quote(encoded)} | base64 -d > /run/hn-interactive-test.py; chmod 600 /run/hn-interactive-test.py")
user = lambda command: 'runuser -u me -- env XDG_RUNTIME_DIR=/run/user/1000 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus ' + command
_, progress_status = vm.command("grep -q '^def install_with_progress(' /usr/lib/harness-os/install.py", check=False)
- vm.command(user('sh -c ' + shlex.quote('hn new-window -P -F "#{pane_id}" -n Install '
- + shlex.quote('sudo python3 /run/hn-interactive-test.py') + ' > /tmp/hn-install-pane')))
+ if direct:
+ command = '/usr/bin/foot --config=/usr/share/harness-os/foot.ini /usr/bin/sudo /usr/bin/python3 /run/hn-interactive-test.py --boot'
+ override = '[Service]\nExecStart=\nExecStart=' + command + '\n'
+ encoded = base64.b64encode(override.encode()).decode()
+ vm.command('mkdir -p /run/user/1000/systemd/user/harness-install.service.d; printf %s ' + encoded + ' | base64 -d > /run/user/1000/systemd/user/harness-install.service.d/fixture.conf; chown -R me:me /run/user/1000/systemd')
+ vm.command(user('systemctl --user daemon-reload'))
+ vm.command(user('systemctl --user restart harness-install.service'))
+ else:
+ vm.command(user('sh -c ' + shlex.quote('hn new-window -P -F "#{pane_id}" -n Install '
+ + shlex.quote('sudo python3 /run/hn-interactive-test.py') + ' > /tmp/hn-install-pane')))
transcript = []
def wait_screen(pattern, timeout=30):
+ if direct:
+ from install_first import wait_installer_screen
+ output = wait_installer_screen(vm, pattern, 'installer-current', timeout)
+ transcript.append(output)
+ return output
command = ('for n in $(seq 1 ' + str(timeout * 2) + '); do '
'hn capture-pane -p -t "$(cat /tmp/hn-install-pane)" > /tmp/hn-install-screen || exit 1; '
'grep -Eq ' + shlex.quote(pattern) + ' /tmp/hn-install-screen && exit 0; '
@@ -696,7 +734,8 @@ if status:
# A first typed character must go straight into the masked password.
vm.type_probe('x')
entered = wait_screen('Repeat password')
- assert '[*' in entered, 'Installer did not initially focus Password'
+ if not direct:
+ assert '[*' in entered, 'Installer did not initially focus Password'
vm.keys('ctrl', 'u')
vm.keys('shift', 'tab')
vm.keys('shift', 'tab')
@@ -718,7 +757,9 @@ if status:
vm.type_probe(config['password'])
vm.keys('ret')
output = wait_screen('Repeat password')
- assert config['password'] not in output and '*' * len(config['password']) in output, 'Password fields must be masked'
+ assert config['password'] not in output, 'Password fields must be masked'
+ if not direct:
+ assert '*' * len(config['password']) in output, 'Password fields must be masked'
vm.screenshot('install-03-ready')
# Finishing password entry only focuses Install. No disk has changed yet.
vm.command('test "$(lsblk -n -o TYPE /dev/vda | wc -l)" -eq 1')
@@ -727,9 +768,11 @@ if status:
progress = wait_screen('Preparing the disk|Setting up encryption|Copying Harness|Setting up your account', timeout=30)
assert 'Keep this computer powered on' not in progress and 'Installing Harness' not in progress
vm.screenshot('install-04-progress')
- wait_screen('Harness is installed', timeout=900)
+ output = wait_screen('Harness is installed', timeout=900)
vm.screenshot('install-05-complete')
- vm.keys('esc')
+ if direct:
+ assert 'Back to Harness' not in output
+ vm.keys('ret' if direct else 'esc')
vm.command('for n in $(seq 1 30); do test -s /run/hn-interactive-status && break; sleep .25; done; test "$(cat /run/hn-interactive-status)" = 0')
finally:
(folder / 'installer-ui.log').write_text('\n'.join(transcript))
@@ -806,6 +849,7 @@ def main():
result['image_source_commit'] = manifest['source_commit']
result['test_source_commit'] = subprocess.check_output(['git', 'rev-parse', 'HEAD'], text=True).strip()
result['test_script_sha256'] = hashlib.sha256(Path(__file__).read_bytes()).hexdigest()
+ direct = 'install-first' in manifest.get('capabilities', [])
vm = VM(folder, args.iso.resolve(), args.firmware, args.memory, args.live_transport, args.cpu)
user = lambda cmd: 'runuser -u "$(id -nu 1000)" -- env XDG_RUNTIME_DIR=/run/user/1000 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus ' + cmd
try:
@@ -837,65 +881,70 @@ assert str(i.live_payload()) == '/run/archiso/copytoram/airootfs.sfs'
vm.command('printf %s ' + encoded + ' | base64 -d | python3')
result['checks'].append('The unmounted writable Harness USB is rejected as an installation target in RAM mode')
vm.command('foot --check-config --config=/usr/share/harness-os/foot.ini')
- vm.command(user("sh -c 'for n in $(seq 1 90); do systemctl --user is-active --quiet hn-screen && pgrep -u 1000 -x \"hn|harness-tui\" >/dev/null && exit 0; sleep 1; done; systemctl --user --no-pager status hn-screen harness-daemon; exit 1'"), timeout=110)
- vm.command(user('/usr/lib/harness-os/wait-runtime'), timeout=160)
- result['live_hn_ready_seconds'] = round(time.monotonic() - vm.started, 3)
- result['checks'].append('Harness runtime reports discovery ready before hn startup is measured')
- output, _ = vm.command("printf 'HN_SCRATCH=%s\\n' \"$(df -B1 --output=size /run/archiso/cowspace | tail -1)\"")
- scratch_bytes = int(re.search(r'HN_SCRATCH=\s*(\d+)', output).group(1))
- if scratch_bytes < args.memory * 1024 ** 2 * 0.45:
- raise RuntimeError('Live writable space is too small for on-demand agent installation.')
- result['live_scratch_mib'] = round(scratch_bytes / 1024 ** 2, 1)
- vm.command('! pgrep -x chromium')
- result['checks'].append('Live hn ready; browser absent at boot')
- vm.command('systemctl start harness-keyring; pacman -Si git chromium >/dev/null', timeout=180)
- result['checks'].append('Dated package repositories are queryable before the first download')
- vm.command(user('systemd-run --user --quiet --wait --pipe --collect /bin/sh -c ' +
- shlex.quote('printf hn-clipboard-check | wl-copy; test "$(wl-paste --no-newline)" = hn-clipboard-check')))
- result['checks'].append('Wayland clipboard round trip')
- vm.screenshot('01-live-hn')
- output, _ = vm.command(user('hn-os measure'))
- (folder / 'live-measurement.txt').write_text(output)
- trial_project = check_first_use(vm, user, folder)
- result['checks'].append('USB opens network setup; Super+i opens Install offline; Super+t opens a terminal without a setup form')
- result['checks'].append('Installer errors remain visible until acknowledged; exiting a direct terminal removes its pane')
- result['checks'].append('USB first agent conversation accepts physical keyboard input and displays the expected reply')
- result['checks'].append('Bundled OpenCode loads the local TUI guide, explains Super+n/m, creates a trial project, and opens the native installer on request')
- result['checks'].append('Super+n/m open the agent and machine controls; F10/Enter and an actual pointer click open the install dock action')
- result['checks'].append('Bundled OpenCode starts offline and its upstream-default clean-profile conversation returns the independently checked answer')
- vm.keys('meta_l', 'b')
- vm.command("for n in $(seq 1 45); do pgrep -x chromium >/dev/null && break; sleep 1; done; pgrep -x chromium", timeout=60)
- time.sleep(3)
- vm.screenshot('02-browser')
- vm.keys('meta_l', 'b')
- time.sleep(1)
- vm.screenshot('03-return-to-hn')
- result['checks'].append('Browser starts only on shortcut; toggle screenshots recorded')
- # hn has its own tmux-style settings; the underlying tmux server needs
- # its separate system configuration so a short-lived last pane cannot
- # restart the server and reuse a still-registered terminal identity.
- for index in range(3):
- vm.command(user('hn new-window -n quick-exit ' + shlex.quote(f'touch /tmp/hn-quick-exit-{index}')))
- vm.command(f'for n in $(seq 1 10); do test -e /tmp/hn-quick-exit-{index} && exit 0; sleep 1; done; exit 1', timeout=15)
- result['checks'].append('Closing the last terminal and immediately opening another works repeatedly')
- # A long-lived terminal process proves a screen restart does not kill the work.
- survivor = "echo $$ > /tmp/hn-survivor.pid; exec sleep 1800"
- vm.command(user("hn new-window -n persistence " + shlex.quote(survivor)))
- vm.command('for n in $(seq 1 15); do test -s /tmp/hn-survivor.pid && exit 0; sleep 1; done; exit 1', timeout=20)
- clipboard_probe = 'printf hn-pane-clipboard | wl-copy; test "$(wl-paste --no-newline)" = hn-pane-clipboard && touch /tmp/hn-pane-clipboard-passed'
- vm.command(user('hn new-window -n clipboard ' + shlex.quote(clipboard_probe)))
- vm.command('for n in $(seq 1 15); do test -e /tmp/hn-pane-clipboard-passed && exit 0; sleep 1; done; exit 1', timeout=20)
- result['checks'].append('An hn terminal pane inherits the working Wayland clipboard environment')
- vm.command('! ' + user('hn detach'))
- vm.command('! ' + user('hn suspend-client'))
- vm.command('kill -0 "$(cat /tmp/hn-survivor.pid)"')
- result['checks'].append('OS surface refuses detach and suspend while work stays alive')
- vm.command(user('systemctl --user restart hn-screen'))
- vm.command('sleep 3; kill -0 "$(cat /tmp/hn-survivor.pid)"')
- result['checks'].append('Terminal process survives screen restart')
- check_console_fallback(vm, user, folder)
- result['checks'].append('Graphics startup failure falls back to hn on tty1; physical-keyboard input reaches a terminal pane and existing work survives')
- result['checks'].append('Restoring graphics returns to the fullscreen hn service without losing the terminal process')
+ if direct:
+ from install_first import check_usb_installer
+ result['live_installer_ready_seconds'] = check_usb_installer(vm, user, folder)
+ result['checks'].append('USB opens the installer directly with no trial, network page, hn runtime or agent')
+ else:
+ vm.command(user("sh -c 'for n in $(seq 1 90); do systemctl --user is-active --quiet hn-screen && pgrep -u 1000 -x \"hn|harness-tui\" >/dev/null && exit 0; sleep 1; done; systemctl --user --no-pager status hn-screen harness-daemon; exit 1'"), timeout=110)
+ vm.command(user('/usr/lib/harness-os/wait-runtime'), timeout=160)
+ result['live_hn_ready_seconds'] = round(time.monotonic() - vm.started, 3)
+ result['checks'].append('Harness runtime reports discovery ready before hn startup is measured')
+ output, _ = vm.command("printf 'HN_SCRATCH=%s\\n' \"$(df -B1 --output=size /run/archiso/cowspace | tail -1)\"")
+ scratch_bytes = int(re.search(r'HN_SCRATCH=\s*(\d+)', output).group(1))
+ if scratch_bytes < args.memory * 1024 ** 2 * 0.45:
+ raise RuntimeError('Live writable space is too small for on-demand agent installation.')
+ result['live_scratch_mib'] = round(scratch_bytes / 1024 ** 2, 1)
+ vm.command('! pgrep -x chromium')
+ result['checks'].append('Live hn ready; browser absent at boot')
+ vm.command('systemctl start harness-keyring; pacman -Si git chromium >/dev/null', timeout=180)
+ result['checks'].append('Dated package repositories are queryable before the first download')
+ vm.command(user('systemd-run --user --quiet --wait --pipe --collect /bin/sh -c ' +
+ shlex.quote('printf hn-clipboard-check | wl-copy; test "$(wl-paste --no-newline)" = hn-clipboard-check')))
+ result['checks'].append('Wayland clipboard round trip')
+ vm.screenshot('01-live-hn')
+ output, _ = vm.command(user('hn-os measure'))
+ (folder / 'live-measurement.txt').write_text(output)
+ trial_project = check_first_use(vm, user, folder)
+ result['checks'].append('USB opens network setup; Super+i opens Install offline; Super+t opens a terminal without a setup form')
+ result['checks'].append('Installer errors remain visible until acknowledged; exiting a direct terminal removes its pane')
+ result['checks'].append('USB first agent conversation accepts physical keyboard input and displays the expected reply')
+ result['checks'].append('Bundled OpenCode loads the local TUI guide, explains Super+n/m, creates a trial project, and opens the native installer on request')
+ result['checks'].append('Super+n/m open the agent and machine controls; F10/Enter and an actual pointer click open the install dock action')
+ result['checks'].append('Bundled OpenCode starts offline and its upstream-default clean-profile conversation returns the independently checked answer')
+ vm.keys('meta_l', 'b')
+ vm.command("for n in $(seq 1 45); do pgrep -x chromium >/dev/null && break; sleep 1; done; pgrep -x chromium", timeout=60)
+ time.sleep(3)
+ vm.screenshot('02-browser')
+ vm.keys('meta_l', 'b')
+ time.sleep(1)
+ vm.screenshot('03-return-to-hn')
+ result['checks'].append('Browser starts only on shortcut; toggle screenshots recorded')
+ # hn has its own tmux-style settings; the underlying tmux server needs
+ # its separate system configuration so a short-lived last pane cannot
+ # restart the server and reuse a still-registered terminal identity.
+ for index in range(3):
+ vm.command(user('hn new-window -n quick-exit ' + shlex.quote(f'touch /tmp/hn-quick-exit-{index}')))
+ vm.command(f'for n in $(seq 1 10); do test -e /tmp/hn-quick-exit-{index} && exit 0; sleep 1; done; exit 1', timeout=15)
+ result['checks'].append('Closing the last terminal and immediately opening another works repeatedly')
+ # A long-lived terminal process proves a screen restart does not kill the work.
+ survivor = "echo $$ > /tmp/hn-survivor.pid; exec sleep 1800"
+ vm.command(user("hn new-window -n persistence " + shlex.quote(survivor)))
+ vm.command('for n in $(seq 1 15); do test -s /tmp/hn-survivor.pid && exit 0; sleep 1; done; exit 1', timeout=20)
+ clipboard_probe = 'printf hn-pane-clipboard | wl-copy; test "$(wl-paste --no-newline)" = hn-pane-clipboard && touch /tmp/hn-pane-clipboard-passed'
+ vm.command(user('hn new-window -n clipboard ' + shlex.quote(clipboard_probe)))
+ vm.command('for n in $(seq 1 15); do test -e /tmp/hn-pane-clipboard-passed && exit 0; sleep 1; done; exit 1', timeout=20)
+ result['checks'].append('An hn terminal pane inherits the working Wayland clipboard environment')
+ vm.command('! ' + user('hn detach'))
+ vm.command('! ' + user('hn suspend-client'))
+ vm.command('kill -0 "$(cat /tmp/hn-survivor.pid)"')
+ result['checks'].append('OS surface refuses detach and suspend while work stays alive')
+ vm.command(user('systemctl --user restart hn-screen'))
+ vm.command('sleep 3; kill -0 "$(cat /tmp/hn-survivor.pid)"')
+ result['checks'].append('Terminal process survives screen restart')
+ check_console_fallback(vm, user, folder)
+ result['checks'].append('Graphics startup failure falls back to hn on tty1; physical-keyboard input reaches a terminal pane and existing work survives')
+ result['checks'].append('Restoring graphics returns to the fullscreen hn service without losing the terminal process')
if args.live_only:
result['status'] = 'passed'
return
@@ -906,10 +955,11 @@ assert str(i.live_payload()) == '/run/archiso/copytoram/airootfs.sfs'
username='me', hostname='harness', password='test-password-123',
encrypt=args.encrypt, serial_console=True)
# Installation must work with the NIC down, using the ISO's immutable payload.
- (folder / 'trial-project.html').write_bytes(vm.read_file(trial_project))
+ if not direct:
+ (folder / 'trial-project.html').write_bytes(vm.read_file(trial_project))
vm.command(user('sh -c ' + shlex.quote('mkdir -p "$HOME/.config"; printf trial-only > "$HOME/.config/hn-trial-credential"')))
vm.command('nmcli networking off')
- install_interactively(vm, config, folder)
+ install_interactively(vm, config, folder, direct=direct)
result['checks'].append('Keyboard disk selection, encryption checkbox, masked password entry and a single Install action work on the guest terminal')
result['checks'].append('Offline installer completed on disposable disk')
if config['encrypt']:
@@ -924,8 +974,15 @@ assert str(i.live_payload()) == '/run/archiso/copytoram/airootfs.sfs'
vm.command('sync')
vm.stop()
vm.start(live=False)
+ if direct:
+ vm.monitor('set_link', name='hnnet', up=False)
unlock_delay = 100 if config['encrypt'] else 0
vm.login_installed(config, unlock_delay=unlock_delay)
+ 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')
+ result['checks'].append('Bundled OpenCode loads the local TUI guide, explains Super+n/m and creates a project on the installed disk')
+ result['checks'].append("Bundled OpenCode's upstream-default clean-profile conversation returns the independently checked answer")
vm.command('for n in $(seq 1 60); do test -f ~/.local/state/harness-os/onboarded && '
'test "$(hn list-panes -F "#{pane_id}" | wc -l)" -eq 3 && exit 0; sleep .5; done; exit 1', timeout=40)
vm.screenshot('installed-first-workspace')
@@ -936,13 +993,14 @@ assert str(i.live_payload()) == '/run/archiso/copytoram/airootfs.sfs'
vm.command("! pgrep -f '[/]usr/lib/harness-os/network[.]py'")
result['checks'].append('Fresh installed first boot opens the same three real panes and records onboarding only once')
result['checks'].append('Installed first use preserves hn’s full status bar and never reopens networking after the connection succeeds')
- saved_trial = vm.read_file(trial_project)
- assert saved_trial == (folder / 'trial-project.html').read_bytes(), 'The installed home lost or changed the agent-created trial project'
- vm.command('test ! -e /home/me/.config/hn-trial-credential && test "$(stat -c %u ' + shlex.quote(trial_project) + ')" -eq 1000')
- transfer = json.loads(vm.read_file('/home/me/.local/state/harness-os/trial-projects.json'))
- relative_trial = str(Path(trial_project).relative_to('/home/me/projects'))
- assert transfer['entries'][relative_trial]['sha256'] == hashlib.sha256(saved_trial).hexdigest()
- result['checks'].append('Agent-created USB trial project survives offline installation and installed boot byte-for-byte')
+ if not direct:
+ saved_trial = vm.read_file(trial_project)
+ assert saved_trial == (folder / 'trial-project.html').read_bytes(), 'The installed home lost or changed the agent-created trial project'
+ vm.command('test ! -e /home/me/.config/hn-trial-credential && test "$(stat -c %u ' + shlex.quote(trial_project) + ')" -eq 1000')
+ transfer = json.loads(vm.read_file('/home/me/.local/state/harness-os/trial-projects.json'))
+ relative_trial = str(Path(trial_project).relative_to('/home/me/projects'))
+ assert transfer['entries'][relative_trial]['sha256'] == hashlib.sha256(saved_trial).hexdigest()
+ result['checks'].append('Agent-created USB trial project survives offline installation and installed boot byte-for-byte')
result['deliberate_unlock_delay_seconds'] = unlock_delay
if unlock_delay:
result['installed_unlock_prompt_seconds'] = vm.unlock_prompt_seconds
@@ -955,7 +1013,7 @@ assert str(i.live_payload()) == '/run/archiso/copytoram/airootfs.sfs'
budget = installed['pbkdf_memory_limit_kib']
assert 64 * 1024 <= result['installed_pbkdf']['memory'] <= budget <= 1024 * 1024
result['pbkdf_memory_limit_kib'] = budget
- result['checks'].append('Encrypted installation after the agent trial retains benchmarked Argon2id within its RAM budget and unlocks after reboot')
+ result['checks'].append('Encrypted installation retains benchmarked Argon2id within its RAM budget and unlocks after reboot')
vm.command('test "$(id -un)" = ' + shlex.quote(config['username']) +
' && test "$HOME" = ' + shlex.quote('/home/' + config['username']) +
' && test "$(uname -n)" = ' + shlex.quote(config['hostname']))
@@ -971,6 +1029,9 @@ assert str(i.live_payload()) == '/run/archiso/copytoram/airootfs.sfs'
vm.command('test "$(npm prefix -g)" = "$HOME/.local"')
vm.command('findmnt -n -o FSTYPE / | grep -qx btrfs')
vm.command('findmnt -n -o FSTYPE /boot | grep -qx vfat')
+ if direct:
+ from install_first import check_installed_controls
+ check_installed_controls(vm, result, folder)
output, _ = vm.command('cat /var/lib/harness-os/install.json; hn-os measure')
(folder / 'installed-measurement.txt').write_text(output)
vm.screenshot('04-installed-hn')
diff --git a/os/tools/build-package.py b/os/tools/build-package.py
index 46a847218..6bd0513a7 100644
--- a/os/tools/build-package.py
+++ b/os/tools/build-package.py
@@ -77,6 +77,7 @@ def stage(source, runtime, destination, commit):
path.chmod(0o755)
for name in ['autostart', 'shutdown']:
(destination / 'usr/share/harness-os/labwc' / name).chmod(0o755)
+ (destination / 'usr/share/harness-os/labwc-install/autostart').chmod(0o755)
for path in (destination / 'etc/sudoers.d').iterdir():
path.chmod(0o440)
info.update(mode='source', files={p.name: {'sha256': digest(p), 'bytes': p.stat().st_size}
diff --git a/os/tools/inspect_image.py b/os/tools/inspect_image.py
index 035c6b599..074e7bf59 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'}, 'Image capabilities differ from the manifest'
+ assert set(manifest['capabilities']) == {'runtime-updates', 'system-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 0dbc19901..8e8c13c32 100644
--- a/os/tools/manifest.py
+++ b/os/tools/manifest.py
@@ -19,6 +19,8 @@ with iso.open('rb') as handle:
packages = (root / 'usr/share/harness-os/packages.txt').read_text()
(out / 'packages.txt').write_text(packages)
capabilities = []
+if (root / 'usr/lib/systemd/user/harness-install.service').is_file():
+ capabilities.append('install-first')
if all((root / path).is_file() for path in [
'usr/lib/harness-os/live_update.py',
'usr/lib/systemd/user/harness-update.timer']):
diff --git a/os/tools/publish.py b/os/tools/publish.py
index 20f4d19f7..250e4713d 100644
--- a/os/tools/publish.py
+++ b/os/tools/publish.py
@@ -26,6 +26,14 @@ REQUIRED_CHECKS = ['Live hn ready;', 'Wayland clipboard round trip',
'Offline checkpoint restored', 'Recovered disk boots to hn']
+INSTALL_FIRST_CHECKS = [check for check in REQUIRED_CHECKS if not check.startswith((
+ 'Live hn', 'USB ', 'Agent-created USB', 'Bundled OpenCode starts offline'))] + [
+ 'USB opens the installer directly with no trial, network page, hn runtime or agent',
+ 'Installed Wi-Fi first use advances into three real panes and the bundled default agent answers keyboard input',
+ "Bundled OpenCode's upstream-default clean-profile conversation",
+]
+
+
def digest(path):
with path.open('rb') as handle:
return hashlib.file_digest(handle, 'sha256').hexdigest()
@@ -76,7 +84,8 @@ def validate_receipts(manifest, receipts):
if receipt['iso_sha256'] != manifest['iso']['sha256'] or receipt['image_source_commit'] != manifest['source_commit']:
raise ValueError('Machine receipt covers a different image or source.')
checks = receipt.get('checks', [])
- if any(not any(check.startswith(prefix) for check in checks) for prefix in REQUIRED_CHECKS):
+ required = INSTALL_FIRST_CHECKS if 'install-first' in manifest.get('capabilities', []) else REQUIRED_CHECKS
+ if any(not any(check.startswith(prefix) for check in checks) for prefix in required):
raise ValueError('A required live, installation or recovery check is absent.')
if 'broadcom-offline' in manifest.get('capabilities', []) and not any(
check.startswith('Unrelated hardware receives no optional Wi-Fi packages') for check in checks):
@@ -203,7 +212,7 @@ def main():
Arch Linux with the LTS kernel, labwc, foot, and an on-demand browser. No desktop panels or preinstalled development stacks.
-To try it: follow the included `INSTALL.md` for Mac → USB → ThinkPad instructions. Verify the ISO's SHA-256, write the whole ISO to a USB stick, and boot an x86-64 PC with Secure Boot disabled. The USB asks for Wi-Fi when needed, then opens bundled OpenCode with its upstream model defaults and a local guide to Harness. Install without connecting works offline. Ask the agent to open installation, press Super+i, or click Install Harness in the persistent bottom dock. The same native form handles all three routes. Saved projects under ~/projects are preserved during installation; temporary account credentials and running processes are not. Super+n opens New Harness, Super+m connects a computer, and Super+t opens a shell directly. All Super shortcuts require no Shift; existing Ctrl+b bindings remain available. This preview's installer erases the entire selected disk; it does not resize another OS. Encryption is enabled by default.
+To install: follow the included `INSTALL.md` for Mac → USB → ThinkPad instructions. Verify the ISO's SHA-256, write the whole ISO to a USB stick, and boot an x86-64 PC with Secure Boot disabled. The USB opens the installer directly; installation works offline. Select the disk, enter the password twice and choose Install Harness. Shut down, remove the USB and boot the installed disk. The existing Wi-Fi page appears when disconnected, then bundled OpenCode opens on the left beside two terminal panes. Working Ethernet skips Wi-Fi setup. OpenCode retains its upstream model defaults and the local Harness guide. Super+n opens New Harness, Super+m connects a computer, and Super+t opens a shell directly. These shortcuts require no Shift; existing Ctrl+b bindings remain available. The installer erases the entire selected disk and does not resize another OS. Encryption is enabled by default.
{'The installer has four aligned fields: disk, encryption, password, repeat password. Disk choices fit on one line. Activate Install to begin; there is no second confirmation screen or minimum password length. Empty passwords are rejected. The account is me@harness. The password initially protects both the local account and, when enabled, the encrypted disk. There is no first-boot account wizard.' if interactive_install else ''}