Skip to content

fix(apple-container): file mounts, host.docker.internal, user mapping#2609

Open
CashQ wants to merge 27 commits into
nanocoai:mainfrom
CashQ:main
Open

fix(apple-container): file mounts, host.docker.internal, user mapping#2609
CashQ wants to merge 27 commits into
nanocoai:mainfrom
CashQ:main

Conversation

@CashQ
Copy link
Copy Markdown

@CashQ CashQ commented May 25, 2026

Type of Change

  • Feature skill - adds a channel or integration (source code changes + SKILL.md)
  • Utility skill - adds a standalone tool (code files in .claude/skills/<name>/, no source changes)
  • Operational/container skill - adds a workflow or agent skill (SKILL.md only, no source changes)
  • Fix - bug fix or security fix to source code
  • Simplification - reduces or simplifies source code
  • Documentation - docs, README, or CONTRIBUTING changes only

Description

For Skills

  • SKILL.md contains instructions, not inline code (code goes in separate files)
  • SKILL.md is under 500 lines
  • I tested this skill on a fresh clone

gavrielc and others added 27 commits March 8, 2026 23:18
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pino was replaced with a built-in logger on main. For branches
with baileys (WhatsApp), pino resolves as a transitive dependency
of @whiskeysockets/baileys.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Picks up main's changes while preserving Apple Container runtime:
- Built-in logger replacing pino/pino-pretty
- Removed unused deps (yaml, zod, @vitest/coverage-v8)
- stopContainer bug fix (exec wrapper removed)
- Kept branch's credential proxy (not OneCLI) and Apple Container
  runtime commands

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Detect host gateway via bridge100/bridge0 interface instead of
  hardcoded host.docker.internal (not available in Apple Container VMs)
- Bind credential proxy to 0.0.0.0 so VMs can reach it via bridge network
- Export PROXY_BIND_HOST for credential proxy to use
- Remove /dev/null .env shadow mount — Apple Container only supports
  directory mounts; entrypoint handles .env shadowing via mount --bind

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Binding to 0.0.0.0 exposed the credential proxy (which holds API
keys/OAuth tokens) to the entire local network. Now binds to the
bridge interface IP (same as CONTAINER_HOST_GATEWAY) so only Apple
Container VMs can reach it.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
fix: Apple Container networking and .env mount
bridge100 only exists while containers run, but the credential proxy must
start before any container. Binding to the bridge IP fails with EADDRNOTAVAIL
on cold boot and first-time setup.

Fail immediately with a clear error pointing to /convert-to-apple-container,
which guides users through setting CREDENTIAL_PROXY_HOST and optionally
configuring a macOS firewall rule on untrusted networks.

Co-Authored-By: MrBlaise <3867275+MrBlaise@users.noreply.github.com>
Co-Authored-By: lbsnrs <47463+lbsnrs@users.noreply.github.com>
Co-Authored-By: spencer-whitman <28708638+spencer-whitman@users.noreply.github.com>
Co-Authored-By: lazure-ocean <43110733+lazure-ocean@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…oxy-bind

fix: require CREDENTIAL_PROXY_HOST for Apple Container networking
Adapts the upstream skill branch to HEAD's OneCLI-based architecture
(install-slug labels, peer agent-group model). Key decisions:

- src/container-runtime.ts: switched docker → container CLI (system
  status/start, --mount type=bind syntax, JSON ls --all output for
  orphan cleanup). Install-label scoping preserved via JSON labels.
- src/container-runner.ts: dropped the fork's credential-proxy env
  injection — HEAD uses OneCLI, not the proxy. Removed unused isMain
  branch (HEAD has no "main group" concept).
- src/config.ts: added CREDENTIAL_PROXY_PORT (kept for the defensive
  entrypoint mount-bind path), kept HEAD's install-slug architecture.
- container/Dockerfile: removed USER node (need root for mount --bind),
  added util-linux for setpriv, kept modern Bun + CJK opt-in.
- container/entrypoint.sh: added mount --bind /dev/null .env defense
  and setpriv privilege-drop path; preserved existing bun run entry.
- container/build.sh: default runtime is now container.
- Deleted src/credential-proxy.{ts,test.ts} — HEAD uses OneCLI.

Skipped skill Phase 3 (CREDENTIAL_PROXY_HOST=0.0.0.0 + firewall) —
that env only existed to satisfy a module-load throw from the fork's
credential-proxy, which HEAD doesn't have.

Verified: pnpm build clean, 371/371 tests pass, image built, ro/rw
mounts work, image has setpriv + bun 1.3.12.
Adds Telegram as a chat channel alongside CLI. Includes:

- telegram.ts: channel implementation using @chat-adapter/telegram
- telegram-pairing.ts: device-pairing flow for linking bot to install
- telegram-markdown-sanitize.ts: escapes markdown for Telegram MarkdownV2
- Self-registration via channels/index.ts import
Three issues prevented agent containers from starting under Apple
Container after the runtime swap:

1. File mounts crashed before container start.
   Apple Container's --mount type=bind rejects file (non-directory)
   sources: "path '...' is not a directory". The -v syntax accepts both
   files and dirs with proper readonly enforcement. Switch
   readonlyMountArgs to '-v src:dst:ro'.

2. host.docker.internal didn't resolve inside the container.
   OneCLI returns HTTPS_PROXY=http://...@host.docker.internal:10255 and
   Apple Container has no --add-host flag. Patch /etc/hosts inside the
   container before exec'ing bun, mapping host.docker.internal to the
   bridge gateway (default 192.168.64.1).

3. The --user flag prevented the /etc/hosts patch from running.
   Switch from passing --user to passing RUN_UID/RUN_GID env vars; the
   bash -c entry runs as root, writes /etc/hosts, then setpriv-drops to
   the requested uid/gid before exec'ing the agent-runner.

Note: the existing container/entrypoint.sh is bypassed by --entrypoint
bash in v2 (no stdin, IO via session DB), so the setup logic now lives
in the bash -c command in buildContainerArgs.

Verified: 371/371 tests pass; manual container run shows /etc/hosts
patched, setpriv drops to uid 501 gid 20, and host.docker.internal
resolves to the bridge IP.
groups/global/CLAUDE.md and groups/main/CLAUDE.md described the v1
architecture (single "Main" agent, /workspace/project/store with
messages.db, registered_groups table, "main channel with elevated
privileges"). v2 replaced this with the peer agent-group model —
groups live at groups/<folder>/ per agent, no "main channel" concept.
The files were leftover from an earlier setup-skill run.
@github-actions github-actions Bot added the follows-guidelines PR was created using the current contributing template label May 25, 2026
@CashQ CashQ changed the title fix(apple-container): file mounts, host.docker.internal, user mapping fix(apple-container): file mounts, host.docker.internal, user mapping May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

follows-guidelines PR was created using the current contributing template

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants