Skip to content

fix(sbx): install-host.sh installs and wires moca-egress (#623) - #627

Merged
pdettori merged 3 commits into
mainfrom
feat/623-sbx-host-egress
Oct 27, 2026
Merged

pdettori merged 3 commits into
mainfrom
feat/623-sbx-host-egress

Conversation

@pdettori

@pdettori pdettori commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

#624 has merged, and this branch is rebased onto main.

What

Closes #623. deploy/sbx/install-host.sh now installs and wires moca-egress, so an SBX KVM host gets guest egress without a manual drop-in. This is chunk 1 of the SBX0.2b plan and carries no credentials.

  • Install order. One moca-egress per host serves every template worker. The unit is generated from deploy/microvm/moca-egress.service, with EnvironmentFile= pointed at $SBX_ENV_DIR/moca-egress.env and comments dropped. It is started and its control socket waited for before any worker restarts. A socket timeout or a failed Type=notify start fails with journalctl -u moca-egress named.
  • Workers. Each worker gets MOCA_EGRESS_CONTROL_SOCK=/run/moca-egress/control.sock. [email protected] is ordered After=/Wants=moca-egress.service.
  • Allowlist. It is seeded only when absent, from MOCA_EGRESS_ALLOW or the v0.8.0 default. An operator's edit survives re-runs, and survives the last uninstall too.
  • An existing unit is never overwritten. If a moca-egress.service that this script did not install already exists (a host also running deploy/microvm's P6), it is reused: not overwritten, not recorded, not removed.
  • Missing binary. If /usr/local/bin/moca-egress is missing, the install is refused before any systemd call. --no-egress opts a worker out.
  • Uninstall. The last uninstall removes the egress unit and the unedited env file that this script installed.
  • RUNBOOK "Guest egress" section; README file list.

Tests

deploy/sbx/tests/install-host.test.sh passes, including the new egress block: ordering, seeding, an edited allowlist kept, reuse of an existing unit, the missing-binary refusal, --no-egress, the socket timeout, a second worker that does not restart the shared proxy, and an inactive proxy getting reset-failed then start. setup.test.sh passes. shellcheck -x -S warning is clean, and Prettier is clean.

Status

  • Live acceptance on the SBX KVM host passed. See the comment below.
  • A0, the GitHub auth-shape check from plan Task 1, is still open. It does not block this PR: it only decides the preset catalog in a later chunk.

🤖 Generated with Claude Code

@pdettori
pdettori force-pushed the feat/623-sbx-host-egress branch from 0e1aad7 to caf45b1 Compare October 27, 2026 12:09
@pdettori

Copy link
Copy Markdown
Member Author

Live acceptance: PASS on the SBX0 KVM host (the metal rig serving moca-sbx), 2026-10-27, with the owner alerted.

Migration. The host had a hand-installed moca-egress.service that /etc/sbx/manifest didn't record, plus the manual drop-in sbx-worker@sbx_default.service.d/egress.conf. I backed both up, stopped and disabled the hand-installed unit, and moved it aside. Then I ran install-host.sh ~/627-bundle --snapshot default-p41 --budget-mb 32768 from this branch, with the found allowlist in MOCA_EGRESS_ALLOW. The binaries were unchanged (moca-egress 89fcee6c…, microvm-worker 5b93cdad…).

What the install produced:

  • moca-egress.service was generated and recorded as egress unit. It reads /etc/sbx/moca-egress.env, recorded as egress file, with the same allowlist. Apart from EnvironmentFile=, its body is identical to the hand-installed one.
  • /etc/sbx/workers/sbx_default.env has MOCA_EGRESS_CONTROL_SOCK.
  • The worker attached.

Removing the drop-in. After the install, I removed the drop-in, ran daemon-reload, and restarted the worker. It shows DropInPaths= empty, Wants=/After=moca-egress.service from the template unit, the socket env var in its process environment, and it attached again.

From a sandbox (mocactl sbx run):

  • curl https://api.github.com/zen returned 200. The audit logged decision=tunnel with dial_addr 140.82.114.6:443.
  • curl https://example.com returned 403 X-Moca-Egress-Error: destination_denied, also audited.
  • git ls-remote https://github.com/cli/cli HEAD works.
  • A direct dial (--noproxy '*') fails with "Could not resolve host", so the guest has no NIC or DNS.

Kept on the host:

  • ~/627-backup holds the rollback copies.
  • /etc/serverless-harness/moca-egress.env is now unused, because the managed unit reads /etc/sbx/. I left it because it sits in the P6 config directory.
  • ~/moca-627 stays until merge.

The manifest is ~/627-manifest.md.

A0 (the GitHub auth-shape check) is still open. It doesn't block this PR.

Base automatically changed from docs/sbx-egress-credentials to main October 27, 2026 13:48
@pdettori
pdettori marked this pull request as ready for review October 27, 2026 13:51
@pdettori
pdettori requested a review from cwiklik as a code owner October 27, 2026 13:51
@pdettori pdettori added the ready-for-ai-review Request automated AI code review from clawgenti label Oct 27, 2026

@ingpaolodettori-dev ingpaolodettori-dev 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.

Reviewed at caf45b1 (commits 43abe54 + caf45b1 on top of main 52cf778).

The egress install is careful: it validates before touching systemd, skips the restart when nothing changed, does reset-failed before start, keeps the seeded allowlist across re-runs, and leaves a foreign unit alone. The tests cover each of those paths, and the live acceptance comment matches the design. No blockers. One suggestion and two nits are inline. The suggestion: ownership of moca-egress.service should also check the unit's content, so this script and setup-microvm.sh can't overwrite or remove each other's unit on a dual-install host.

Also:

  • CI has not run on this PR. Only DCO is reported at caf45b1, and there are no workflow runs for this head. The PR was opened and last pushed while its base was #624's branch, and ci.yml filters pull_request on branches: [main]. The base change to main doesn't trigger synchronize. A push, or close/reopen, is needed so deploy-scripts (make test-deploy, which runs install-host.test.sh), lint and the rest run before merge.
  • nit: the PR body still says to review 0fdfffd5/0e1aad73 after ec21394a, but those SHAs were rebased away. "Still to do" also ticks A0, which the acceptance comment says is still open.

Author: pdettori (MEMBER — maintainer)
Areas reviewed: Shell, systemd units, Docs, Tests, Security
Agent/IDE config (.claude/.vscode): none
Commits: 2 commits, all signed-off: yes
CI status: not run (DCO only)

Comment thread deploy/sbx/install-host.sh Outdated
local unit="$SBX_UNIT_DIR/moca-egress.service" env="$SBX_ENV_DIR/moca-egress.env" tmp changed=0 hint
[[ -x "$SBX_BIN_DIR/moca-egress" ]] ||
die "no $SBX_BIN_DIR/moca-egress: build it with CGO_ENABLED=0 go build -o /usr/local/bin/moca-egress ./remote-worker/cmd/moca-egress (or pass --no-egress to install the worker without guest egress)"
if [[ -e "$unit" ]] && ! grep -qxF "egress unit $unit" "$SBX_ENV_DIR/manifest" 2>/dev/null; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion — Ownership is decided by the manifest line alone, so it doesn't survive the other installer. Take a host where this script installs moca-egress.service first, and later deploy/microvm/setup-microvm.sh (P6) runs. install_if_changed overwrites the unit with the P6 copy, whose EnvironmentFile=/etc/serverless-harness/moca-egress.env, while the manifest still says egress unit …. After that:

  • a re-run of this script finds a recorded unit, cmp differs, so it reinstalls the /etc/sbx variant and restarts. The two installers flip-flop the allowlist file on every run.
  • the last --uninstall here does disable --now and rm on a unit that P6's microvm-worker now depends on.

That breaks the header's "never another install on the same host" claim. Suggest treating a recorded unit as ours only while its content still equals what we generate (the $tmp from sed, or a checksum recorded in the manifest). Otherwise, log it and take the reuse path. Apply the same check in remove_egress before disable --now/rm.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 86d8691. The manifest now records egress unit <path> <sha256>, and a recorded unit counts as ours only while its content hashes to that digest.

On a mismatch, for example setup-microvm.sh has replaced it:

  • the install logs moca-egress.service was changed by another install; reusing it, drops its claim and takes the reuse path;
  • remove_egress makes the same check before disable --now or rm, and otherwise logs kept … (changed by another install).

Two-field manifests from the earlier commit fall back to comparing with the regenerated unit. The new test replaces the unit after install, re-runs, and uninstalls. It asserts the unit is reused and never disabled or removed. A "Ownership is by content" bullet is added to the RUNBOOK.

Comment thread deploy/sbx/install-host.sh Outdated
die "no $SBX_BIN_DIR/moca-egress: build it with CGO_ENABLED=0 go build -o /usr/local/bin/moca-egress ./remote-worker/cmd/moca-egress (or pass --no-egress to install the worker without guest egress)"
if [[ -e "$unit" ]] && ! grep -qxF "egress unit $unit" "$SBX_ENV_DIR/manifest" 2>/dev/null; then
log "reusing the existing moca-egress.service (not installed by this script)"
wait_egress_ready

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit — In the reuse path, nothing makes sure the foreign unit is enabled or running. An inactive P6 moca-egress only shows up as the 30 s socket timeout, and wait_egress_ready's hint then names $SBX_ENV_DIR/moca-egress.env, which this unit doesn't read (its allowlist is /etc/serverless-harness/moca-egress.env, per the RUNBOOK). Consider an is-active check with its own message ("the existing moca-egress.service is not running; start it or fix its install"), or passing the env path into the hint.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 86d8691. The reuse path now runs is-active before any worker restart. If the unit isn't active, it fails with the existing moca-egress.service (not installed by this script) is not running: start it or fix the install that owns it.

wait_egress_ready takes the env path as an argument. On the reuse path the script reads it from the foreign unit's EnvironmentFile=, so the timeout hint names the file that unit actually uses. A test asserts that no restart sbx-worker@… happens and checks the hint.

Comment thread deploy/sbx/install-host.sh Outdated
case "$kind" in
unit) rm -f "$path"; log "removed $path (no SBX0 worker left on this host)" ;;
file)
if [[ -f "$path" && "$(cat "$path")" != "$(egress_seed)" ]]; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit — "Unedited" is judged against egress_seed at uninstall time, so it depends on the uninstaller's MOCA_EGRESS_ALLOW. Suppose the file was seeded from a custom MOCA_EGRESS_ALLOW, as in the live acceptance run, where the found allowlist was passed in. An uninstall without that env reports kept … (edited) and leaves the file, even though nobody edited it. That fails safe, but it contradicts the RUNBOOK and the log line. Recording the seeded content's hash in the manifest (e.g. egress file <path> <sha256>) would make the check exact. The sed -n 's/^egress //p' + read -r kind path loop would need a third field for that.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 86d8691. When the seed is written, its sha256 is recorded as egress file <path> <sha256>. Uninstall removes the file only when its current hash matches, so the check no longer depends on the uninstaller's MOCA_EGRESS_ALLOW. A two-field manifest line still uses the old comparison.

