Skip to content

Restore fresh runtime setup and resident outcomes - #52

Merged
gitcommit90 merged 1 commit into
mainfrom
fix/fresh-runtime-and-resident-outcomes
Aug 1, 2026
Merged

Restore fresh runtime setup and resident outcomes#52
gitcommit90 merged 1 commit into
mainfrom
fix/fresh-runtime-and-resident-outcomes

Conversation

@gitcommit90

@gitcommit90 gitcommit90 commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Outcome

  • preserve Windows elevated restart_required state before signed-in WSL probing
  • restore resident socket, DNS, and TCP egress on nested Linux hosts
  • make essential resident outcome/blocker/escalation playbooks active every turn
  • bump synchronized candidate version to 0.0.35

Verification

  • npm run typecheck
  • npm run build
  • npm run test:onboarding-browser (20/20)
  • npm test (zero failures; two browser checks skipped because local Chrome is absent)
  • npm run test:native (127/127)
  • git diff --check
  • native Windows test/windows-wsl-status.ps1
  • real Linux new- and retained-resident socket/DNS/TCP acceptance

Summary by CodeRabbit

  • Bug Fixes

    • Improved Windows setup status handling for restarts, cancellations, and failures.
    • Improved nested Linux networking, DNS behavior, connectivity checks, and container readiness validation.
    • Added safer AppArmor handling during installation, updates, rollback, and uninstall.
    • Resident operations now escalate machine-wide network failures with supporting evidence instead of suggesting manual troubleshooting.
  • Release

    • Updated the default channel machine image and package version to 0.0.35.

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Release 0.0.35 updates Windows setup status handling, nested OCI networking and readiness checks, crun AppArmor management, resident-agent escalation behavior, and channel-machine version references.

Changes

Runtime and Setup Release

Layer / File(s) Summary
Release version alignment
CHANGELOG.md, README.md, package.json, src/server/channel-computers.ts, src/server/db.ts, test/channel-computers.mjs
Release metadata, package versioning, image defaults, and tests now reference 0.0.35.
Windows setup status normalization
scripts/install-wsl-runtime.ps1, src/server/channel-computers.ts, test/desktop.mjs, test/windows-wsl-status.ps1
Shared status records now preserve restart and failure outcomes while setup polling and exit-code handling normalize terminal results.
OCI network and readiness handling
scripts/1helm-oci-runtime, test/site.mjs
Managed networks disable unavailable DNS services. Container startup validates identities, storage, DNS, TCP egress, and readiness markers.
Nested crun AppArmor management
site/public/install-oci-runtime.sh, site/public/install.sh, site/public/apply-linux-release.sh, site/public/update-host.sh, site/public/uninstall-host.sh, test/site.mjs
Nested installation manages the crun AppArmor policy. Host transactions preserve it, and uninstall removes only the exact managed fragment.
Resident playbook execution and escalation
src/server/skills.ts, src/server/bots.ts, test/autonomy-platform.mjs, test/mock-openai.mjs, test/native-world.mjs
Resident agents receive essential operating playbooks and escalate persistent machine-wide network failures with evidence instead of returning troubleshooting tutorials.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description includes outcomes and verification, but it omits the required change type, release notes, and numbered acceptance ledger. Add the required Summary, Type of change, Release notes, and numbered acceptance ledger sections, with evidence for each requested item.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the primary runtime setup and resident outcome changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/fresh-runtime-and-resident-outcomes

Comment @coderabbitai help to get the list of available commands.

@gitcommit90
gitcommit90 merged commit cc8624b into main Aug 1, 2026
5 of 6 checks passed
@gitcommit90
gitcommit90 deleted the fix/fresh-runtime-and-resident-outcomes branch August 1, 2026 22:18

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
test/windows-wsl-status.ps1 (1)

1-42: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Execute test/windows-wsl-status.ps1 in CI.

