## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Agents execute inside sandboxed runtime containers built from `docker/agent-runtime/Dockerfile.base` > - OpenCode's skill tooling shells out to ripgrep; when `rg` is not on PATH it tries to download a pinned build from `github.com/BurntSushi/ripgrep/releases` at run time > - In a sandbox with locked-down egress that download hangs ~127s and then fails, burning run budget on every agent run before the agent reaches its actual work > - The root repo `Dockerfile` already installs ripgrep; the agent-runtime base image drifted without it > - This pull request adds `ripgrep` to the base image's apt install so OpenCode uses the system binary and never reaches for the network > - The benefit is that every sandboxed agent run stops wasting ~2 minutes on a doomed download and spends its budget on real work ## Linked Issues or Issue Description No existing issue — problem described here per the bug report template: - **What happened:** Sandboxed agent runs using OpenCode stall for ~127 seconds at startup, then log `Transport error ... BurntSushi/ripgrep/releases/download/...` before continuing degraded. - **Expected behavior:** The agent starts working immediately; skill tooling finds `rg` on PATH. - **Root cause:** The agent-runtime base image (`docker/agent-runtime/Dockerfile.base`) does not ship ripgrep, so OpenCode falls back to downloading a pinned build at run time, which egress-restricted sandboxes block. - **Reproduction:** Run any OpenCode-backed agent in a sandbox with locked-down egress using the current agent-runtime image; observe the startup hang and transport error. Supersedes #8859. ## What Changed - Added `ripgrep` to the existing `apt-get install --no-install-recommends` list in `docker/agent-runtime/Dockerfile.base` - Added an explanatory comment documenting why ripgrep must be present (run-time download fallback + egress-restricted sandboxes), restoring parity with the root repo `Dockerfile` ## Verification - `docker build -f docker/agent-runtime/Dockerfile.base .` then `docker run --rm <image> rg --version` — prints the ripgrep version from the system package - Run an OpenCode-backed agent in an egress-restricted sandbox on the new image: no `BurntSushi/ripgrep` download attempt, no ~127s startup stall ## Risks - Low risk: no behavior change beyond shipping one additional apt package in the base image; slightly larger image size > For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and discuss it in `#dev` before opening the PR. Feature PRs that overlap with planned core work may need to be redirected — check the roadmap first. See `CONTRIBUTING.md`. ## Model Used - Claude (Anthropic), model ID `claude-fable-5` (Fable 5), agentic coding via Claude Code with tool use; original change authored with Claude Opus 4.8 (1M context) and re-based/re-verified with Fable 5 ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| Dockerfile.base | ||
| Dockerfile.claude | ||
| Dockerfile.codex | ||
| Dockerfile.gemini | ||
| Dockerfile.hermes | ||
| Dockerfile.opencode | ||
| Dockerfile.pi | ||
| README.md | ||
| buildx-bake.hcl | ||
README.md
Agent Runtime Image Family
Container images for running coding-agent harnesses in sandboxed environments (for example the kubernetes sandbox provider, stage 1 of the k8s contribution). Images are named agent-runtime-{harness}:{version} and published to ghcr.io/paperclipai/ by the agent-runtime-images workflow. The registry is overridable: every reference flows through the REGISTRY bake variable.
Image Lineup
agent-runtime-base: Foundation. Ubuntu 22.04 + Node 22 + git + tini + non-root user (uid 1000) + the agent shim.agent-runtime-opencode: Extends base withopencode-aiglobally installed.agent-runtime-pi: Extends base with@mariozechner/pi-coding-agent.agent-runtime-codex: Extends base with@openai/codex.agent-runtime-gemini: Extends base with@google/gemini-cliplus headless auth-mode settings.agent-runtime-claude: Extends base with@anthropic-ai/claude-code(symlinked asclaude-code).agent-runtime-hermes: Dockerfile included in the bake group, not in the default publish scope (stub until a CLI package exists).
Base Image Contents
OS & Runtime:
- Ubuntu 22.04
- Node.js 22 (via NodeSource APT repo)
- git
- tini (PID-1 init, ensures signal propagation)
- Non-root user
paperclip(uid/gid 1000)
Paperclip Binaries:
/usr/local/bin/paperclip-agent-shim: Go binary compiled fromtools/agent-shim/. Reads/run/paperclip/runtime-command.jsonandsyscall.Execs the harness CLI.
Defaults:
USER: 1000:1000 (paperclip, non-root)WORKDIR:/workspace(mount workspace volumes here)ENTRYPOINT:/usr/bin/tini --(PID-1 reaper, forwards signals)CMD:/usr/local/bin/paperclip-agent-shim
Building Locally
All targets build linux/amd64 by default (see buildx-bake.hcl). Derived images chain off the base target through bake contexts, so the literal registry in each FROM line is overridden at build time and the whole family builds in one pass without pushing intermediates.
docker buildx bake -f docker/agent-runtime/buildx-bake.hcl --load
Custom tag or registry
REGISTRY=myregistry VERSION=mytag \
docker buildx bake -f docker/agent-runtime/buildx-bake.hcl --load
Quickstart Smoke Test
Build and verify the agent-runtime-claude image runs locally:
docker buildx bake -f docker/agent-runtime/buildx-bake.hcl base claude --load
docker run --rm ghcr.io/paperclipai/agent-runtime-claude:dev claude-code --version
Agent Container (paperclip-agent-shim)
The main agent process runs as the shim (PID 1 under tini). The shim:
- Reads
/run/paperclip/runtime-command.json(path overridable via-spec), a JSON file mounted by whatever schedules the run - Parses
{ "command", "args" }: the harness CLI and arguments - Resolves the command on PATH and
syscall.Execs it, replacing itself - SIGTERM from the kubelet propagates directly to the harness (no zombie processes)
runtime-command.json Contract:
{
"command": "claude-code",
"args": ["--token", "xyz", "--workspace", "/workspace"]
}
The shim makes no assumptions about command structure; it is harness-agnostic. New harnesses swap the command/args; the base image stays the same.
Security Model
- Non-root execution: user 1000:1000, no capability grants
- PSS Restricted compatible: no privileged containers, no host mounts; works with a read-only root filesystem (writable
/workspace+/tmpmounts) - No secrets baked in: API tokens and credentials come from per-run ephemeral Secrets mounted as env vars or files
- Image signing: cosign keyless OIDC in the publish workflow
Publishing
.github/workflows/agent-runtime-images.yml builds and pushes the default scope (base, opencode, pi, codex, gemini, claude) on workflow_dispatch (with an explicit version tag) or on pushes to master touching these paths, then signs each digest with cosign keyless OIDC.