The reading loop takes the third field. An unknown egress <kind> line now does continue and keeps both its line and its file, which matters for the egress credential kind a later chunk adds.

Tests cover:

  • a custom seed, removed without the variable set;
  • an edited file, kept;
  • a two-field manifest, which uninstalls cleanly;
  • an egress foo line, which survives.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
@pdettori
pdettori force-pushed the feat/623-sbx-host-egress branch from caf45b1 to 86d8691 Compare October 27, 2026 14:43
@pdettori

Copy link
Copy Markdown
Member Author

All three inline points are fixed in 86d8691, with replies on each thread. On the two general points:

install-host.test.sh passes with the new cases, and shellcheck -x -S warning is clean.

@ingpaolodettori-dev ingpaolodettori-dev 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.

Re-reviewed at 86d8691. The head was rebased onto main fd97fbd after #624 merged. Running range-diff shows 43abe54/caf45b1 replayed unchanged (=) as 8d24644/d5ec433, so I reviewed only the new commit, 86d8691.

I checked all three items from the caf45b1 review against the code. All are fixed:

  • Ownership by content. The manifest now records egress unit <path> <sha256>. A recorded unit that no longer hashes to its digest gets changed by another install; reusing it, and its claim is dropped. remove_egress does the same check before disable --now/rm. A test overwrites the unit with a P6 copy, then checks that the re-run reuses it and the last uninstall neither disables nor removes it.
  • Reuse path. is-active runs before any worker restart and has its own message. The socket-timeout hint names the foreign unit's EnvironmentFile=. Both are tested.
  • Env-file digest. "Unedited" is judged by the recorded sha256, so it no longer depends on the uninstaller's MOCA_EGRESS_ALLOW. Two-field manifest lines fall back to the old comparison. An unknown egress <kind> line, and its file, are left alone. Each case is tested.