npm test only checks this file as text through test/desktop.mjs; .github/workflows/ci.yml has no PowerShell invocation. The throw assertions do not run automatically.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/windows-wsl-status.ps1` around lines 1 - 42, Add an explicit CI step in
the existing workflow to execute test/windows-wsl-status.ps1 with PowerShell on
a compatible Windows runner. Ensure the step runs as part of the normal test job
or workflow so its throw-based assertions execute, while preserving the existing
desktop.mjs text-check behavior.
🧹 Nitpick comments (1)
test/autonomy-platform.mjs (1)

151-154: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert all three mandatory playbooks.

Line 151 verifies only outcome-ownership. Add assertions for non-empty blocker-resolution and skipper-escalation playbooks. A regression that removes either required playbook currently passes this test.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/autonomy-platform.mjs` around lines 151 - 154, Extend the assertions for
first.context in the autonomy-platform test to verify that non-empty
blocker-resolution and skipper-escalation playbooks are present, alongside the
existing outcome-ownership assertion. Keep the current ordering/content checks
and rejection assertion unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/1helm-oci-runtime`:
- Around line 718-732: Wrap the ownership/storage health-check command in the
retry loop around the podman exec invocation, using the existing timeout
dependency and the same timeout duration as the later socket/DNS/TCP probe.
Preserve the current arguments, probe script, retry behavior, and success
handling in verify_container.
- Around line 703-704: Update the container creation flow around channel_root
and network_ready to remove or reset the retained network-ready-v1 marker before
the new container proceeds, including restore handling as applicable. Ensure
newly created containers cannot skip the network health check in the logic
around the create path.

In `@site/public/install-oci-runtime.sh`:
- Line 44: Update the package installation list and prerequisite validation in
the OCI setup script: include the apparmor package in the apt-get install set,
and ensure both prerequisite checks include apparmor_parser before the nested
AppArmor configuration runs. Preserve the existing failure behavior when the
parser remains unavailable.

In `@site/public/install.sh`:
- Line 17: Update rollback handling in site/public/install.sh (line 17),
site/public/apply-linux-release.sh (line 23), and site/public/update-host.sh
(line 25) to reload /etc/apparmor.d/crun after restoring host-contract files,
but only when apparmor_parser and the parent AppArmor profile are available;
retain the existing daemon-reload behavior.

---

Outside diff comments:
In `@test/windows-wsl-status.ps1`:
- Around line 1-42: Add an explicit CI step in the existing workflow to execute
test/windows-wsl-status.ps1 with PowerShell on a compatible Windows runner.
Ensure the step runs as part of the normal test job or workflow so its
throw-based assertions execute, while preserving the existing desktop.mjs
text-check behavior.

---

Nitpick comments:
In `@test/autonomy-platform.mjs`:
- Around line 151-154: Extend the assertions for first.context in the
autonomy-platform test to verify that non-empty blocker-resolution and
skipper-escalation playbooks are present, alongside the existing
outcome-ownership assertion. Keep the current ordering/content checks and
rejection assertion unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: fb346c23-a77d-4298-a496-697eadf9313d

📥 Commits

Reviewing files that changed from the base of the PR and between 5437442 and 346f6c7.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (21)
  • CHANGELOG.md
  • README.md
  • package.json
  • scripts/1helm-oci-runtime
  • scripts/install-wsl-runtime.ps1
  • site/public/apply-linux-release.sh
  • site/public/install-oci-runtime.sh
  • site/public/install.sh
  • site/public/uninstall-host.sh
  • site/public/update-host.sh
  • src/server/bots.ts
  • src/server/channel-computers.ts
  • src/server/db.ts
  • src/server/skills.ts
  • test/autonomy-platform.mjs
  • test/channel-computers.mjs
  • test/desktop.mjs
  • test/mock-openai.mjs
  • test/native-world.mjs
  • test/site.mjs
  • test/windows-wsl-status.ps1

Comment thread scripts/1helm-oci-runtime
Comment on lines +703 to +704
root="$(channel_root "$name")"
network_ready="$root/network-ready-v1"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check whether container/channel recreation clears the network-ready-v1 marker.
rg -n 'network-ready-v1|channel_root\(' scripts/1helm-oci-runtime

Repository: gitcommit90/1Helm

Length of output: 260


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- relevant function map ---'
ast-grep outline scripts/1helm-oci-runtime --match '$_' --view compact 2>/dev/null | sed -n '1,220p'
printf '%s\n' '--- marker and lifecycle references ---'
rg -n -C 8 'network_ready|network-ready-v1|create_container|destroy_container|remove_container|CHANNELS_ROOT|channel_root' scripts/1helm-oci-runtime
printf '%s\n' '--- lifecycle section ---'
sed -n '1,130p' scripts/1helm-oci-runtime
sed -n '650,770p' scripts/1helm-oci-runtime

Repository: gitcommit90/1Helm

Length of output: 30242


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- definitions and callers ---'
rg -n -C 12 '^(channel_root|create_container|delete_container|destroy_container|recreate_container|cleanup|remove|reset|main)[[:space:]]*\(\)|channel_root|create_container|network_ready|network-ready-v1|CHANNELS_ROOT' scripts/1helm-oci-runtime
printf '%s\n' '--- lines 680-760 ---'
sed -n '680,760p' scripts/1helm-oci-runtime

Repository: gitcommit90/1Helm

Length of output: 26319


🏁 Script executed:

#!/bin/bash
set -eu
python3 - <<'PY'
from pathlib import Path

source = Path("scripts/1helm-oci-runtime").read_text()
marker = 'network-ready-v1'

def section(start, end):
    a = source.index(start)
    b = source.index(end, a)
    return source[a:b]

create = section('  create)\n', '  inspect)\n')
delete = section('  delete)\n', '  # Host Files/Cowork bridge')
restore = section('restore_container() {', '\noperation=')

checks = {
    "delete removes channel root": 'rm -rf -- "$root"' in delete,
    "create invokes prepare_storage before create_container": create.index('prepare_storage') < create.index('create_container'),
    "create does not remove network-ready-v1": marker not in create,
    "restore imports channel tree and starts container": 'mv -T "$temporary/channel" "$root"' in restore and 'start_container "$name" "$owner"' in restore,
    "restore does not remove network-ready-v1": marker not in restore,
}
for name, result in checks.items():
    print(f"{name}: {'YES' if result else 'NO'}")
PY

Repository: gitcommit90/1Helm

Length of output: 394


Clear network-ready-v1 when creating a new container from retained channel storage. The create and restore paths preserve the marker, so a new container can skip the network health check at lines 734-745.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/1helm-oci-runtime` around lines 703 - 704, Update the container
creation flow around channel_root and network_ready to remove or reset the
retained network-ready-v1 marker before the new container proceeds, including
restore handling as applicable. Ensure newly created containers cannot skip the
network health check in the logic around the create path.

