Experiment with Cloudflare devcontainer cache backends#963
Conversation
Experiment ResultsThe Cloudflare cache backend experiments completed successfully in GitHub Actions.
Recommendation: use Cloudflare managed Containers Registry for the production iteration because it preserves the VM agent’s existing registry-oriented Detailed report: Successful experiment run: https://github.com/raphaeltm/simple-agent-manager/actions/runs/25664066831 |
|
SAM devcontainer stress test completed successfully against Cloudflare managed Containers Registry. Run: https://github.com/raphaeltm/simple-agent-manager/actions/runs/25672922644 Key results:
This confirms Cloudflare managed registry handles the real SAM devcontainer image with plain Docker push/pull, not just the earlier 64 MiB synthetic image. I also documented this in docs/notes/2026-05-11-cloudflare-devcontainer-cache-experiments.md. |
|
|
Staging validation completed for PR #963 on 2026-05-11.\n\nDeploy evidence:\n- deploy-staging.yml run 25687373433 succeeded on branch sam/cloudflare-devcontainer-cache-experiments-01krb4.\n- Staging API health returned healthy after deploy.\n- app.sammy.party dashboard/projects/settings returned HTTP 200 with the smoke-test session cookie.\n\nFeature validation:\n- Project: CrewAI (01KJNR9R3TEN3KX1ETE33852R8), repository serverspresentation2025/crewai, workspaceProfile=full.\n- First fresh node 01KRC349V91MW4S8959TVV0Z7B / workspace 01KRC387GS8HHM52YJHS3WT97F: debug package showed cold-cache behavior. The VM agent checked registry.cloudflare.com/c4e4aebd980b626f6af43ac6b1edcede/sam-serverspresentation2025-crewai:devcontainer-cache, found no manifest, built from scratch, marked the workspace running, then logged Cache image pushed successfully at 2026-05-11T18:06:15Z.\n- After stopping the session, the first node/workspace were deleted and confirmed deleted in D1.\n- Second fresh node 01KRC3MDN3ZFMCEX7V1G39NEWR / workspace 01KRC3RA3ED0KAAX2FK1TZW13N: debug package showed warm-cache behavior. The VM agent logged Cache image pulled successfully, Cache hit: pulled devcontainer cache image, and wrote the devcontainer override with cacheFrom=registry.cloudflare.com/c4e4aebd980b626f6af43ac6b1edcede/sam-serverspresentation2025-crewai:devcontainer-cache. Workspace reached running, then cache image pushed successfully again.\n- Second session/node/workspace were stopped/deleted and confirmed deleted in D1.\n\nFollow-up bugs filed in backlog while validating:\n- tasks/backlog/2026-05-11-conversation-task-callback-auth.md: conversation-mode task completion callback returned 401 after agent exit.\n- tasks/backlog/2026-05-11-debug-package-tar-write-too-long.md: debug package generation logged archive/tar: write too long for syslog.log.\n\nVerdict: the Cloudflare managed Containers Registry devcontainer cache path works on staging across a fresh-node cycle. |



Summary
Implements the production Cloudflare managed Containers Registry devcontainer cache path on top of the experiment branch.
Experiment evidence already collected on this PR branch:
Validation
pnpm --filter @simple-agent-manager/shared buildpnpm --filter @simple-agent-manager/providers buildpnpm --filter @simple-agent-manager/cloud-init buildpnpm --filter @simple-agent-manager/api test -- tests/unit/services/devcontainer-cache.test.tspnpm --filter @simple-agent-manager/api typecheckpnpm --filter @simple-agent-manager/api buildpnpm --filter @simple-agent-manager/api lint(passed with existing warnings, 0 errors)pnpm --filter @simple-agent-manager/api exec eslint src/services/devcontainer-cache.ts tests/unit/services/devcontainer-cache.test.ts src/durable-objects/task-runner/workspace-steps.ts src/services/node-agent.tsgo test ./internal/config ./internal/cache ./internal/servergo test ./...inpackages/vm-agentgit diff --checkStaging Verification (REQUIRED for all code changes — merge-blocking)
Staging Verification Evidence
Not completed in this session. The PR must not be merged until staging deployment and infrastructure verification are completed by a human or a follow-up agent run with the required staging credentials and infrastructure access.
UI Compliance Checklist (Required for UI changes)
N/A: no UI changes.
End-to-End Verification (Required for multi-component changes)
Data Flow Trace
apps/api/src/durable-objects/task-runner/workspace-steps.tsand callsgetDevcontainerCacheConfig()beforecreateWorkspaceOnNode().apps/api/src/services/devcontainer-cache.tsreads Worker env, builds a Cloudflare registry ref from the GitHub repo/config path, and mints short-lived registry credentials through Cloudflare's registry credentials API.apps/api/src/services/node-agent.tsserializesdevcontainerCacheinto the VM-agent/workspacesrequest body.packages/vm-agent/internal/server/workspaces.goaccepts the optional cache credentials and stores them in runtime-only workspace state.packages/vm-agent/internal/server/workspace_provisioning.goapplies those credentials to bootstrap config for that workspace only.packages/vm-agent/internal/bootstrap/bootstrap.gologs Docker into the provided registry and uses the explicit cache ref; if explicit Cloudflare config is absent, it falls back to the prior GitHub-token/GHCR behavior.Untested Gaps
Automated coverage verifies API credential request construction, fallback behavior, ref construction, response validation, Go config parsing, explicit cache ref precedence, and redacted Docker login errors. Full live staging verification with real Cloudflare credentials was not run in this session.
Post-Mortem (Required for bug fix PRs)
N/A: not a bug fix.
Specialist Review Evidence (Required for agent-authored PRs)
needs-human-reviewlabel added and merge deferred to human — N/A: all local specialist reviews completedExceptions (If any)
Agent Preflight (Required)
Classification
External References
Official documentation and prior experiment evidence were consulted before coding:
docs/notes/2026-05-11-cloudflare-devcontainer-cache-handoff.mddocs/notes/2026-05-11-cloudflare-devcontainer-cache-experiments.mdCodebase Impact Analysis
This change spans
apps/apiTaskRunner workspace provisioning,apps/api/src/servicesCloudflare credential minting,packages/vm-agentworkspace creation/bootstrap/cache behavior,scripts/deploysecret mapping, and docs/env references. The cache path is full-devcontainer only; lightweight workspace behavior is unchanged.Documentation & Specs
Updated
apps/api/.env.example,apps/api/wrangler.toml,packages/vm-agent/.env.example,scripts/deploy/configure-secrets.sh,docs/guides/self-hosting.md,docs/architecture/secrets-taxonomy.md,.claude/skills/env-reference/SKILL.md, and the Cloudflare devcontainer cache experiment notes.Constitution & Risk Check
Checked Principle XI/no-hardcoded-values and the credential-safety rules. Cloudflare account ID, API token, registry host, repository prefix, credential TTL, and API timeout are configurable; registry passwords are not logged or persisted; missing Cloudflare config preserves fallback behavior.