207 Commits
Author SHA1 Message Date
Precious Okwu ed4809075f UI: rebalance Images table column widths for Repository and Tag (#1263)
* UI: rebalance Images table column widths for Repository and Tag

Prioritise Repository and Tag widths while keeping ID, Size, Created, Pulled, and Actions compact with tight padding and full title tooltips. Closes #1259.

* Tests: use exact key equality in images-columns escaping check
2026-12-06 10:55:41 +01:00
Precious OkwuandGeorgy Malkov 32fca8e7e8 UI: keep the Compose removal spinner circular (#1262)
Ports #1236 onto main.

.btn.more.rolling inherited gap: 7px from .btn and font-size: var(--fs) from .btn.sm while hiding the ellipsis only visually with color: transparent, and .btn:is(.ic, .more).rolling::after lacked flex: none and box-sizing: border-box. During Compose project removal and restart, the invisible ellipsis text and flex gap squeezed the ::after spinner ring horizontally into an off-centre oval.

- Collapse the ellipsis text and flex gap on .btn.more.rolling (font-size: 0em; gap: 0; color: transparent) and set flex: none; box-sizing: border-box on .btn:is(.ic, .more).rolling::after in crates/kiri/src/ui/index.html.
- Add regression test coverage in tests/ui/compose-as-containers.js and register the fix in tests/regressions.tsv and docs/fix-registry.md.

Co-authored-by: Georgy Malkov <5037509+goshander@users.noreply.github.com>
2026-12-06 10:42:04 +01:00
Precious Okwu 89b1564e15 Window: ask for a GitHub star once, star in the app, with confetti (#1257)
Kiri asks for a GitHub star once, after real use, as a small card at the bottom right. Star on GitHub stars in place through the GitHub CLI when it is signed in (opening GitHub otherwise), then thanks the person with a short confetti burst. It never shows over another card, never asks again after an answer, and `kiri star-prompt off|on` turns it off on every system.
2026-12-06 05:30:47 +01:00
Precious Okwu be129e52c4 Windows: fix non-OEM diskpart paths, setup.json BOM, and kiri-image Windows tests (#1252)
Resolve three Windows regressions found on origin/main (48de26f45):

- crates/kiri-image: gate Unix-only symlink, chmod, sleep, and fault-inject signal tests with #[cfg(unix)]; implement Win32 proc::alive via OpenProcess; open finish_ingest_file_opts writable on Windows before sync_all() and close the handle before rename; skip directory FlushFileBuffers in sync_blobs on non-Unix; drain Content-Length in serve_recording; and isolate the_scheme_cache_is_bounded_and_remembers_failures from the shared global SCHEMES map.
- contrib/windows/kiri-admin.ps1 & crates/kiri-win/src/storage.rs: diskpart /s reads script contents in the system OEM codepage (failing UTF-16LE/UTF-8 scripts and mangling non-OEM Unicode paths such as Japanese directory or file names to '?'). Alias non-OEM VHDX paths through a temporary ASCII NTFS hardlink first (immune to RedirectionGuard / ERROR_UNTRUSTED_MOUNT_POINT), falling back to an 8.3 short path or temporary NTFS directory junction for cross-volume paths, with deterministic cleanup on error.
- crates/kiri-win/src/setup.rs & crates/kiri/src/wsl.rs: strip a leading UTF-8 BOM (EF BB BF) before serde_json::from_slice in saved_from and distro_from_setup_json so BOM-prefixed setup.json files preserve done=true and distro.
- docs/fix-registry.md & tests/regressions.tsv: document fixes and add regression checks (verified with check-regressions.py and live on Windows 11).
2026-12-06 03:59:30 +01:00
Precious Okwu 48de26f454 Storage: implement host single-copy layer store and PackLayer integration (#1247)
Implement Storage Phase 3B.1-B (stacked on feat/storage-phase3b-pack-layer-proto)
to keep a single copy of each durably unpacked layer on the guest disk, reconcile
store state cleanly at VM boot, and reconstruct evicted blobs on demand via
PackLayer without waking a sleeping macOS VM on pull.

- crates/kiri-image: add Layer.diff_id and Layer.unpacked_bytes, atomic
  <root>/guest-store-id persistence, Store::check() retention for evicted
  unpacked layers, Store::mark_layers_unpacked, Store::evict_unpacked_blob
  respecting BLOB_LOCK/PINNED, and Store::reconcile_guest_layers(_report).
- crates/kiri-image/diffid.rs & compress.rs: resolve and verify evicted layers
  from Layer.diff_id and config JSON, and stream goflate gzip via
  outgoing_packed_gzip.
- crates/kiri-image/archive.rs & registry.rs: reconstruct evicted layers on save
  and push (HEAD 200 fast path and 404 repack), coherently rewrite outgoing
  config.rootfs.diff_ids without mutating the local store, and deduplicate
  shared evicted layers via LayerTee::has_unpacked during pull.
- crates/kiri: wire boot LayerInventory + store-id reconciliation before
  retain_layers in Engine::vm_inner with ordered untag/delete image events;
  seed durable_unpacked from boot LayerInventory and gate GuestUnpack,
  Engine::ensure_layers, restore_layers, and run::ensure_layers against
  uncommitted NO_SYNC .staging layers; defer eviction for macOS asleep pulls
  until first wake/unpack; report unpacked_bytes in docker system df when asleep;
  return 404 for evicted pulled blobs in mirror while repacking serve_tag local
  images; reconstruct evicted layers across kiri-forge buildports, scan/UI, and run.

Part of #1217.
2026-12-06 02:37:24 +01:00
Precious Okwu 5c6934524d Engine: fix Docker --filter parity on ps, networks, events, and search (#1246)
Align six Docker Engine API --filter behaviours with Docker 29.10.1:

- GET /containers/json: support before and since filters by resolving anchors via engine.resolve (404 when unknown) and walking the newest-first (created, id) container order without forcing all=true.
- GET /containers/json: add is-task boolean filter via Filters::bool (400 on invalid booleans; true matches none, false matches all).
- GET /containers/json: validate status against Docker's seven state words and parse exited values as i32 upfront (400 on invalid values).
- GET /networks: validate every type filter value is builtin or custom upfront (400 on bogus values).
- GET /events: match image against attrs["image"], image attrs["name"], Actor.ID, and tag-stripped familiar names; evaluate scope against ev["scope"] (local); and restrict daemon filters to daemon events by ID prefix or name.
- GET /images/search: validate filters upfront, evaluate is-automated via Filters::bool, and parse stars as u64 upfront (400 on non-integers).
2026-12-06 02:20:24 +01:00
Precious Okwu bc2b77dc29 Engine: support publish and expose filters on GET /containers/json (#1245)
Add Docker-compatible publish and expose container-list filters to GET /containers/json (crates/kiri/src/daemon/api.rs):

- Add PortFilter supporting <port>[/<proto>] and <start>-<end>[/<proto>] with default tcp and case-insensitive tcp, udp, and sctp protocols.
- Validate all publish and expose filter values upfront, returning HTTP 400 Bad Request for empty values, colons, port 0 or > 65535, reversed ranges, non-digit ports, and unsupported protocols.
- Match publish against active bound host ports (c.forwards.bound), matching ephemeral -p 0:80 and -P host ports while excluding stopped and --network host containers as verified against Docker Engine 29.10.1.
- Match expose against c.spec.exposed and c.spec.ports container ports across running and --all containers.
- Preserve OR semantics within a filter key and AND semantics across filter keys.
- Add unit tests in crates/kiri/src/daemon/api.rs and update docs/fix-registry.md and tests/regressions.tsv.
2026-12-06 02:05:24 +01:00
Precious Okwu 12bc9a5467 Storage: bump agent protocol to 15 with store-id, LayerInventory, and PACK_LAYER (#1244)
Foundational protocol and guest agent changes for single-copy layer storage (Phase 3B.1-A):

- Bump kiri-proto::PROTOCOL from 14 to 15, extend Hello with store_id, add LayerInventoryQuery / LayerInventory messages and copy_op::PACK_LAYER = 15, and honour explicit PAX subsecond mtime records in layertar.
- Persist atomic 128-bit <DATA>/.store-id from /dev/urandom in kiri-init and send it in Msg::Hello.
- Implement layers::inventory and Msg::LayerInventoryQuery handling in agent.rs scanning committed .done markers while ignoring .staging and temp leftovers.
- Implement symlink-confined chroot pack_layer_job in copy.rs for copy_op::PACK_LAYER streaming deterministic OCI tars preserving whiteouts, opaque dirs, hardlinks, nanosecond PAX mtimes, devices, FIFOs, symlinks, and security.*/user.* xattrs while stripping trusted.*.
- Parse and expose VmLink::store_id(), layer_inventory(), and pack_layer() on the host side, with unit and Linux root untar_in -> pack_layer -> untar_in round-trip tests.

Part of #1217
2026-12-06 01:49:39 +01:00
Precious Okwu 9bb2d148e6 Storage: bound layer-tars cache with LRU eviction and post-build cap (#1243)
Add lock-safe LRU eviction and a 1 GiB default cap for unpacked layer tars in `layer-tars/` (overridable via `KIRI_LAYER_TAR_CACHE_MB`, where `0` evicts all unpinned tars immediately).

Key changes:
- `kiri-image`: add `DEFAULT_LAYER_TAR_CAP_BYTES` (1 GiB), `Store::layer_tar_cap_bytes`, `Store::set_layer_tar_cap_bytes`, `Store::layer_tars_total_bytes`, and `Store::evict_layer_tars` holding `BLOB_LOCK` (respecting the #1240 lock order), skipping `PINNED` entries, sorting oldest-first by mtime, and deleting tars plus `tar_stamps` entries until unpinned bytes are within the cap.
- `kiri-image`: set mtime via a monotonic `CLOCK_REALTIME` floor (`touch_file_mtime`) on both newly unpacked tars and `Store::layer_tar()` cache hits so newly created tars never inherit a coarser kernel jiffy mtime older than a preceding hit (e.g. Linux ext4 `CONFIG_HZ=250`), while keeping `tar_stamps` valid.
- `kiri`: run `evict_layer_tars` in `Ports::drop` after releasing build pins and in `Engine::prune_blobs()` (covering `storage::reclaim()`, `rmi`, `image prune`, `builder prune`, and daemon start).
- Tests & docs: cover LRU ordering, zero-sleep 20-round hit-then-create ordering, `cap_bytes = 0`, concurrent pin safety, `Ports::drop` + `fetch_layer` transparent `diff_id`-verified regeneration, `prune_blobs`, and `reclaim`; update `docs/fix-registry.md` and `tests/regressions.tsv`.

Part of #1217
2026-12-06 01:36:45 +01:00
Precious Okwu c0c9d9ac6a Storage: enforce BuildKit GC limits, improve Storage UI visibility, and clean stale downloads (#1242)
Fixes #1217 across three areas without modifying existing Docker/Compose API
compatibility (preserving #1240's `engine.prune_blobs()` and #1241's
`prune_with_native` + `engine.mark_disk_dirty()` when `SpaceReclaimed > 0`):

1. BuildKit GC configuration, orphan volume pruning, and sleeping-VM sizing (#1217):
   - Cap `builder::disk_total()` against guest VM disk capacity (`vm_disk_gb() << 30`)
     on macOS rather than trusting uncapped host `statvfs`.
   - Parse `daemon.json` `builder.gc.defaultKeepStorage` in `daemon_json.rs` while
     preserving unrelated keys, and resolve `builder::cache_limit()` with precedence
     `KIRI_BUILD_CACHE_GB > builder.json cache_gb > daemon.json defaultKeepStorage > default`.
   - Emit `[worker.oci]` keys (`gc = true`, `reservedSpace`, `maxUsedSpace`,
     `minFreeSpace = "10%"`) in `builder::config_toml` instead of invalid keys, track
     `cache_limit` inside `Registries` for staleness detection, and trigger `refresh()`
     from `POST /kiri/builder` when `cache_limit` changes while no builds are active.
   - Skip `exec_capture` in `builder::cache()` when the builder container is paused so
     passive UI polls never unpause it.
   - Preserve `#1240`'s `engine.prune_blobs()` and `#1241`'s `prune_with_native` /
     `engine.mark_disk_dirty()` in `builder::prune()`, safely reclaim orphaned
     `buildx_buildkit_*_state` volumes under `ENSURE` when `find(engine).is_none()`
     and no build is active, mark the builder volume dirty after live `buildctl prune`,
     reuse `Engine::volume_sizes_snapshot` in `ops::system_df_with` only when `!wake` and
     the VM is asleep (leaving raw `/system/df` unchanged), and run `/build/prune?all=1`
     before `/containers/prune` and `/images/prune` via shared `ui/storage_prune.rs`.

2. Settings -> Storage and Builds UI visibility & reclaim banner:
   - Exclude `buildx_buildkit_*_state` from `Volumes` in `storageParts(s)`, compute
     BuildKit cache as `Math.max(buildkitDu, builderVolumeSize)` plus Forge cache rows
     so neither `0 B` nor double counting occurs, display cache size in `builderPref()`
     and `storagePruneRow()`, and enable Cleanup for Forge-only cache.
   - Add a dismissible "Reclaim {size}" banner when `reclaimable > 2 GiB`, `!moving`,
     and `!s.vhdx_sparse` (hidden when `s.vhdx_sparse === true`, shown when `false` or
     omitted), storing dismissal in `localStorage` keyed to dismissed bytes so 5 s
     refreshes never reopen it unless reclaimable increases or drops to `<= 2 GiB` first.

3. Startup and post-setup cleanup of stale update/setup downloads:
   - Add `update::clean_stale()` on macOS (`ui/mac.rs`) and Windows (`kiri-win/src/main.rs`)
     to reclaim non-newer staged apps/MSIs, `.part` downloads, and partial update
     remnants safely without touching `~/Downloads` or letting locked `.log` files block
     reclaiming old `.msi` installers.
   - Add `setup::clean_stale_downloads()` in `kiri-win` called at the end of
     `setup::finish()` after `done = true` is saved and on startup, never deleting
     `%LOCALAPPDATA%\Kiri\downloads` while `done == false`.
2026-12-06 01:24:57 +01:00
Precious Okwu d1bb373ac2 Storage: auto idle fstrim on macOS and Windows VHDX sparse guard and usage cache (#1241)
Implement Storage Phase 2 across macOS idle trimming, guest trim gating,
and Windows `ext4.vhdx` reclaim/reporting:

1. macOS automatic idle `fstrim` (`crates/kiri/src/daemon/engine.rs`,
   `storage.rs`, `vmlink.rs`, `builder.rs`):
   - Track `Engine::disk_dirty` set only when guest storage deletions occur
     (`remove()`, `--rm` auto-remove exit/fail cleanup, `prune_layers()`
     when retained/live layers drop > 0, `delete_volume_data()`, and
     `builder::prune` when `SpaceReclaimed > 0`), and claim/restore cleanly
     around manual `storage::reclaim()`.
   - Add `VmLink::trim_disk_timeout` (30 s bounded RPC) and invoke
     `storage::auto_reclaim_on_idle(&engine)` from `start_sleeper` right
     before `sleep_if_idle()` via `awake_link()` and shared `RECLAIMING`
     without `Engine::waking`, `hold_awake()`, or `touch()`, leaving
     `Engine::shutdown()` and `sleep_now()` untouched.

2. Guest `kiri-trim` gating (`crates/kiri-init/src/linux/trim.rs`):
   - Record `last_bfree` from `trim::stat(mountpoint)` before `FIRST_TRIM`
     and skip `FITRIM` on `FIRST_TRIM` and hourly `TRIM_INTERVAL` wakes
     unless `bfree` increased since the previous trim/baseline.

3. Windows `ext4.vhdx` safe sparse guard & usage cache
   (`crates/kiri-win/src/storage.rs`):
   - Remove the broken silent `wsl --manage --set-sparse true --allow-unsafe`
     call from `reclaim()`.
   - Detect NTFS `FILE_ATTRIBUTE_SPARSE_FILE` via Win32 `GetFileAttributesW`
     (`is_vhdx_sparse`), serialize `vhdx_sparse` in `storage::report()` when
     true (omitted when false), and run guest `fstrim` only (skipping
     offline `compact_vhdx`, WSL shutdown, and UAC) when `ext4.vhdx` is
     sparse.
   - Persist `(in_use, capacity)` atomically in `%LOCALAPPDATA%\Kiri\vhdx-usage`
     so stopped engines continue reporting `disk_host`, `disk_in_use`,
     `disk_limit`, and `reclaimable` accurately alongside `vhdx-overhead`.

Part of #1217. Follow-up to #1194.
2026-12-05 23:07:00 +01:00
Precious OkwuandAakif S 8395c5dfdb Storage: prune orphaned blobs and clean up failed pulls (#1216) (#1240)
Clean up newly downloaded blobs after failed registry pulls and add
safe host-store garbage collection for unreferenced `blobs/sha256/`
blobs, orphaned `layer-tars/`, and stale exited-writer temporary files.

Key changes:
- `kiri-image`: consolidate `Client::download_layers` failure cleanup so
  mirror, network, validation, and index write failures remove newly
  fetched unreferenced blobs, while preserving finished layers for retry
  on cancellation (dropping pins so later pruning can sweep them).
- `kiri-image`: add `Store::prune_unreferenced_blobs_with` and
  `Store::has_prune_candidates`, checking corrupt backup copies directly
  under the existing index lock to avoid re-entering `INDEX_LOCK`, and
  checking live pins + caller `still_needed` callbacks under `BLOB_LOCK`.
- `kiri` & `kiri-win`: add `Engine::prune_blobs` with container/pin
  guards, `kiri-forge` step-cache retention, `forge_epoch` build-handoff
  retry protection, failed `import` cleanup, and sibling wiring across
  `rmi`, `image prune`, `builder prune`, container removal, daemon boot,
  and `kiri storage reclaim` / Windows `Compact disk` (preserving #1139
  409 guidance on WSL2).

Fixes #1216

Co-authored-by: Aakif S <145636262+aakifsaf@users.noreply.github.com>
2026-12-05 22:10:05 +01:00
Precious Okwu 8023fea24f Windows: stop kiri engine start leaking pipe handles and self-heal setup.json NULs (#1234)
Fix two Windows defects found during the 0.3.1 verification pass:

1. `kiri.exe engine start` (and sibling `kiri.exe start`) previously launched
   `kiri-win.exe --background` via `std::process::Command::spawn()`, which
   passes `bInheritHandles = TRUE` without `PROC_THREAD_ATTRIBUTE_HANDLE_LIST`
   on Windows. Callers holding inheritable stdout/stderr pipes or redirected
   handles (PowerShell `2>&1`, `cmd.exe | findstr`, CI/process capture) hung
   waiting for EOF until `kiri-win.exe` exited. Spawn `kiri-win.exe` directly
   through `CreateProcessW` with `bInheritHandles = FALSE`, no inherited stdio
   handles, and `CREATE_NO_WINDOW | DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP`.
2. Align `crates/kiri/src/wsl.rs::distro()` with `clean_distro_name` to strip
   embedded UTF-16 NUL bytes and BOMs when reading `setup.json`, and make
   `crates/kiri-win/src/setup.rs::saved_from()` proactively self-heal legacy
   NUL-contaminated `setup.json` files atomically on disk while ignoring
   read-only or transient write errors.

Follow-up to #1182 and #1130.
2026-12-05 19:00:18 +01:00
Precious Okwu 8aa3ca4298 Linux & tests: fix window feature build, add CI check, and deflake ext4 layer check
Fix two Linux defects found against origin/main:

1. Build failure with `--features window` on Linux: `main()` in
   `crates/kiri/src/main.rs` moved `raw_args` when building `args` before
   `fontconfig::reexec_if_bypassed(&raw_args)` borrowed it under
   `#[cfg(all(target_os = "linux", feature = "window"))]`. Slice
   `raw_args.get(1..).unwrap_or(&[])` (matching `forge_args` above) so
   `raw_args` stays intact, and run `cargo check --locked -p kiri --features window --tests`
   in `.github/workflows/tests.yml`'s `unit` job so this stays guarded in CI.

2. Ext4 test flake in `daemon::buildports::tests::what_a_view_keeps_of_a_pulled_layer_goes_with_it_and_is_checked`:
   `std::fs::write` overwrote 6 bytes in place with the same length within Linux
   ext4's ~4 ms mtime tick, keeping an identical `(size, mtime_ns, ctime_ns, ino)`
   stat tuple so `Store::layer_tar` skipped re-hashing. Advance the tampered
   file's mtime explicitly by 60 s and assert `ports.unpacked == 1` so the test
   exercises digest verification and re-unpacking deterministically.
2026-12-05 18:36:33 +01:00
Precious Okwu adcfdc7938 Mac VM: add structured balloon diagnostics, status telemetry, and 6 GiB 15-container tests (#1229)
On Kiri 0.3.0 (before #1148 landed), a 6 GiB macOS VM with 15 always-on idle
containers, large virtual `Committed_AS`, ~3 GiB `MemAvailable`, ~2.1 GiB
`AnonPages`, and 0.00 PSI stayed pinned at the ceiling while nothing in
`daemon.log`, `/info`, `kiri engine status`, or `kiri diag report` explained
why the balloon held a given target. Live reproduction on `origin/main` confirms
that removing `committed_memory_need` in #1148 fixed the ceiling pin, deflating
15 idle Python containers to `U_live + H(C)` (~1.5 GiB headroom) without log
or status visibility.

This change adds:
- `BalloonReason` classification and change-driven, rate-limited `balloon target`
  logging (`>= 1 GiB` step or `>= 30 s` interval for shrink steps, immediate on
  reason transitions or growth, silent across steady idle ticks).
- Live `KiriMemoryAvailable`, `KiriMemoryBalloon`, `KiriMemoryCommitted`, and
  `KiriMemoryReason` fields on `/info`, surfaced in `kiri engine status`
  (`--json` and human output) and `kiri diag report` while the VM is awake.
- Regression coverage for the exact 6 GiB 15-container workload alongside #988
  and #1083 OOM-protection invariants (`PsiStall`, `DemandGrowth`,
  `DeflationLag`, `Cooldown`, `WsDecay`, `ActiveFloor`, `IdleFloor`,
  `MemoryMin`) and zero-spam logging.

Fixes #1210
2026-12-05 16:36:07 +01:00
Karthik Parameshwara 527b638173 UI: a container's Logs tab no longer restyles every line for each new one (#1218)
Drop `:has()` from `#content:has(> #dbody > :is(.term, .console)) > :not(#dbody)` so appending new container log lines no longer triggers a full 5,000-line style recalculation in WebView2/Chromium (228 ms -> 48 ms per batch, worst frame 293 ms -> 67 ms).

Fixes #1211
2026-12-05 12:24:04 +01:00
Precious Okwu 295af75c2a Windows: handle split pipe messages while stopped and send control requests in one write (#1223)
Format Windows control `POST` and `GET` requests (`post_over_stream` and `get_json_over_stream`) into one buffer before writing to Kiri's message-mode named pipe, and accumulate split pipe messages until `
` inside `kiri-win` `inspect_stopped_pipe` while stopped so `kiri start`, `kiri engine start`, and any third-party client wake Kiri reliably after window Stop.

Fixes #1205
Co-authored-by: Jerry <28186028+zy19940510@users.noreply.github.com>
2026-12-05 12:23:00 +01:00
Precious Okwuandqenjuquany d27fdf4592 Images: reject malformed repository separator sequences like my..app (#1222)
Reject malformed repository name separator sequences (such as `my..app`, `a._b`, `a___b`, and `a-.b`) in `kiri_image::reference::Reference::parse` to match Docker `distribution/reference` pathComponent rules.

Co-authored-by: qenjuquany <44889037+nmnhut0208@users.noreply.github.com>
2026-12-05 12:22:38 +01:00
Precious Okwuandqenjuquany b4555a5a05 Filters: refuse dangling=yes and other invalid boolean values (#1221)
Reject invalid boolean filter values (such as `dangling=yes`, `dangling=ture`, or mixed `["true", "yes"]`) with HTTP 400 matching Docker Engine instead of silently coercing them to `false` and pruning every unused tagged image.

Co-authored-by: qenjuquany <44889037+nmnhut0208@users.noreply.github.com>
2026-12-05 12:22:13 +01:00
Precious OkwuandJiarui Fan ba8aa754fc Daemon: let docker update clear a container's PID limit (#1219)
Allow `docker update --pids-limit=-1` (and `0`) to clear an existing container PID limit (writing `max` to `pids.max` and reporting `0` in `docker inspect`, matching Docker Engine 29), while keeping `null`/omitted unchanged and preserving backwards compatibility with persisted `containers.json`.

Refs #129
Co-authored-by: Jiarui Fan <221531987+zhiwuyazhe-fjr@users.noreply.github.com>
2026-12-05 12:20:28 +01:00
Precious OkwuandAngus 盧業達 159e31108e macOS: Quit no longer waits 35 s for an engine the window started (#1220)
When Kiri's macOS window starts the daemon directly (`spawn_daemon`), dropping the `Child` handle without reaping leaves the exited daemon as a zombie so `kill(pid, 0)` keeps returning `0`, stalling Quit and engine restart for 35 s.

Reap a direct child with `waitpid(pid, null, WNOHANG)` inside `stop_engine` before checking `kill(pid, 0)` so window-started daemons count as stopped immediately once they exit.

Fixes #1201
Co-authored-by: Angus 盧業達 <33803435+AngusLu@users.noreply.github.com>
2026-12-05 12:02:46 +01:00
Precious OkwuandAakif S 0a36befdd8 Builds: show live progress and history for kiri-forge builds (#1212)
Track active and completed kiri-forge builds in the daemon (`GET /kiri/builds`, `GET /kiri/builds/<id>`, `GET /kiri/builds/<id>/layers`, `DELETE /kiri/builds/<id>`) and merge them into the Builds view alongside BuildKit builds across macOS, Linux, and Windows.

Includes hardening from diff audit: store the history summary index at `_index.json` (eliminating `GET`/`DELETE /kiri/builds/index` collisions), enforce `0o700` history directory permissions on Unix, bound per-build total logs (`4 MiB`), steps (`1024`), and warnings (`256`), emit `"source": "buildx"` in BuildKit detail/layers responses so UI layer caching works cleanly, and evict deleted entries from list caches.

Fixes #1162
Co-authored-by: Aakif S <145636262+aakifsaf@users.noreply.github.com>
2026-12-05 03:55:57 +01:00
Precious Okwu 16c44b936b Windows: elevate offline ext4.vhdx compaction via UAC and wait for vmwp.exe lock release (#1199)
Run offline VHDX compaction through SHA-256-verified kiri-admin.ps1 -CompactVhdx (via ShellExecuteExW runas when un-elevated, or directly with CREATE_NO_WINDOW when already holding an enabled Administrator token) so Windows 11 desktop users and Windows 11 Home diskpart.exe fallbacks prompt for UAC approval instead of failing with ERROR_ELEVATION_REQUIRED (os error 740).

Poll for exclusive read-write VHDX access after wsl --terminate and escalate to wsl --shutdown if vmwp.exe or sibling WSL 2 distros still hold ext4.vhdx open, encode diskpart scripts in the system OEM code page, detach on mid-script errors, and surface clean UTF-8 diagnostics and UAC cancellation (1223) messages while restoring the engine and running containers.

Fixes #1194
2026-12-04 02:48:24 +01:00
Precious Okwu 97b355d169 Network & registries: add SOCKS5 proxy support and Docker Hub TLS reset guidance (#1198)
Discover system SOCKS5 proxies across macOS (scutil SOCKSEnable/SOCKSProxy/SOCKSPort as socks5h://), Windows Internet Settings (socks= as socks5h:// with WSL loopback port relay), and Linux/WSL environment variables (ALL_PROXY / all_proxy alongside socks5:// and socks5h://).

Implement pure safe-Rust RFC 1928 and RFC 1929 SOCKS5 CONNECT tunnelling in kiri-image with remote hostname resolution (ATYP = 0x03) and NO_PROXY bypass, shared across registry pulls/pushes/logins, build HTTP fetches, and CLI/Forge/update downloads without external dependencies.

Surface actionable Settings -> Registries (registry-mirrors) and Settings -> Network (HTTP/SOCKS5 proxy and un-evaluated PAC) guidance when Docker Hub connections fail during TLS handshakes or timeouts.
2026-12-04 02:46:31 +01:00
Precious OkwuandMateus Anacleto 05595908f0 UI: preserve per-container Terminal command history across page visits (#1197)
`openDetail()` previously created a fresh `term: { history: [], at: -1 }` object on every visit and left `#term-in` un-cleared on the shared `termEl` element, so navigating away from a Compose service or standalone container page and reopening its Terminal tab lost all earlier commands for `ArrowUp` and `ArrowDown`.

Keep each container's Terminal command history in a window-scoped `termHistories` `Map` keyed by container ID, initialising `at` to `history.length` and clearing `#term-in` when opening a container detail page, resetting `at` on `clear`, capping each container's history at `TERM_HISTORY_MAX` (`200`), and pruning removed container IDs on authoritative `"lists"` updates while keeping any open `ui.detail?.id`.

Fixes #1175
Co-authored-by: Mateus Anacleto <103789783+imateusdev@users.noreply.github.com>
2026-12-04 02:45:12 +01:00
Precious Okwu 7166fc34ea macOS: attribute dev.kiri.docker-socket LaunchDaemon to Kiri via signed helper (#1196)
`/Library/LaunchDaemons/dev.kiri.docker-socket.plist` previously invoked
`/bin/sh -c` without `AssociatedBundleIdentifiers`, causing macOS
`backgroundtaskmanagementd` to display the job as `sh` under `Unknown Developer`
in System Settings -> General -> Login Items & Extensions.

macOS `BackgroundTaskManagement` resolves `AssociatedBundleIdentifiers` on a
legacy LaunchDaemon only when its `Program` binary carries a valid code
signature whose `TeamIdentifier` matches the associated app bundle's
`TeamIdentifier` (ignoring unsigned scripts and ad-hoc re-signed copies), while
pointing a root LaunchDaemon directly at `/Applications/Kiri.app` would execute
from a potentially user-writable bundle.

Ship a tiny standalone `kiri-docker-socket` Mach-O binary in
`Contents/Resources/bin/kiri-docker-socket` (in both `Kiri.app` and
`Kiri Lite.app`), signed standalone (`Info.plist=not bound`, `Sealed
Resources=none`, `--identifier dev.kiri.docker-socket`) with Kiri's signing
identity so copying it to `/Library/PrivilegedHelperTools/dev.kiri.docker-socket`
(`root:wheel`, `0755`) preserves its embedded `TeamIdentifier`. Verify both
SHA-256 and `codesign --verify --strict` (including the `TeamIdentifier` and
`dev.kiri.docker-socket` identifier requirement when Kiri is Developer ID
signed) on the root-owned `.new` staging copy before moving it into place, set
`AssociatedBundleIdentifiers` = `["dev.kiri.app"]` in the plist, migrate legacy
plists on explicit setup actions or piggybacked administrator prompts without
touching another engine's `/var/run/docker.sock`, and remove both the helper
and plist during `kiri setup --uninstall`.

Fixes #1168
2026-12-04 02:42:26 +01:00
Precious Okwu 308f372e67 Linux: enforce SELinux container_t + MCS confinement, :z/:Z relabelling, and --security-opt label=... (#1190)
* Linux: enforce SELinux container_t + MCS confinement, :z/:Z relabelling, and --security-opt label=...

On Linux hosts with SELinux active (`/sys/fs/selinux` `SELINUX_MAGIC`) and `container-selinux` installed (`/etc/selinux/<type>/contexts/lxc_contexts`), confine containers and `docker exec` processes under `container_t` with a unique reference-counted MCS category pair (`s0:cX,cY`), label container overlayfs roots, `/dev`, `/dev/pts`, `/dev/shm`, masked `tmpfs` directories, and `--tmpfs` mounts via `context="<mount_label>"`, label `/etc/{hosts,resolv.conf,hostname}`, shared `IpcMode::Shareable` shm, and local volumes with `container_file_t:s0`, and transition threads via `/proc/thread-self/attr/selinux/exec` (`current` for `--init` PID 1) after verifying `PROC_SUPER_MAGIC`.

Support `--security-opt label=disable|user:...|role:...|type:...|level:...|filetype:...` (`label=` and `label:`) with strict character validation preventing `context="..."` mount-option injection, persist `process_label` and `mount_label` on `Spec` for `GET /containers/{id}/json` (`ProcessLabel`, `MountLabel`) and restarts, expose `name=selinux` in `GET /info` `SecurityOptions`, support `:z` and `:Z` bind-mount relabelling via an iterative non-symlink-following `relabel_tree` with top-level system path guards while rejecting `:z,Z`, degrade cleanly when SELinux or `container-selinux` is absent, and add `Recommends: container-selinux` to `packaging/linux/rpm/kiri.spec`.

* Linux: gate SELinux relabel path guards on active confinement

Match Docker 29 and opencontainers/selinux semantics so :z and :Z remain a non-breaking no-op on non-SELinux hosts (macOS, Windows/WSL 2, Ubuntu, Debian) and when MountLabel is empty (--privileged or --security-opt label=disable), while enforcing excludePaths (including /etc/passwd, /etc/pki, /etc/shadow, /media, /srv, /var/log) and bottom-up directory relabelling whenever SELinux confinement is active.
2026-12-03 19:26:24 +01:00
Precious Okwu 750bd8a7de Packaging: recommend GTK 3 and WebKitGTK 4.1 in Linux packages and guide kiri ui when absent (#1189)
Move GTK 3 and WebKitGTK 4.1 from hard Requires/Depends to Recommends in the full Linux .rpm and .deb packages while keeping the libc6 glibc floor check on the .deb. Desktop dnf (Fedora, openSUSE) and apt installs still pull the window libraries automatically, while RHEL, Rocky Linux and AlmaLinux (where webkit2gtk4.1 lives in EPEL) and headless servers (--no-install-recommends or install_weak_deps=False) install the static engine and bundled Docker CLI cleanly.

Before execing /usr/lib/kiri/kiri-window on Linux, kiri ui now probes dynamic library resolution via LD_TRACE_LOADED_OBJECTS=1 and reports an actionable package install message instead of a raw ld.so failure when GTK 3 or WebKitGTK 4.1 is missing.

Fixes #260
2026-12-03 18:46:42 +01:00
Precious Okwu 3d2fe2a458 Windows: launch kiri-win.exe --background and wait for \\.\pipe\kiri on kiri engine start (#1184)
Fixes #1182. When `kiri-win.exe` was not running, `kiri engine start` and `kiri start` on Windows previously ran a one-shot `wsl.exe ... kiri engine start` and returned `Ok(())`, leaving `\\.\pipe\kiri` absent and allowing WSL to auto-terminate the engine distro seconds later.

Launch `kiri-win.exe --background` headlessly (tray-only, without opening Kiri's window) after clearing the stopped marker and poll `POST /kiri/wake` over the named pipe until both `\\.\pipe\kiri` and the WSL daemon are live, returning a clear error if setup is missing or `kiri-win.exe` exits early.
2026-12-03 14:04:14 +01:00
Precious Okwu 7a47bf6d98 Build SSH & tests: accept explicit-parameter PKCS#8 EC keys and isolate parallel unit tests (#1183)
macOS `/usr/bin/openssl` (LibreSSL) writes explicit RFC 3279 NIST prime-field parameters in `openssl genpkey -algorithm EC` PKCS#8 keys, which `ring` rejected with `x509: unsupported private key type` during `kiri build --ssh`. Parse verified NIST P-256 and P-384 `SpecifiedECDomain` parameters (and redundant matching inner `[0]` curve tags) in `sshfwd` while rejecting tampered or mismatched domain parameters.

Also isolate parallel multi-threaded unit tests across macOS, Linux, and Windows/WSL 2: give `ui::compose::tests::tdir` a monotonic sequence suffix, close inherited descriptors in `relay.rs` fork tests and bound-wait on abstract socket release in `net.rs`, retry transient `ETXTBSY` when spawning freshly written CLI shims in `tools.rs`, ignore non-AppArmor kernel cache notices in `apparmor::tests`, and allow 256 MiB process-wide commit headroom for parallel 32-core `kiri-win` runners.
2026-12-03 13:44:41 +01:00
Jiarui FanandJiarui Fan 920112f711 WSL: resolve Windows Compose drive paths for bind mounts (#1165)
Fixes #417. With `COMPOSE_CONVERT_WINDOWS_PATHS=1`, Windows Docker Compose converts drive paths (`I:\project\www`) to MSYS-style `/i/project/www` while connecting over the host pipe with no WSL caller distro, so relative project binds and local `o=bind` volumes previously resolved inside the WSL engine distro and appeared empty.

Detect native Windows Compose callers from the Compose project path labels (`working_dir`, `config_files`, `environment_file`) while excluding `\\wsl.localhost\<distro>\...` UNC projects, and resolve `/<drive>/...` bind and local `o=bind` volume sources against the WSL Windows drive root.

Co-authored-by: Jiarui Fan <221531987+zhiwuyazhe-fjr@users.noreply.github.com>
2026-12-03 13:01:22 +01:00
DerVips b0b87676d6 WSL & Linux: autoload kvm_intel or kvm_amd when /dev/kvm is missing (#1163)
WSL 2 ships x86 KVM as loadable `kvm_intel` and `kvm_amd` modules, and distros without `udev` (including `kiri-linux`) never load the CPU driver automatically, leaving `/dev/kvm` absent for nested virtualisation and `--device /dev/kvm` containers.

Autoload `kvm_intel` or `kvm_amd` from `/proc/cpuinfo` `flags` in `kiri-start` on startup and in `kiri-init` `resolve_devices` when `--device /dev/kvm` is requested while `/dev/kvm` is not yet present.

Co-authored-by: DerVips <83834868+DerVips@users.noreply.github.com>
2026-12-03 12:56:10 +01:00
Jiarui FanandJiarui Fan ffa5294ab5 Registry: keep the push scope when a blob HEAD challenges for pull (#1164)
Fixes #1159. A push first checks whether each blob exists with `HEAD`. When that challenge asks only for `pull`, merge comma-separated actions per repository resource with the requested `push` scope into a single `scope=` parameter so token servers do not issue a read-only token for the upload.

Co-authored-by: Jiarui Fan <221531987+zhiwuyazhe-fjr@users.noreply.github.com>
2026-12-03 12:50:21 +01:00
Precious Okwu 0f5b0dcef9 Guest & daemon: fix pre-start command checks, paused exec wait, i386 vsock, and .trash ENOSPC (#1180)
- Evaluate target-user execute and directory-search permissions (including POSIX mode bits, supplementary groups, and CAP_DAC_OVERRIDE / CAP_DAC_READ_SEARCH) and slash-path commands before root_ready in container_child and finish_child so missing or non-executable commands fail start with HTTP 400 while preserving Status::Created, and detached exec refusals return HTTP 400 while attached execs stream the refusal once (#1122, #1131 follow-up).
- Bound the post-wait_for_start paused-container wait in Engine::exec_start to 2 s and return HTTP 409 Conflict cleanly if the container stays paused (#1131 follow-up).
- Answer 32-bit i386 socketcall(SYS_SOCKET) (nr 102, arg0 1) with ENOSYS in seccomp::program and seccomp::boundary on x86-64 so raw int 0x80 calls cannot hide AF_VSOCK in userspace memory past deny_vsock (#1147 follow-up).
- Drain pending .trash/reap-* entries synchronously when free disk space is below 2 GiB (or 4x compressed layer size) and retry on ENOSPC in layer and upper-layer unpackers (#1129 follow-up).
2026-12-03 12:30:49 +01:00
Precious Okwu 547d88e6a6 Windows & WSL: refresh stale host IPs, guard Hub::retire_if and EOF, and add Desktop fallback (#1177)
- Mark win-host-ips.json loaded at WSL startup as unverified (from_windows: false, updated_at: None), separate is_wsl_mirrored_host_ip (10 s TTL, zero ipconfig.exe spawns on wildcard -p 8080:80) from explicit -p <host_ip>:... re-probing under IPCONFIG_PROBE_LOCK, replace stale cached addresses on re-probe rather than appending via .extend(), and remove the 2 s sync skip in kiri-win before_container_op (#1109 follow-up).
- Guard Hub::retire with Arc::ptr_eq (retire_if) so trailing EMFILE close frames from an already-replaced bridge never retire the newly spawned bridge, and guarantee semantic client half-close EOF delivery even when CTL_QUEUE is full (#1149 follow-up).
- Fall back from FOLDERID_Desktop to %USERPROFILE%\Desktop, %USERPROFILE%, and temp_dir() when saving Windows diagnostic reports (#1119 follow-up).
2026-12-03 12:15:17 +01:00
Precious Okwu 5746fe49ae Daemon: validate CPU limits, guard update state, and reject UTS host hostname (#1178)
- Validate CpuPeriod (0 or 1_000..=1_000_000), CpuQuota (0, -1, or >= 1_000), and NanoCpus (0 or >= 10_000_000) in limits_from before creating or updating a container so sub-0.01 NanoCpus never truncates to 0 (unlimited) and out-of-range CFS values fail with Docker 29's HTTP 400 errors instead of guest cgroup EINVAL (#1120 follow-up).
- Track nano_cpus separately on Limits (#[serde(default)] for backwards-compatible 0.3.0 containers.json deserialisation) so container inspect matches Docker 29, conflicting NanoCpus and CpuQuota/CpuPeriod options return HTTP 400/409, and docker update --cpu-quota=-1 clears throttling on both --cpu-quota and --cpus containers.
- Apply live guest cgroup updates in Engine::update before mutating c.spec.limits or saving containers.json so a failed guest update never corrupts in-memory or persisted container state.
- Reject explicit Hostname or Domainname combined with UTSMode="host" in POST /containers/create with Docker 29's HTTP 400 conflict error while stripping source-populated Config.Hostname/Domainname for UTSMode="host" containers in kiri import (#1092 follow-up).
2026-12-03 11:59:47 +01:00
Precious Okwu 06a514de0a Builder & guest: restore Forge step hostnames and proxy env, raise netlink SO_SNDBUF, and fall back when nft_masq is missing (#1179)
Fixes #1155
Fixes #1158

- Populate built-in host.docker.internal, host.kiri.internal, and gateway.docker.internal /etc/hosts entries and merge container proxy environment variables (Settings -> Network -> Pass to containers) in Engine::step_run without overriding or shadowing proxy variables already present in image ENV, Dockerfile ENV, or --build-arg, and include mapped spec.net.extra_hosts for run_flags::STEP steps in kiri-init's write_etc_files.
- Enlarge SO_SNDBUFFORCE / SO_SNDBUF to 8 MiB in Netlink::open, retry EINTR and drain unread trailing ACKs on Netlink::request error exits, and roll EGRESS_ROUTES back when refresh_nat() fails in set_egress_routes so large VPN / Cloudflare WARP route batches (>= 325 IPv4 CIDRs) neither fail with EMSGSIZE nor prevent kiri0 from coming up.
- Attempt a one-shot best-effort modprobe -q nft_masq in init_net when install_nat sees ENOENT on Linux, and if nft_masq remains unavailable (such as in managed Ubuntu sandboxes), fall back to installing Kiri's bridge isolation and DNAT chains without in-table masq rules while syncing idempotent iptables -t nat POSTROUTING masquerade rules when iptables is present and cleaning them up on stop.
2026-12-03 11:52:24 +01:00
Precious Okwu 90a202231b Setup, services & DNS: harden CLI plugin stamps, LaunchAgent and WSL toggles, and DoH NXDOMAIN (#1176)
- Recognise cross-volume Copy-Item CLI plugin copies via byte-size and SHA-256 content equality when no file-ID hardlink or .kiri-cli-plugins.json stamp matches, stamp managed plugins from setup-tools.ps1 and kiri.ps1, re-heal ~/.docker/cli-plugins live in kiri-win when Docker Desktop is installed or uninstalled, and include /opt/homebrew/lib/docker/cli-plugins and NixOS plugin paths in setup.rs SYSTEM_PLUGIN_DIRS (#1150, #1054 follow-up).
- Guard macOS set_start_at_login when brew services is active so Kiri never falls through to writing a duplicate dev.kiri.daemon.plist when homebrew.mxcl.kiri.plist is absent or lacks RunAtLoad (#1134 follow-up).
- Persist /etc/kiri/no-docker-sock when WSL socket integration is disabled on a user engine distro and honour it in kiri.service ExecStartPost and daemon::maybe_link_docker_sock across restarts (#1131 follow-up).
- Pass kDNSServiceFlagsReturnIntermediates to DNSServiceGetAddrInfo, skip unusable IPv6 lookups on IPv4-only Macs, and distinguish clean NoSuchRecord results from lookup failures so DoH/DoT Supplemental domains with no UDP servers return NXDOMAIN (or NODATA when the sibling address family exists) instead of SERVFAIL (#1145 follow-up).
2026-12-03 11:52:16 +01:00
Precious Okwu 41d67d03d9 Builder: wake paced /grpc writes on stream reset and client disconnect (#1174)
Track client-open and peer-ended streams plus GOAWAY bounds in GrpcShared so write_server_data_paced wakes immediately and stops sending DATA frames when buildkitd terminates a stream early via RST_STREAM, HEADERS+END_STREAM, DATA+END_STREAM, or GOAWAY, without resurrecting a 65,535 stream window or writing onto already-reset streams when a sibling stream receives WINDOW_UPDATE.

Commit absorb_conn_window increments per sent chunk rather than upfront so mid-stream resets never over-absorb unsent client connection flow-control credit, and poll the client Unix socket across 200 ms condvar wait slices in both POST /grpc and POST /session so Ctrl-C disconnects while backend HTTP/2 flow-control windows are zero tear down buildctl dial-stdio promptly.

Follow-up to #1153 (#1082).
2026-12-03 11:52:08 +01:00
Precious Okwu f3dd7968f6 Linux: allow build image mirror through INPUT drop firewalls and track settled bridge gateways (#1154)
Allow TCP connections to Kiri's IPv4 build image mirror (`tcp --dport <mirror_port>` scoped to `-i kiri+`) alongside DNS (UDP/TCP 53) when the Linux host's `INPUT` chain drops incoming traffic (`ufw`, `iptables`, or `nf_tables`), reserve `mirror-port` before `kiri-init` starts, and bind settled bridge gateways via `IP_FREEBIND` while marking stale `buildkitd.toml` mirror endpoints when `kiri0` moves off its initial subnet.

Fixes #1069
2026-12-02 12:44:28 +01:00
Precious Okwu 28e69b152c Windows bridge: close half-closed Unix sockets, raise RLIMIT_NOFILE, and recover across engine restart (#1149)
When a Windows named-pipe client half-closed its write side (`WriteFile` of 0 bytes, used by `go-winio` `CloseWrite` on `exec`, `attach`, and `run` streams) and the daemon finished its reply cleanly (`end == EOF && replies_ended`), `serve_shared` in `kiri-win` skipped sending `CLOSE` to `kiri bridge`, while `kiri bridge` kept `Conn` in its map on `EOF`, left `kiri-bridge-w` parked on `rx`, and exited `replies` without removing `conns[id]`, leaking one `UnixStream` and one writer thread per half-closed call until hitting WSL's 10,240 soft `RLIMIT_NOFILE` ceiling (`os error 24`).

- Always send `CLOSE` from `serve_shared` when removing an open connection from `bridge.conns`, and add two-half `EOF` socket/thread cleanup plus a `CloseAll` drop guard in `kiri bridge`.
- Call `raise_open_files()` on startup in `kiri bridge` and `kiri host-relay`.
- Classify bridge `EMFILE`/`ENFILE` (`os error 24`) as `"Kiri's WSL bridge failed: ..."` instead of `"Kiri's engine did not start: ..."` and retire an exhausted bridge automatically.
- Allow `kiri engine stop` / `kiri engine restart` to fall through past a failed bridge pipe and version external stop requests so an async stop cannot race `/kiri/wake`.

Fixes #1049
2026-12-02 12:44:16 +01:00
Precious Okwu fc3452728e Builder: raise /grpc concurrent Solve stream cap and pace rewritten SolveRequest HTTP/2 flow control (#1153)
Raise `MAX_CONCURRENT_SOLVE_STREAMS` in `POST /grpc` from 16 to 512 and pace rewritten multi-frame `SolveRequest` `DATA` writes against RFC 9113 HTTP/2 connection and stream flow-control windows (including pre-credited `WINDOW_UPDATE` increments) so `docker compose build` with 17 or more services no longer fails with `Unavailable: the connection is draining`.

Fixes #1082
2026-12-02 12:31:31 +01:00
Dery Ferdika 89b79f9023 Protocol: drop undecodable frames of every kind the host gets no reply for (#1106)
List all 17 fire-and-forget host-to-guest frame kinds in `kiri_proto::takes_no_reply` (`Shutdown`, `Kill`, `Remove`, `Unpublish`, `SetTime`, `Input`, `CloseStdin`, `Resize`, `Retain`, `UsageQuery`, `RemoveVolume`, `RemoveBridge`, `RetainLayers`, `FsEvents`, `CancelStart`, `DnsRename`, and `SetEgressRoutes`) so a truncated or undecodable fire-and-forget frame is dropped without emitting a spurious `Error` reply that shifts host/guest RPC lockstep.

Refs #948

Co-authored-by: Dery Ferdika <114888155+DeryFerd@users.noreply.github.com>
2026-12-02 12:24:56 +01:00
Precious Okwu b02f5bb17d Seccomp: dispatch AUDIT_ARCH_I386 to i386 syscall rules on x86-64 (#1147)
Dispatch `AUDIT_ARCH_I386` syscalls on x86-64 Linux and WSL 2 to 1-to-1 i386-numbered rule sets in `program(caps)` and `boundary()` while keeping native `AUDIT_ARCH_X86_64` unchanged and x32 refused, so 32-bit `linux/386` binaries no longer fail `mmap2` with `EPERM` (`SIGSEGV`).

Fixes #1015
2026-12-02 12:23:16 +01:00
takealook97andtakealook97 29a03525ad Report that WSL disk reclaim needs the Windows storage window (#1142)
When `kiri storage reclaim` runs in WSL, return HTTP 409 Conflict with instructions to open Kiri's Windows window and choose Settings -> Storage -> Compact disk instead of reporting native Linux success without compacting the Windows VHDX. Native Linux keeps its existing response.

Fixes #1139

Co-authored-by: takealook97 <118447769+takealook97@users.noreply.github.com>
2026-12-02 12:23:05 +01:00
Precious Okwu bf03db99cf Windows setup: keep other engines' CLI plugins instead of overriding via cliPluginsExtraDirs (#1150)
- Remove Kiri's cli-plugins paths from cliPluginsExtraDirs in ~/.docker/config.json while preserving non-Kiri entries and leaving clean files untouched.
- Populate ~/.docker/cli-plugins/docker-{compose,buildx}.exe only when no non-Kiri plugin exists in ~/.docker/cli-plugins, cliPluginsExtraDirs, %ProgramData%\Docker\cli-plugins, or %ProgramFiles%\Docker\cli-plugins, tracking Kiri-installed copies via NTFS file IDs and metadata stamps for clean coexistence and uninstall (#1054 parity on Windows).

Fixes #1138
2026-12-02 12:11:43 +01:00
takealook97andtakealook97 ac90e9801d Daemon: hold VM awake across container create and streaming guest operations (#1141)
- Hold AwakeHold across Engine::create layer preparation and guest creation so the idle sleeper cannot stop the VM while unpacking large images (#1140).
- Extend AwakeHold across CopyStream (archive_get, archive_put, upper_put, export, commit, changes), GuestUnpack (pull layer tee), trim_disk, prune_layers, start_inner, system_df, volume_sizes, and guest build helpers until streams close or drop.

Fixes #1140

Co-authored-by: takealook97 <118447769+takealook97@users.noreply.github.com>
2026-12-02 12:07:21 +01:00
Jiarui FanandJiarui Fan dcc7d32a31 Daemon: honour docker update --cpu-quota=-1 and standalone CpuPeriod updates (#1120)
- Store signed CpuQuota in Limits so docker run/update --cpu-quota=-1 clears CPU throttling in cgroup cpu.max and persists across restarts while translating negative quotas to 0 on the guest wire (#129).
- Preserve standalone CpuPeriod updates in limits_from and backwards-compatible deserialisation of existing unsigned Limits JSON.

Co-authored-by: Jiarui Fan <221531987+zhiwuyazhe-fjr@users.noreply.github.com>
2026-12-02 11:58:22 +01:00
Dery Ferdika ed92c61183 Security: open advisory links with the platform opener and restore Linux user env (#1108)
- Use /usr/bin/open on macOS and xdg-open elsewhere when opening allow-listed CVE advisory URLs from the Security tab.
- Restore the user's real XDG_CACHE_HOME via fontconfig::restore_user_env on Linux so browsers launched from kiri-window under fontconfig isolation do not inherit a quarantined cache path.

Co-authored-by: Dery Ferdika <114888155+DeryFerd@users.noreply.github.com>
2026-12-02 11:58:13 +01:00
Precious Okwu 51d40abae2 Mac VM: deflate KiriMemoryTarget to live usage plus headroom (#1148)
- Stop stacking unfaulted Committed_AS above U_live + headroom in next_memory_target so multi-service stacks with sparse virtual reservations deflate back to live usage plus proportional headroom after startup bursts settle while preserving >= 2 GiB MemAvailable on >= 8 GiB VMs.
- Clamp BalloonState::ws_peak to ceiling - headroom while refreshing hold_until near the ceiling so deflation begins promptly once SHRINK_COOLDOWN elapses.

Fixes #1083
2026-12-02 11:50:23 +01:00