Comment thread scripts/1helm-oci-runtime
Comment on lines 718 to 732
for _ in {1..100}; do
# Podman can briefly fail name-based --user lookup while it reconstructs
# its ephemeral runroot after a host reboot even though the persisted
# image passwd database is intact. These identities are pinned by the
# installed runtime manifest and image contract, so use their numeric form
# for the readiness probe and every subsequent exec boundary.
if "${PODMAN[@]}" exec --user 0:0 "$name" /bin/sh -c 'test "$(cat /var/lib/1helm/owner)" = "$1" && test -d /workspace && test -d /home/agent' 1helm-start "$owner" >/dev/null 2>&1; then
if "${PODMAN[@]}" exec --user 0:0 "$name" /bin/sh -c \
'test "$(cat /var/lib/1helm/owner)" = "$1" && test -d /workspace && test -d /home/agent' \
1helm-start "$owner" >/dev/null 2>&1; then
verify_container "$name" "$owner"
return
container_ok=1
break
fi
sleep 0.1
done

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Wrap the ownership/storage health-check exec in timeout.

This loop retries "${PODMAN[@]}" exec --user 0:0 "$name" ... up to 100 times, but the exec call itself has no timeout. If a single podman exec invocation hangs (for example, a container whose init process is unresponsive after a host reboot, which the surrounding comment explicitly anticipates), the loop blocks on that call indefinitely instead of retrying, and the script never reaches die. The socket/DNS/TCP probe added a few lines later (Line 736) is correctly wrapped in timeout 7, and timeout is added as a required dependency at Line 956 specifically for this function — apply the same protection here for consistency and to guarantee the retry loop cannot hang.