CI is now running on this head, and every check passes: check, deploy-scripts, lint, shellcheck, trivy-scan, codeql, and the rest. The PR-body nit is also fixed.

FYI, not blocking: a two-field egress unit line (only from this PR's earlier head, i.e. the acceptance host) is judged "ours" by comparing against the current egress_unit_text. If a later release changes deploy/microvm/moca-egress.service before that host re-runs, the old unit is treated as foreign and left in place. That fails safe, and the next re-run here on the acceptance host upgrades the line to the digest form.

Author: pdettori (MEMBER — maintainer)
Areas reviewed: Shell, systemd units, Docs, Tests, Security
Agent/IDE config (.claude/.vscode): none
Commits: 3 commits (8d24644, d5ec433, 86d8691), all signed-off: yes
CI status: passing (all checks green at 86d8691)

@cwiklik cwiklik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed at 86d86910, after the rebase and force-push. CI is fully green (14/14, including deploy-scripts, which is what actually runs these shell tests, and shellcheck), and I confirmed the three points from @ingpaolodettori-dev's review are genuinely fixed rather than just claimed: ownership is now content-based (egress unit <path> <sha256> in the manifest, with egress_unit_is_ours / egress_claimed / egress_recorded_hash / egress_forget), the reuse path gates on is-active before any worker restart, and wait_egress_ready takes the env path so a reused unit's hint names the file that unit actually reads. The five new test blocks cover the P6-overwrite, inactive-reuse, custom-seed-digest and two-field-manifest cases.

Approving. Nothing blocking. Two of the eight inline notes are small regressions the fix commit introduced, both worth a follow-up push:

  • read -r kind path sha (install-host.sh:356) narrows parsing the two-field version got right — the third variable stops path absorbing the remainder, so a $SBX_UNIT_DIR containing a space now splits across path/sha. Theoretical today, but it is a real narrowing.
  • sha_of in the test (:314) has a fallback that cannot fire: || binds to the pipeline, whose status comes from cut. The production sha256_of gets this right with command -v.

The rest are nits plus one loose end: #623's proposed fix asks the installer to refuse a pre-P4.1 snapshot "or at least warn", and that is still prose-only in the RUNBOOK. Worth either a best-effort warning or a note in #623 saying why documentation is the right call, so the item does not read as unaddressed.

One housekeeping note on the corrected body: it now ends 🤖 Generated with [Claude Code], which contradicts CLAUDE.md:104 (Assisted-By, not Generated with). The commit trailers themselves are correct.

Author: pdettori (MEMBER — maintainer)
Areas reviewed: Shell (install-host.sh, tests/install-host.test.sh), systemd unit ([email protected]), Docs (RUNBOOK.md, README.md)
Agent/IDE config (.claude/.vscode): none
Commits: 3 commits, all signed-off: yes
CI status: passing (14/14 at 86d86910)

remove_egress() {
local kind path sha
[[ -f "$SBX_ENV_DIR/manifest" ]] || return 0
while read -r kind path sha; do

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion — the third read variable narrows path handling that the two-field version got right.

With read -r kind path, path absorbed everything after the kind, so a $SBX_UNIT_DIR or $SBX_ENV_DIR containing a space still parsed correctly. With read -r kind path sha, path takes only the first whitespace-delimited field. Checked empirically:

$ printf 'unit /etc/sbx dir/moca-egress.service abc123\n' | while read -r kind path sha; do echo "path=[$path] sha=[$sha]"; done
path=[/etc/sbx] sha=[dir/moca-egress.service abc123]

So rm -f "$path" would target a directory, sha256_of "$path" would fail, and egress_forget would never match the line — it would be left in the manifest. The same split affects egress_claimed and egress_recorded_hash, which compare $3 == p.

This is theoretical today (nothing sets a spaced SBX_UNIT_DIR), hence a suggestion rather than a must-fix — but the previous code was immune and this is not. Two ways to close it: extend the PLAIN_PATH_RE guard that install_janitor already applies (:386, :394) to the install path as well, so a spaced directory is refused up front; or put the digest in field 2 (egress unit <sha256> <path>) so the path stays last and keeps absorbing the remainder.

# Egress (#623): one moca-egress per host, a seeded allowlist, the worker wired to its socket. The
# state is clean here (no worker, no janitor, an empty manifest), so the first install installs the unit.
EM="$SBX_ENV_DIR/manifest"
sha_of() { shasum -a 256 "$1" 2>/dev/null | cut -d' ' -f1 || sha256sum "$1" | cut -d' ' -f1; }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit — this fallback cannot fire.

shasum -a 256 "$1" 2>/dev/null | cut -d' ' -f1 || sha256sum "$1" | cut -d' ' -f1 — the || binds to the whole pipeline, and a pipeline's exit status is its last command's. With shasum missing, cut still succeeds on empty input, so the pipeline exits 0 and sha256sum is never reached:

$ nosuchcmd -a 256 f 2>/dev/null | cut -d' ' -f1 || echo FALLBACK_FIRED
(prints nothing)

On a host with only sha256sum (most Linux boxes — this is the GNU coreutils name, shasum is the perl script) sha_of returns the empty string, and the manifest assertion at line 332 fails with a confusing message instead of falling back. CI passes because ubuntu-latest happens to have both.

The production sha256_of (install-host.sh:87) already does this correctly with command -v sha256sum; mirroring that shape here would make the test fixture agree with the code it tests.

else
# An env file already there is recorded only if nothing is: with no digest, uninstall falls back to
# comparing it with the seed.
egress_claimed file "$env" || record "egress file $env"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion — a pre-existing env file is recorded without a digest, so this install's own file is judged by the env-dependent comparison the digest was added to replace.

That is the common re-run path: the second and every later install-host.sh for a host that already has moca-egress.env takes this branch, records egress file <path> with no third field, and remove_egress then falls back to "$(cat "$path")" != "$(egress_seed)" — reintroducing the dependency on the uninstaller's MOCA_EGRESS_ALLOW for exactly the file this script seeded on the first run.

The comment acknowledges the fallback, but there is no reason to take it when the file is right there to hash. Recording egress file $env $(sha256_of "$env") in both arms would make the digest universal and leave the two-field fallback for its intended case only — manifests written before digests existed.

The new test at 441-450 covers seed-then-uninstall in one run; it does not cover install, re-install, then uninstall.

# The moca-egress.service this script installs: the P4 unit with this host's env file and without its
# comments (they name the P6 paths).
egress_unit_text() {
sed -e '/^#/d' -e "s#^EnvironmentFile=.*#EnvironmentFile=$SBX_ENV_DIR/moca-egress.env#" "$SCRIPT_DIR/../microvm/moca-egress.service"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit — the generated unit carries no provenance header.

The janitor unit gets one (:437: # Installed by deploy/sbx/install-host.sh --janitor from deploy/sbx/sbx-janitor.service.). Here sed '/^#/d' correctly drops the source comments — they name the P6 paths — but puts nothing back, so an operator reading /etc/systemd/system/moca-egress.service on an sbx host sees a bare unit with no indication of where it came from or what owns it.

Now that ownership is content-hashed, a header earns its keep in the other direction too: it is the natural place to say "do not edit; install-host.sh owns this file and a hand edit makes it stop recognising it" — which is exactly what egress_unit_is_ours will do silently. Appending one line after egress_unit_text's sed would cover both.

[[ "$SBX_ATTACH_SETTLE" =~ ^[1-9][0-9]*$ ]] ||
die "SBX_ATTACH_SETTLE='$SBX_ATTACH_SETTLE' must be a whole number of seconds, at least 1, to outlast the worker's first reconnect backoff (at most 750ms)"
[[ -n "$BUNDLE" ]] || die 'usage: install-host.sh BUNDLE_DIR --snapshot IMAGE [--budget-mb N] | --uninstall ID | --janitor DIR | --uninstall-janitor'
[[ "$MOCA_EGRESS_READY_TIMEOUT" =~ ^[1-9][0-9]*$ ]] ||

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion — this validation has no test, while both sibling rules do.

SBX_ATTACH_SETTLE=0 and the attach-timeout rule are each pinned in tests/install-host.test.sh with the "refuses before touching systemd" assertion pattern, but grep -c 'MOCA_EGRESS_READY_TIMEOUT=0' deploy/sbx/tests/install-host.test.sh returns 0. One block in the same shape as the existing ones would pin it.

# override exists for tests only. The wait is as setup-microvm.sh's.
: "${MOCA_EGRESS_SOCKET:=/run/moca-egress/control.sock}"
: "${MOCA_EGRESS_READY_TIMEOUT:=30}"
: "${DEFAULT_EGRESS_ALLOW:=api.github.com,github.com,codeload.github.com,objects.githubusercontent.com}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit — this is now the third copy of the allowlist literal: deploy/microvm/setup-microvm.sh:49 has the identical default, deploy/microvm/tests/setup-microvm.test.sh:200 asserts it, and P4-ON-P6.md:591 documents it. Not actionable in this PR — there is no file both tiers already source — but worth a note so the next change to the default knows to update all of them.

export SBX_BIN_DIR="$TMP/usrbin" MOCA_EGRESS_SOCKET="$TMP/run/control.sock" MOCA_EGRESS_READY_TIMEOUT=2
mkdir -p "$SBX_BIN_DIR" "$TMP/run"
fake_egress() { : >"$SBX_BIN_DIR/moca-egress"; chmod +x "$SBX_BIN_DIR/moca-egress"; }
fake_socket() { rm -f "$MOCA_EGRESS_SOCKET"; python3 -c 'import socket,sys; s=socket.socket(socket.AF_UNIX); s.bind(sys.argv[1])' "$MOCA_EGRESS_SOCKET"; }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit — python3 is unguarded here, unlike the sibling suite.

deploy/sbx/tests/smoke.test.sh:17 does REAL_PY="$(command -v python3)" || { echo 'SKIP: smoke.test.sh needs python3'; exit 0; }. CI's ubuntu-latest always has python3, so this only bites a local dev on a minimal host — but there the symptom is install_egress timing out on the control socket, which points at the wrong thing entirely rather than at a missing interpreter.

Comment thread deploy/sbx/RUNBOOK.md
`/etc/serverless-harness/moca-egress.env`.
- **`--no-egress`** installs a worker without `MOCA_EGRESS_CONTROL_SOCK` and installs no egress unit:
the worker behaves as before egress existed, and the guest has no network.
- **Snapshot:** a golden snapshot built before P4.1 has no guest egress listener. Rebuild it with

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion — #623's proposed fix asks that the installer "refuses a snapshot built before P4.1 when egress is on, or at least warns"; this documents the caveat but implements neither arm.

A check looks mechanically feasible: snapshots ship a manifest.json whose capabilities array is written by write_manifest (deploy/microvm/build-snapshot.sh:1691-1724) from probe_capabilities, and check_egress_listener (:907) already gates the build on the guest listener — so the capability is both recorded and readable at install time.

The real constraint is that jq is only required for --janitor today, not for a worker install, so a hard refusal would add a dependency to the common path. A best-effort warning — skipped silently when the manifest or jq is absent — gets the issue's weaker arm without that cost.

Either way worth resolving explicitly: implement the warning, or note in #623 why documentation-only is the right call, so that proposed-fix item does not read as unaddressed when the issue is closed.

@pdettori
pdettori merged commit b374519 into main Oct 27, 2026
14 checks passed
@pdettori
pdettori deleted the feat/623-sbx-host-egress branch October 28, 2026 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-ai-review Request automated AI code review from clawgenti

Projects

None yet

Development

Successfully merging this pull request may close these issues.

deploy/sbx: install-host.sh does not install moca-egress, so SBX hosts get no guest egress

3 participants