build(tenant-image): #1791 bundle memory-backfill CLI into tenant image #1796
Reference in New Issue
Block a user
Delete Branch "feat/issue-1791-bundle-memory-backfill"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Bundles the existing
cmd/memory-backfillCLI into the tenant Docker image so an operator can run it directly viadocker execon a tenant EC2. Currently the binary exists in the repo but isn't baked into any image — running the Phase A2 backfill against a production tenant requires either S3-upload + SSM-download, a sidecar container, or building on the host.Mirrors the pattern already in place for
/memory-plugin(which is also a workspace-server-internal CLI bundled into the tenant image since the v2 cutover).Usage post-merge
Per-tenant, idempotent on re-run (the tool upserts on UUID match in the plugin).
Context
Part of the memory-system work chain:
SOP Checklist (RFC #351)
1. Comprehensive testing performed
memory-backfilllocally (GOOS=linux GOARCH=amd64 go build) — 10MB ELF binary produced cleanly./memory-pluginblock right above it, which has shipped in production since the v2 cutover.2. Local-postgres E2E run
N/A. Docker layer change; CI's image-build job is the relevant validation.
3. Staging-smoke verified or pending
Pending. Post-merge + tenant recycle: verify
docker exec molecule-tenant /memory-backfill -dry-runexits 0 and reports counts.4. Root-cause not symptom
The root cause of "operator can't run backfill" was that the binary isn't deployed anywhere reachable. This PR ships it via the existing tenant-image pipeline, which is already the canonical delivery path for workspace-server-internal tooling.
5. Five-Axis review walked
Walked solo. Trivially small change; if anyone wants to challenge the "bundle vs separate image" framing, happy to dispatch a reviewer.
6. No backwards-compat shim / dead code added
Pure addition: +18 LOC in Dockerfile.tenant. The non-tenant Dockerfile (used by Railway controlplane) intentionally does NOT bundle this — controlplane doesn't run the backfill.
7. Memory/saved-feedback consulted
feedback_check_for_parallel_work_before_fix_pr— grep'd Dockerfile.tenant recent commits, no parallel work.🤖 Generated with Claude Code
Phase A2 step 2 prerequisite. The memory-backfill CLI exists in cmd/memory-backfill/ but isn't currently baked into the tenant image, so an operator can't run it directly via docker exec on a tenant EC2. Workarounds (s3-upload + ssm-download, sidecar container, build on host) all add operational friction for what is a one-shot per-tenant backfill. Bundling it follows the same pattern as /memory-plugin (which is also a workspace-server-internal CLI bundled into the tenant image since the v2 cutover). The binary stays inert until invoked — no auto-run on boot. After this lands and tenants recycle, run the backfill with: docker exec molecule-tenant /memory-backfill -dry-run docker exec molecule-tenant /memory-backfill -apply (Per-tenant; idempotent on re-run via UUID upsert in the plugin.) Tracking: parent issue #1791 (Phase A2). Part of the memory-system work that follows #1747 (kill v1 fallback) and #1794 (route POST /memories through plugin).Approving PR #1796: small docker layer change, mirrors /memory-plugin bundling pattern that has shipped in prod. Enables direct docker-exec of the backfill CLI on tenants. CTO-bypass 2026-05-24.
Approving PR #1796: small docker layer change, mirrors /memory-plugin bundling pattern that has shipped in prod. Enables direct docker-exec of the backfill CLI on tenants. CTO-bypass 2026-05-24.