Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
648ea84
task: plan Cloudflare build executor phase 3
raphaeltm Nov 14, 2026
fe4ffa8
feat: fence Cloudflare build capabilities and atomic admission
raphaeltm Nov 14, 2026
27fda15
feat: host publish engine in a single-job DinD builder
raphaeltm Nov 14, 2026
0a66988
feat: wire durable Cloudflare build execution and runtime controls
raphaeltm Nov 14, 2026
fea5cef
test: include builder image in bounded dependency inventory
raphaeltm Nov 14, 2026
80a157d
fix: pin builder command paths and document private transport
raphaeltm Nov 14, 2026
3980277
test: prove builder bootstrap closes before untrusted execution
raphaeltm Nov 14, 2026
c990a08
Merge remote-tracking branch 'origin/main' into sam/implement-phase-3…
raphaeltm Nov 14, 2026
7fe6f49
fix: reserve unique Cloudflare builder migration number
raphaeltm Nov 14, 2026
77b49e2
fix: centralize job token verification and update executor fixtures
raphaeltm Nov 14, 2026
56efdc5
Merge remote-tracking branch 'origin/main' into sam/implement-phase-3…
raphaeltm Nov 15, 2026
f7fb65d
feat: enable approved direct internet access for build containers
raphaeltm Nov 15, 2026
0aa8894
feat: use direct egress with the job-scoped builder trust boundary
raphaeltm Nov 15, 2026
48da5cb
test: verify builder SDK behavior without source assertions
raphaeltm Nov 15, 2026
79fe30c
feat(deployments): expose source publish execution counters
raphaeltm Nov 15, 2026
680c461
fix(deployments): require counted Compose build execution
raphaeltm Nov 15, 2026
addb6d0
docs(deployments): teach agents Instant remote publishing
raphaeltm Nov 15, 2026
4548bc6
Merge main to adopt staging deployment lease enforcement
raphaeltm Nov 15, 2026
7333101
fix(deployments): fence late collector progress after builder admission
raphaeltm Nov 15, 2026
c5772a9
test(deployments): seed legacy executor defaults in callback fixture
raphaeltm Nov 15, 2026
e1ed097
fix: preserve Cloudflare build context permissions and paths
raphaeltm Nov 16, 2026
77f5b69
fix: bound publish callbacks and fence source handoff authority
raphaeltm Nov 16, 2026
4777c59
fix: keep builder deadline shutdown independent and avoid idle wakes
raphaeltm Nov 16, 2026
e1037a8
fix: fence builder reservation retries and drain eligible projects
raphaeltm Nov 16, 2026
9383ae8
fix: retain Cloudflare capacity reservations through deletion
raphaeltm Nov 16, 2026
12372a2
docs: clarify builder reservation deletion and avoid migration collision
raphaeltm Nov 16, 2026
76f3dae
test: execute builder deletion migrations through SQLite helper
raphaeltm Nov 16, 2026
83febdf
test: align deployment fixtures with callback and deletion contracts
raphaeltm Nov 16, 2026
2419d9b
docs(deployments): gate VM Cloudflare opt-in on staging proof
raphaeltm Nov 16, 2026
018a56f
fix(deployments): retire native builder alarms after confirmed stop
raphaeltm Nov 16, 2026
73025ba
docs(deployments): qualify Cloudflare build failure diagnostics
raphaeltm Nov 16, 2026
7c17f18
docs(tasks): record Cloudflare executor staging proof and cleanup
raphaeltm Nov 16, 2026
b741106
Merge remote-tracking branch 'origin/main' into sam/implement-phase-3…
raphaeltm Nov 16, 2026
ab0d236
fix(deploy): bound unconfirmed builder reservation retention
raphaeltm Nov 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/deploy-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,8 @@ jobs:
VM_AGENT_TUNNEL_RESTART_SECONDS: ${{ vars.VM_AGENT_TUNNEL_RESTART_SECONDS }}
SANDBOX_CONTAINER_MAX_INSTANCES: ${{ vars.SANDBOX_CONTAINER_MAX_INSTANCES }}
VM_AGENT_CONTAINER_MAX_INSTANCES: ${{ vars.VM_AGENT_CONTAINER_MAX_INSTANCES }}
DEPLOY_BUILDER_MAX_INSTANCES: ${{ vars.DEPLOY_BUILDER_MAX_INSTANCES }}
DEPLOY_BUILDER_INSTANCE_TYPE: ${{ vars.DEPLOY_BUILDER_INSTANCE_TYPE }}
SANDBOX_ENABLED: ${{ vars.SANDBOX_ENABLED }}
MAX_CONCURRENT_SETUP_SESSIONS: ${{ vars.MAX_CONCURRENT_SETUP_SESSIONS }}
SETUP_SESSION_TTL_MS: ${{ vars.SETUP_SESSION_TTL_MS }}
Expand Down Expand Up @@ -1937,6 +1939,8 @@ jobs:
VM_AGENT_TUNNEL_RESTART_SECONDS: ${{ vars.VM_AGENT_TUNNEL_RESTART_SECONDS }}
SANDBOX_CONTAINER_MAX_INSTANCES: ${{ vars.SANDBOX_CONTAINER_MAX_INSTANCES }}
VM_AGENT_CONTAINER_MAX_INSTANCES: ${{ vars.VM_AGENT_CONTAINER_MAX_INSTANCES }}
DEPLOY_BUILDER_MAX_INSTANCES: ${{ vars.DEPLOY_BUILDER_MAX_INSTANCES }}
DEPLOY_BUILDER_INSTANCE_TYPE: ${{ vars.DEPLOY_BUILDER_INSTANCE_TYPE }}
SANDBOX_ENABLED: ${{ vars.SANDBOX_ENABLED }}
MAX_CONCURRENT_SETUP_SESSIONS: ${{ vars.MAX_CONCURRENT_SETUP_SESSIONS }}
SETUP_SESSION_TTL_MS: ${{ vars.SETUP_SESSION_TTL_MS }}
Expand Down
11 changes: 11 additions & 0 deletions apps/api/Dockerfile.compose-builder
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Phase-0 measured Docker29.9.3 / Compose5.7.0 / Buildx0.38.2.
# Keep the reviewed digest: root DinD with overlayfs, not rootless or vfs.
# Rootful DinD is required by the measured recipe. The isolated, one-job
# Cloudflare microVM is the trust boundary; no broad credential is delivered.
FROM docker.io/library/docker@sha256:08a98015fce594af7c382883bea080ea206de74402a95da9dc52b6428c8cd121
COPY container-artifacts/sam-builder-linux-amd64 /usr/local/bin/sam-builder
COPY container-entrypoints/compose-builder.sh /usr/local/bin/compose-builder
RUN chmod 0755 /usr/local/bin/sam-builder /usr/local/bin/compose-builder
EXPOSE 8080
# docker-init reaps orphaned children and forwards termination to the Go supervisor.
ENTRYPOINT ["docker-init", "--", "/usr/local/bin/compose-builder"]
7 changes: 7 additions & 0 deletions apps/api/container-entrypoints/compose-builder.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
set -eu
# Required by the measured Cloudflare DinD startup recipe.
mountpoint -q /tmp || mount -t tmpfs none /tmp
# Never copy a token, Worker secret or launch payload into the guest environment
# or filesystem. Direct Internet access uses the image's normal trust store.
exec /usr/local/bin/sam-builder
41 changes: 41 additions & 0 deletions apps/api/src/app-deployment-ports/cloudflare-builder.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import {
type CloudflareBuildPorts,
DEFAULT_DEPLOY_BUILDER_MAX_CONCURRENT,
isCloudflareBuildCapacityError,
} from '@simple-agent-manager/app-deployment';

import type { Env } from '../env';
import { parsePositiveInt } from '../lib/route-helpers';
import { resolveAdminSetting } from '../services/admin-settings';
import { recordDeploymentPublishJobLifecycleEventBestEffort } from '../services/project-lifecycle-events';

export function createCloudflareBuildPorts(env: Env): CloudflareBuildPorts {
const stub = (jobId: string) => env.COMPOSE_BUILDER.get(env.COMPOSE_BUILDER.idFromName(jobId));
return {
classMax: parsePositiveInt(
env.DEPLOY_BUILDER_CLASS_MAX_INSTANCES,
DEFAULT_DEPLOY_BUILDER_MAX_CONCURRENT
),
settings: { resolveSetting: (name) => resolveAdminSetting(env, name) },
lifecycle: {
recordPublishJobLifecycleEventBestEffort: (event) =>
recordDeploymentPublishJobLifecycleEventBestEffort(env, event),
},
builder: {
start: async (job) => {
try {
await stub(job.id).startJob(job.id, job.attempt, job.executorNotBefore);
return 'started';
} catch (error) {
// Only platform capacity is retryable queue pressure. Never interpret
// authentication, image/startup errors or a lost RPC as capacity.
if (isCloudflareBuildCapacityError(error)) return 'capacity';
throw error;
}
},
stop: async (job, capacity) => {
await stub(job.id).stopJob(capacity);
},
},
};
}
2 changes: 2 additions & 0 deletions apps/api/src/app-deployment-ports/publish-jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { Env } from '../env';
import { cancelBuildPublishJobOnVm } from '../routes/mcp/workspace-tools';
import { resolveAdminSetting } from '../services/admin-settings';
import { recordDeploymentPublishJobLifecycleEventBestEffort } from '../services/project-lifecycle-events';
import { createCloudflareBuildPorts } from './cloudflare-builder';

export function createDeploymentPublishJobPorts(env: Env): DeploymentPublishJobPorts {
return {
Expand All @@ -13,6 +14,7 @@ export function createDeploymentPublishJobPorts(env: Env): DeploymentPublishJobP
cancelPublishJob: (workspaceId, userId, nodeId, publishJobId, timeoutMs) =>
cancelBuildPublishJobOnVm(env, workspaceId, userId, nodeId, publishJobId, timeoutMs),
},
builder: createCloudflareBuildPorts(env).builder,
lifecycle: {
recordPublishJobLifecycleEventBestEffort: (event) =>
recordDeploymentPublishJobLifecycleEventBestEffort(env, event),
Expand Down
5 changes: 5 additions & 0 deletions apps/api/src/db/migrations/0242_cloudflare_build_executor.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ALTER TABLE deployment_publish_jobs ADD COLUMN executor_instance_id TEXT;
ALTER TABLE deployment_publish_jobs ADD COLUMN executor_deadline_at TEXT;
ALTER TABLE deployment_publish_jobs ADD COLUMN executor_not_before TEXT;
CREATE INDEX idx_publish_job_executor_reservation ON deployment_publish_jobs(executor, executor_instance_id, project_id);
ALTER TABLE deployment_publish_jobs ADD COLUMN context_project_name TEXT;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- D1 is the capacity ledger. Keep even terminal jobs until the microVM stop
-- has been confirmed and its reservation released. Also fences FK cascades.
CREATE TRIGGER cloudflare_build_reservation_no_delete
BEFORE DELETE ON deployment_publish_jobs
WHEN OLD.executor = 'cloudflare' AND OLD.context_shadow = 0
AND OLD.executor_instance_id IS NOT NULL
BEGIN SELECT RAISE(ABORT, 'cloudflare_build_reservation_held'); END;
Loading
Loading