🐛 Proposed fix to bound the ownership/storage probe
   for _ in {1..100}; do
-    if "${PODMAN[@]}" exec --user 0:0 "$name" /bin/sh -c \
+    if timeout 7 "${PODMAN[@]}" exec --user 0:0 "$name" /bin/sh -c \
         'test "$(cat /var/lib/1helm/owner)" = "$1" && test -d /workspace && test -d /home/agent' \
         1helm-start "$owner" >/dev/null 2>&1; then
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
for _ in {1..100}; do
# Podman can briefly fail name-based --user lookup while it reconstructs
# its ephemeral runroot after a host reboot even though the persisted
# image passwd database is intact. These identities are pinned by the
# installed runtime manifest and image contract, so use their numeric form
# for the readiness probe and every subsequent exec boundary.
if "${PODMAN[@]}" exec --user 0:0 "$name" /bin/sh -c 'test "$(cat /var/lib/1helm/owner)" = "$1" && test -d /workspace && test -d /home/agent' 1helm-start "$owner" >/dev/null 2>&1; then
if "${PODMAN[@]}" exec --user 0:0 "$name" /bin/sh -c \
'test "$(cat /var/lib/1helm/owner)" = "$1" && test -d /workspace && test -d /home/agent' \
1helm-start "$owner" >/dev/null 2>&1; then
verify_container "$name" "$owner"
return
container_ok=1
break
fi
sleep 0.1
done
for _ in {1..100}; do
# Podman can briefly fail name-based --user lookup while it reconstructs
# its ephemeral runroot after a host reboot even though the persisted
# image passwd database is intact. These identities are pinned by the
# installed runtime manifest and image contract, so use their numeric form
# for the readiness probe and every subsequent exec boundary.
if timeout 7 "${PODMAN[@]}" exec --user 0:0 "$name" /bin/sh -c \
'test "$(cat /var/lib/1helm/owner)" = "$1" && test -d /workspace && test -d /home/agent' \
1helm-start "$owner" >/dev/null 2>&1; then
verify_container "$name" "$owner"
container_ok=1
break
fi
sleep 0.1
done
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/1helm-oci-runtime` around lines 718 - 732, Wrap the ownership/storage
health-check command in the retry loop around the podman exec invocation, using
the existing timeout dependency and the same timeout duration as the later
socket/DNS/TCP probe. Preserve the current arguments, probe script, retry
behavior, and success handling in verify_container.

container_virt="$(systemd-detect-virt --container 2>/dev/null || true)"
apparmor_enabled="$(cat /sys/module/apparmor/parameters/enabled 2>/dev/null || true)"
if [[ -n "$container_virt" && "$container_virt" != none && "$apparmor_enabled" =~ ^[Yy]$ && -r /etc/apparmor.d/crun ]]; then
command -v apparmor_parser >/dev/null || { echo "Nested AppArmor OCI setup requires apparmor_parser." >&2; exit 1; }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

# Confirm that the installer provisions the command it requires.
grep -nE 'apt-get install.*apparmor|for command in .*apparmor_parser' \
  site/public/install-oci-runtime.sh

# Run on each supported Ubuntu/Debian base image.
command -v apparmor_parser

Repository: gitcommit90/1Helm

Length of output: 155


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

printf '%s\n' '--- installer context ---'
sed -n '1,90p' site/public/install-oci-runtime.sh

printf '%s\n' '--- AppArmor references ---'
rg -n -C 3 'apparmor|apt-get install|command -v' site/public/install-oci-runtime.sh

Repository: gitcommit90/1Helm

Length of output: 8609


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path
import re

path = Path("site/public/install-oci-runtime.sh")
text = path.read_text()

install_lines = [
    line.strip() for line in text.splitlines()
    if "apt-get install" in line
]
command_loops = [
    line.strip() for line in text.splitlines()
    if re.search(r"for command in", line)
]

print("apt install lines:")
print("\n".join(install_lines))
print("command prerequisite loops:")
print("\n".join(command_loops))
print("apparmor in install set:", any(re.search(r"\bapparmor\b", line) for line in install_lines))
print("apparmor_parser in prerequisite loops:",
      any("apparmor_parser" in line for line in command_loops))
PY

Repository: gitcommit90/1Helm

Length of output: 826


🌐 Web query:

Debian Ubuntu package apparmor_parser provided by apparmor package official package contents

💡 Result:

In both Debian and Ubuntu, the apparmor_parser executable is officially provided by the apparmor binary package [1][2][3]. The apparmor package is the core user-space utility package for AppArmor, which includes the apparmor_parser tool used to compile and load AppArmor security policies into the Linux kernel [1][4][3]. Depending on the specific system configuration and version history, this file may be located in /usr/sbin/apparmor_parser or historically in /sbin/apparmor_parser [3][5][6][7]. Modern distributions typically utilize a merged /usr layout where these paths are unified [7].

Citations:


Install the AppArmor parser before requiring it.

Add apparmor to the apt-get install set and add apparmor_parser to both prerequisite checks. Otherwise, a nested host can skip installation and exit when the parser check runs.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@site/public/install-oci-runtime.sh` at line 44, Update the package
installation list and prerequisite validation in the OCI setup script: include
the apparmor package in the apt-get install set, and ensure both prerequisite
checks include apparmor_parser before the nested AppArmor configuration runs.
Preserve the existing failure behavior when the parser remains unavailable.

