Files
Sylpheed/docker/decoder/bin/sylph-doctor
MechaCat02 c58196b795 containers: each agent clones the monorepo into its own volume
The last structural fix for the collision class that has bitten three times. Both
containers now clone the repository into their OWN named volume instead of
bind-mounting a human's working tree, so an agent's local git config cannot
capture a human's commits, a credential helper cannot leak a container-only path
onto the host, and a `git add -A` cannot sweep another party's in-flight files.

Cloned once at startup and never auto-pulled: pulling under a running agent
moves files out from under whatever it is mid-edit, which is the same bug again.

Accepted knowingly: Claude Code keys per-project memory off the working
directory, so moving off the host path starts that memory empty. The corpus in
docs/ is the memory that matters and it travels with the clone.

Other changes:
* docker/agent -> docker/decoder; the launcher is sylph-decoder. Roles, not
  "the agent", now that there is more than one.
* /reborn is gone -- one repository now, so the port reads HANDOFF from its own
  checkout rather than through a live read-only mount of someone else's tree.
* Canary mounts separately at /canary; it stays a fork tracking upstream.
* A shared `sylpheed-exchange` volume at /exchange, with tools/ on PATH so
  `share` is available in both.
* The decoder's credential file gets the .host-copy treatment the port already
  had -- `credential.helper=store` rewrites by rename-over-target, which is
  EBUSY on a bind mount and reports a fatal that is not one.
* Budget split deliberately: decoder 5 cpu / 6 GB, port 3 / 4, leaving room for
  the planned Referee. "Half the host" was right when there was one agent.

Prompts move to docs/agents/ and are rewritten around the protocol: the oracle
is the running game, dynamic RE stays with the decoder, each iteration must
attempt to refute one claim of the other, and neither may verify its way out of
its own role.
2026-08-29 11:48:30 +02:00

89 lines
4.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Prove the container can actually do the four things it exists for, before an
# unattended agent spends an hour discovering otherwise.
#
# Every check here stands for a failure that has already happened once: a
# display that was not there, a missing numpy that looked like a logic bug, a
# /dev/shm too small for guest memory, a Vulkan stack with no ICD.
set -u
fail=0
ok() { printf ' \033[32m✔\033[0m %s\n' "$*"; }
bad() { printf ' \033[31m✖\033[0m %s\n' "$*"; fail=$((fail+1)); }
warn() { printf ' \033[33m!\033[0m %s\n' "$*"; }
echo "── resources ──"
# nproc shows the HOST's cores: --cpus is a quota, not a mask. Report both so
# "12 cpus" is never mistaken for 12 cpus' worth of throughput.
quota="unlimited"
if [ -r /sys/fs/cgroup/cpu.max ]; then
read -r q p < /sys/fs/cgroup/cpu.max
[ "$q" != max ] && quota="$(( q / p )) (quota)"
fi
echo " cpus: $(nproc) visible, $quota"
if [ -r /sys/fs/cgroup/memory.max ]; then
m=$(cat /sys/fs/cgroup/memory.max)
[ "$m" = max ] && warn "memory: UNLIMITED — the half-the-box cap is not applied" \
|| ok "memory cap: $(( m / 1024 / 1024 / 1024 )) GiB"
fi
shm=$(df -BM /dev/shm | awk 'NR==2{print $2}' | tr -d M)
# Guest memory for a 512 MB console plus the code cache does not fit in
# Docker's 64 MB default, and the symptom is an mmap error, not a disk-full one.
[ "${shm:-0}" -ge 512 ] && ok "/dev/shm: ${shm} MiB" || bad "/dev/shm only ${shm:-?} MiB — need >=512; pass --shm-size"
echo "── toolchain ──"
for t in clang clang++ cmake ninja cargo rustc python3 node claude; do
command -v "$t" >/dev/null && ok "$t ($("$t" --version 2>/dev/null | head -1))" || bad "$t missing"
done
echo "── python (dynamic RE) ──"
# numpy and PIL missing is the specific hole that silently disabled entities2.py
# and every image oracle in the toolkit.
for m in numpy PIL duckdb; do
python3 -c "import $m" 2>/dev/null && ok "python: $m" || bad "python: $m MISSING"
done
echo "── display ──"
if xdpyinfo >/dev/null 2>&1; then
ok "display $DISPLAY ($(xdpyinfo | awk '/dimensions:/{print $2; exit}'))"
pgrep -x openbox >/dev/null && ok "openbox running" || warn "no window manager — window geometry oracles will misread"
out=$(screenshot /tmp/_doctor.png 2>&1) && [ -s /tmp/_doctor.png ] \
&& ok "screenshot works -> $(identify -format '%wx%h' /tmp/_doctor.png 2>/dev/null || echo ok)" \
|| bad "screenshot failed: $out"
rm -f /tmp/_doctor.png
else
bad "no display on ${DISPLAY:-<unset>}"
fi
echo "── vulkan ──"
if command -v vulkaninfo >/dev/null 2>&1; then
dev=$(vulkaninfo --summary 2>/dev/null | grep -m3 -E 'deviceName' | sed 's/^ *//')
[ -n "$dev" ] && { ok "Vulkan devices:"; echo "$dev" | sed 's/^/ /'; } \
|| bad "vulkaninfo found no device (ICD missing?)"
else
bad "vulkaninfo missing"
fi
# Judge by what enumerated, not by whether a device node is present: an NVIDIA
# card needs the NVIDIA Container Toolkit, and /dev/dri alone does nothing.
case "${dev:-}" in
*llvmpipe*|*lavapipe*)
warn "SOFTWARE Vulkan only — correct but slow."
command -v nvidia-smi >/dev/null 2>&1 \
&& warn " host has an NVIDIA GPU: install nvidia-container-toolkit for hardware" ;;
"") ;;
*) ok "hardware Vulkan" ;;
esac
echo "── project ──"
[ -d /work/xenia-canary ] && ok "/work/xenia-canary" || bad "/work/xenia-canary not mounted"
[ -d /work/Syplheed-Reborn ] && ok "/work/Syplheed-Reborn" || bad "/work/Syplheed-Reborn not mounted"
iso=$(find /work -maxdepth 2 -type f -iname '*.iso' -printf '%s\t%p\n' 2>/dev/null | sort -rn | head -1 | cut -f2-)
[ -n "$iso" ] && ok "ISO: $iso" || warn "no ISO under /work — run-canary needs SYLPH_ISO"
[ -d /work/sylph_extract/dat ] && ok "extracted disc (disc-gated tests will run)" \
|| warn "no extracted disc — Reborn disc tests will SKIP"
[ -w /sylph-home/re/.claude ] && ok "~/.claude writable (token refresh works)" \
|| warn "~/.claude not writable — Claude Code may fail to refresh auth"
echo
[ "$fail" -eq 0 ] && { echo "all good."; exit 0; }
echo "$fail check(s) failed."; exit 1