Skip to content

refactor: SKILL audit + os-image cocoon-agent/sshd unification#32

Merged
CMGS merged 3 commits intomasterfrom
chore/manual-skill-audit
May 6, 2026
Merged

refactor: SKILL audit + os-image cocoon-agent/sshd unification#32
CMGS merged 3 commits intomasterfrom
chore/manual-skill-audit

Conversation

@CMGS
Copy link
Copy Markdown
Contributor

@CMGS CMGS commented May 6, 2026

Summary

Three logically separate but related commits on one branch:

  1. 735362e SKILL audit — 10 file-level cleanups surfaced by a top-to-bottom personal walk-through (no agent delegation):

    • drop unused version.NAME (no Makefile/ldflag callers)
    • storage/json/Store.load()utils.ReadJSONFile (saves ~6 lines)
    • network/bridge/bridge_other.go::New returns the existing errUnsupported instead of re-formatting
    • declare type before its iota/typed const block in progress/oci, progress/cloudimg, hypervisor/utils, hypervisor/cloudhypervisor/helper, cmd/images/handler
    • images/oci/commit.go flattens else-after-return to match the loop above it
    • utils/stream.go::NewPipeStreamReader gains a godoc to match its siblings
  2. 90bdf84 ch.pid dedup — cloudhypervisor had "ch.pid" literal in two places; FC already centralizes via pidFileName. CH now mirrors the FC pattern.

  3. 1139984 os-image unification — every Ubuntu and Android Dockerfile now bakes:

    • cocoon-agent v0.1.0 with auto-start (systemd unit on Ubuntu, /system/etc/init/cocoon-agent.rc on Android). Pull URL is multi-arch on Ubuntu, x86_64-only on Android (Android image is amd64-only per os-image/android/platforms).
    • openssh-server on every Ubuntu image, PermitRootLogin yes, default root:cocoon for dev convenience.
    • Drop the LABEL cocoon.ssh.username/password from 24.04-picoclaw (the only image that had it).
    • Add vsock and vmw_vsock_virtio_transport to every image's initramfs-tools/modules so the kernel has the transport ready when cocoon-agent binds AF_VSOCK.

The Ubuntu side factors the install + sshd-config + systemd-unit boilerplate into one shared os-image/ubuntu/install-agent.sh, auto-discovered as build secret cocoon_install_agent by the existing workflow rules. Android keeps a small inline curl + agent.rc because its init system is different.

Compatibility

  • go test ./... and make lint (linux+darwin) clean.
  • Removing the LABEL is a breaking change for any external tool that scraped cocoon.ssh.username / cocoon.ssh.password (e.g. glance-style integrations). Such callers should switch to the documented default root:cocoon or read whatever credential store you wire into your fork.
  • Default PermitRootLogin yes is dev-only; KNOWN_ISSUES.md flags this and the Android SELinux concern.

Test plan

  • CI build-os-images matrix builds all 7 Dockerfiles (amd64+arm64 where applicable)
  • Smoke a built ubuntu:24.04 image: cocoon vm runcocoon vm exec <vm> -- uname -n returns hostname
  • Smoke sshd on the same VM: ssh root@<vm-ip> with cocoon
  • Smoke a built android:14.0 image: confirm cocoon-agent shows up in logcat (and check avc: lines if it doesn't bind)
  • Quick regression: cocoon vm clone / cocoon snapshot save / restore on a built ubuntu image

CMGS added 3 commits May 6, 2026 20:30
- version: drop unused NAME constant (no callers, no Makefile ldflag)
- storage/json: load() now uses utils.ReadJSONFile (~6 lines saved)
- network/bridge: New on non-Linux returns errUnsupported instead of re-formatting
- progress/{oci,cloudimg}: declare Phase type before its iota const block
- hypervisor/utils, hypervisor/cloudhypervisor/helper: same type-before-const fix
- cmd/images/handler: same type-before-const fix
- images/oci/commit: flatten else-after-return to match the loop above
- utils/stream: godoc on NewPipeStreamReader to match siblings
CH had the literal in two places (helper.go runtimeFiles slice and
config.go PIDFileName method). FC already centralizes via pidFileName.
- Ubuntu 22.04 / 24.04 / chrome / xface / picoclaw: install openssh-server,
  pull cocoon-agent v0.1.0 from upstream releases (multi-arch), drop the
  systemd unit, enable both ssh + cocoon-agent.service. The download +
  unit + enable boilerplate is centralized in os-image/ubuntu/install-agent.sh
  (auto-discovered as build secret cocoon_install_agent), so any future
  agent-version bump is a one-line change.
- Android 14.0 / 15.0: stage cocoon-agent binary into /system/bin/ and
  install /system/etc/init/cocoon-agent.rc (auto-start on Android init
  `on boot`). Android stays adb-only for human shell access; no sshd.
- Drop LABEL cocoon.ssh.username/password from picoclaw — credentials are
  now uniformly root:cocoon across all images and documented in
  os-image/README.md and KNOWN_ISSUES.md.
- Add vsock + vmw_vsock_virtio_transport to initramfs modules list across
  every image so the kernel has the transport ready when cocoon-agent
  binds AF_VSOCK at boot, regardless of the host's hot-load behavior.

KNOWN_ISSUES.md gains two entries: default credentials are dev-only and
the Android cocoon-agent service may hit SELinux on stricter redroid
builds. README.md / os-image/README.md updated to reflect the unified
agent + sshd story.

Note: removing the LABEL is a breaking change for any external tooling
that scraped `cocoon.ssh.username` / `cocoon.ssh.password` (e.g. glance).
Such tooling needs to switch to fixed `root:cocoon` (image default) or
read whatever credential store you wire up in your fork.
@CMGS CMGS requested a review from Copilot May 6, 2026 16:09
@CMGS CMGS merged commit 6e3e318 into master May 6, 2026
16 checks passed
@CMGS CMGS deleted the chore/manual-skill-audit branch May 6, 2026 16:48
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