Comment thread site/public/install.sh
/usr/libexec/1helm-oci-runtime
/etc/1helm/oci-runtime-v1.conf
/etc/sudoers.d/1helm-oci-runtime
/etc/apparmor.d/local/crun

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Reload the crun AppArmor profile during rollback.

A failed transaction can reload the new local profile before rollback. Each rollback restores /etc/apparmor.d/local/crun on disk, but only runs systemctl daemon-reload. That command does not reload AppArmor policy. The kernel can retain the new socket grants after rollback.

  • site/public/install.sh#L17-L17: After restoring host-contract files, reload /etc/apparmor.d/crun when apparmor_parser and the parent profile are available.
  • site/public/apply-linux-release.sh#L23-L23: After restoring host-contract files, reload /etc/apparmor.d/crun when apparmor_parser and the parent profile are available.
  • site/public/update-host.sh#L25-L25: After restoring host-contract files, reload /etc/apparmor.d/crun when apparmor_parser and the parent profile are available.
📍 Affects 3 files
  • site/public/install.sh#L17-L17 (this comment)
  • site/public/apply-linux-release.sh#L23-L23
  • site/public/update-host.sh#L25-L25
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@site/public/install.sh` at line 17, Update rollback handling in
site/public/install.sh (line 17), site/public/apply-linux-release.sh (line 23),
and site/public/update-host.sh (line 25) to reload /etc/apparmor.d/crun after
restoring host-contract files, but only when apparmor_parser and the parent
AppArmor profile are available; retain the existing daemon-reload behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant