Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
c61d8a2
docs(flow-d): add Lambda MicroVM substrate diagram doc
elamaran11 Jul 29, 2026
a7e4530
docs(flow-d): add Flow D section + TOC/flows-table entries to dark-fa…
elamaran11 Jul 29, 2026
46a16a7
feat(flow-d): add self-managed ack-lambdamicrovms controller addon (d…
elamaran11 Jul 29, 2026
7ea85c4
feat(flow-d): add KRO MicrovmSandbox RGD tying all MicroVM primitives
elamaran11 Jul 29, 2026
7390cf6
feat(flow-d): add lambda-microvm SandboxTemplate + bridge (the Runtim…
elamaran11 Jul 29, 2026
8f6a081
feat(flow-d): add dormant microvm block to hub agent-sandbox overlay
elamaran11 Jul 29, 2026
8c77e60
docs(flow-d): move ACK GA-list citation + capability-ownership split …
elamaran11 Jul 30, 2026
ddb2ef2
fix(flow-d): correct RGD to real Lambda MicroVM API (verified live)
elamaran11 Jul 30, 2026
a7c4b8a
feat(flow-d): fill hub overlay with real MicroVM values
elamaran11 Jul 30, 2026
8582eb4
feat(flow-d): add suspend/resume via Sandbox.operatingMode (microvm-l…
elamaran11 Jul 30, 2026
fb3e3bf
docs(flow-d): document Sandbox.operatingMode suspend/resume mechanism
elamaran11 Jul 30, 2026
72f2541
feat(coder): emit a PR change-description alongside verification
elamaran11 Jul 30, 2026
6078c18
fix(security-agent): early-exit when findings ready + graceful timeout
elamaran11 Jul 30, 2026
0a3d7c0
feat(flow-d): label-branched pipeline — darkfactory-lambda -> MicroVM…
elamaran11 Jul 31, 2026
05a07d4
feat(flow-d): suspend/resume demo — suspend MicroVM after coder pushes
elamaran11 Jul 31, 2026
f04719f
fix(flow-d): align MicrovmSandbox RGD with ACK controller best practices
elamaran11 Jul 31, 2026
0d368b4
refactor(flow-d): split Lambda MicroVM into its own agent-sandbox-lam…
elamaran11 Jul 31, 2026
26fe342
feat(flow-d): enforce suspend→resume→terminate lifecycle (VM persists…
elamaran11 Jul 31, 2026
9037e5f
docs(flow-d): update design for image-only KRO + shim-run VM + suspen…
elamaran11 Jul 31, 2026
575ae48
feat(flow-d): controller IAM via ACK (all-GitOps) + enable on hub
elamaran11 Jul 31, 2026
c3ac0c6
Merge commit '47b8908c91d87747c722d78d83782e216797000f' into flow-d-l…
Aug 1, 2026
ba514ac
feat(flow-d): re-apply df-run orchestration onto reverted #32 (old/wo…
Aug 1, 2026
1e7227d
fix(flow-d): sync-wave the RGD before its MicrovmSandbox instance
Aug 3, 2026
8b81ed1
fix(agent-sandbox): allow coder DNS egress to public resolvers
Aug 3, 2026
dfdca56
fix(dark-factory): retain completed workflows 7d (was 1h)
Aug 3, 2026
aaaaff6
fix(flow-d): use kro.run apiGroup + grant KRO graph child RBAC
Aug 3, 2026
70c2fdc
fix(flow-d): quote operands in microvm-suspend when-expression
Aug 3, 2026
ee5d6ff
fix(dark-factory): default microvmSuspend off (Flow D only)
Aug 3, 2026
82daaa1
fix(flow-d): scope controller iam:PassRole by target ARN, drop servic…
Aug 3, 2026
8c9a08d
fix(flow-d): controller needs lambda:PassNetworkConnector for image b…
Aug 3, 2026
e32a08d
fix(flow-d): point codeArtifactUri at the RGD-created bucket
Aug 3, 2026
556e7c7
fix(flow-d): name the bridge container 'coder' for claim-injection pa…
Aug 3, 2026
6a97fed
fix(flow-d): allow bridge egress to the K8s API server
Aug 3, 2026
df957cd
fix(flow-d): bridge/lifecycle image needs aws-cli v2 (has lambda-micr…
Aug 3, 2026
8a16250
fix(flow-d): hub overlay bridgeImage → aws-cli v2 (was pinning alpine…
Aug 3, 2026
2cebef5
fix(flow-d): allow bridge egress to EKS Pod Identity endpoint
Aug 3, 2026
2c7738d
fix(flow-d): bridge SANDBOX_NAME from downward API (was df-<issue> mi…
Aug 3, 2026
7911579
fix(flow-d): re-enable microvmSuspend (hub runs both substrates)
Aug 3, 2026
e56dd91
docs(flow-d): design for running the coder inside the MicroVM
Aug 3, 2026
27ee2b5
feat(flow-d): lambda-coder — Bedrock-direct + /run hook wrapper
Aug 3, 2026
7369d1b
feat(flow-d): bridge passes runHookPayload (issue ctx + gh token) to …
Aug 3, 2026
6e7070b
fix(flow-d): build runHookPayload with python3, not node
Aug 3, 2026
72d8501
fix(flow-d): single-line python3 payload builder (YAML block-scalar fix)
Aug 3, 2026
cfcb258
docs(flow-d): record in-VM build attempt + confirmed /run-hook blocker
Aug 3, 2026
f0e12fd
feat(flow-d): bridge creates Microvm CR + payload Secret (fires /run)
Aug 3, 2026
00195a5
docs(flow-d): Microvm CR path reconciles + VM runs, /run hook still s…
Aug 3, 2026
d0bc733
docs(flow-d): E2E run #106 report — chain works to /run, 2 gaps isolated
Aug 3, 2026
cc6d33c
feat(flow-d): bridge drives /run + runtime CloudWatch logs + ingress …
Aug 4, 2026
601a0c3
fix(flow-d): grant lambda:CreateMicrovmAuthToken (bridge drives /run)
Aug 4, 2026
9ff9018
feat(flow-d): observable coder — /status endpoint + bridge polls it
Aug 4, 2026
426d069
chore(flow-d): bump codeArtifactUri to -r2 to force image rebuild
Aug 4, 2026
8e18fb4
fix(flow-d): minimal hook-server (drop /status) + artifact r3
Aug 4, 2026
a84cb38
feat(flow-d): /logs endpoint + capture coder output to file (observab…
Aug 4, 2026
d48d707
fix(flow-d): set WORKSPACE=/tmp/workspace (coder crashed EACCES on /w…
Aug 4, 2026
7c2f950
fix(flow-d): df-iterate routes fix round to originating substrate
Aug 4, 2026
63526e5
fix(flow-d): remove microvm-suspend from df-run DAG; bridge owns suspend
Aug 4, 2026
405f2a1
docs(flow-d): substrate benchmark + diagrams (Kata vs Lambda MicroVM)
Aug 4, 2026
8089bc9
fix(flow-d): bump bridge memory 128Mi→1Gi (was OOMKilled mid fix-round)
Aug 4, 2026
3ec7fb3
fix(flow-d): forward df-iterate note into the MicroVM coder
Aug 4, 2026
4b088b8
fix(flow-d): fresh MicroVM per fix round (terminate stale suspended VM)
Aug 4, 2026
879347e
fix(flow-d): real CRD-driven suspend/resume across the fix loop
Aug 4, 2026
d9bed02
fix(flow-d): keep VM on suspend — annotation selector + Sandbox-exist…
Aug 4, 2026
8148300
fix(flow-d): one Sandbox per VM — stable claim naming by issue-number
Aug 4, 2026
b05e9ff
refactor(flow-d): separate df-run-lambda; restore df-run to certified…
Aug 4, 2026
d73ef79
feat(flow-d): route darkfactory-lambda → df-run-lambda + workflow IAM…
Aug 4, 2026
c69b3ac
docs(flow-d): update benchmark + diagrams for separate df-run-lambda
Aug 4, 2026
809cbae
fix(df-merge): only count agent findings on the CURRENT head sha
Aug 4, 2026
2457dfa
fix(df-merge): match inline findings by original_commit_id (exclude c…
Aug 4, 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
106 changes: 106 additions & 0 deletions docs/dark-factory/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ spokes as normal deployments.
2. [Two flows at a glance](#2-two-flows-at-a-glance)
3. [Flow A — Agent Sandbox capability](#3-flow-a--agent-sandbox-capability-permanent-platform-feature)
4. [Flow B — the Dark Factory pipeline](#4-flow-b--the-dark-factory-pipeline)
- [Flow D — Lambda MicroVM substrate (alternative to Flow A)](#45-flow-d--lambda-microvm-substrate-alternative-to-flow-a)
5. [The pluggable coding assistant](#5-the-pluggable-coding-assistant)
6. [Independent verification](#6-independent-verification-the-heart-of-the-pattern)
7. [Live status in the PR](#7-live-status-in-the-pr)
Expand Down Expand Up @@ -84,6 +85,15 @@ useful on its own and the factory is a consumer of it.
> an isolated VM). The Dark Factory is one *consumer* of that capability. Keeping them separate
> means the isolation substrate can ship, be tested, and be reused independently of the factory.

> **Flow D — a second substrate.** Flow A's isolation boundary is a **Kata micro-VM pod** on a
> platform-owned nested-virt node group. **Flow D** offers an *alternative* Flow-A substrate — an
> **AWS Lambda MicroVM** (serverless micro-VM, no node group) provisioned via the ACK `lambdamicrovms`
> controller and composed by a single **KRO `ResourceGraphDefinition`**. Flow B is unchanged and can
> target either substrate through the same `SandboxClaim` contract. See
> [§4.5](#45-flow-d--lambda-microvm-substrate-alternative-to-flow-a) and
> [`diagrams/flow-d-microvm-sandbox.md`](diagrams/flow-d-microvm-sandbox.md). *(Flow C is reserved for
> other work.)*

> **Why the hub, not a spoke?** The Dark Factory is a **pre-dev build/author** activity: it *writes*
> code and needs GitHub write access. That belongs on the **hub — the control/build plane** — not on
> a spoke, which is the **deploy/run plane** hosting real enterprise workloads (putting a
Expand Down Expand Up @@ -256,6 +266,102 @@ UI — the substrate for scaling across many concurrent issues.

---

## 4.5. Flow D — Lambda MicroVM substrate (alternative to Flow A)

> 📊 **See the diagrams:** [`diagrams/flow-d-microvm-sandbox.md`](diagrams/flow-d-microvm-sandbox.md)
> (substrate architecture + platform/app ownership split + the RuntimeClass-shim bridge).

Flow A's isolation boundary is a **Kata micro-VM pod** on a platform-owned nested-virt node group.
**Flow D is a second Flow-A substrate**: an **AWS Lambda MicroVM** — a *serverless* micro-VM with no
node group to run or pay for while idle, per-claim lifecycle, and sub-second warm starts. Flow B is
unchanged: it still creates a `SandboxClaim`, a pod still shows up, and the **same `dark-factory-coder`**
runs its coding/testing loop — except the coder executes inside a Lambda MicroVM. *(Flow C is reserved
for other work; this substrate is Flow D.)*

### How it's built — KRO RGD over ACK primitives

| Layer | Mechanism | Notes |
|---|---|---|
| **Composition** | **Managed KRO** (EKS Capability) + one `MicrovmSandbox` `ResourceGraphDefinition` | One CR expands into the IMAGE primitives below (built once); the running `Microvm` is NOT in the graph — the shim runs it imperatively |
| **GA primitives** | **Managed ACK** (EKS Capability) — `iam` Role, `s3` Bucket | AWS-run; the image store + build/exec roles |
| **Image primitive** | **Self-managed ACK** — the pre-GA `lambdamicrovms` controller | `MicrovmImage` CRD (`lambdamicrovms.services.k8s.aws/v1alpha1`); the `Microvm` is created via SDK by the shim, not as a graph resource |

> **Why self-managed for the MicroVM controller?** Managed ACK bundles only controllers whose service
> is **GA upstream** (see the [ACK community services / GA list](https://aws-controllers-k8s.github.io/community/docs/community/services/)).
> `lambdamicrovms` is **pre-GA** (`v1alpha1`, not on that list), so it isn't in Managed ACK yet — it
> runs as its own GitOps addon. **Managed ACK + self-managed lambdamicrovms coexist** (different CRD
> groups → no conflict). When `lambdamicrovms` goes GA, delete the self-managed addon and Managed ACK
> adopts it — **the RGD is unchanged**. This "install both now" posture is deliberate and futuristic.
>
> The **Managed KRO + Managed ACK capabilities themselves** are enabled at the platform layer in the
> **appmod-blueprints** repo (an EKS Capability toggle) — see that repo's
> `docs/EKS-Capabilities-KRO-ACK-Setup.md`. This repo owns only the **self-managed `lambdamicrovms`
> controller + the KRO `MicrovmSandbox` RGD + the sandbox shim** (Flow D).

### The split: KRO builds the image ONCE; the shim runs the VM per session

This is the load-bearing design decision (and it matches the ACK controller's own guidance —
image build is slow/declarative, running a VM is fast/imperative):

- **Platform image — declarative, built ONCE by KRO/ACK.** The `MicrovmSandbox` RGD
(`agent-sandbox-lambda/templates/image/`) composes only the slow-changing infra: `MicrovmImage`
(`baseImageARN`, `buildRoleARN`, `codeArtifact.uri` — an **S3 zip** of the arm64 `dark-factory-coder`
+ a Dockerfile) plus its **build role**, **execution role**, and **S3 artifact bucket** (ACK GA
controllers). A **single committed `MicrovmSandbox` instance** (GitOps-applied) is reconciled once;
KRO gates the handoff on a successful build (`readyWhen state == CREATED||UPDATED`). Its status
surfaces `imageARN` + `executionRoleARN`. The RGD **does not** contain a `Microvm`.
- **Per-session VM — imperative, driven by the shim.** Running a MicroVM (`RunMicrovm`), and its
`suspend` / `resume` / `TerminateMicrovm`, are request-time SDK ops the ACK controller does **not**
reconcile. So the shim owns them — never a `Microvm` CR per claim.

### The RuntimeClass shim (claim → pod → MicroVM)

A literal K8s `RuntimeClass` (like `kata-clh`) maps to a **node-local containerd handler**; Lambda
MicroVM is a **remote AWS service**, so a true node-level RuntimeClass would require a virtual-kubelet
provider (a large Go runtime — **out of scope**). Flow D instead ships a **`lambda-microvm`
SandboxTemplate variant** (`agent-sandbox-lambda/templates/shim/`) whose pod is a lightweight
**bridge**: on claim it **reads the platform image handoff** (`imageARN` + `executionRoleARN` from the
one built `MicrovmSandbox`) and calls **`RunMicrovm`** (SDK) to launch this session's VM, records the
`microvmID` as an annotation on the owning `Sandbox`, and holds the pod so its lifecycle mirrors the
MicroVM's. On real teardown it calls `TerminateMicrovm`. To Flow B and the user the UX is identical to
Flow A. Interactive exec/attach passthrough is **best-effort**; full fidelity is a virtual-kubelet follow-up.

### Suspend / resume / terminate — the coder VM persists across the review loop

Because the substrate is a Lambda MicroVM (not a pod), Flow D uses **suspend/resume through the Agent
Sandbox CRD** to keep the coder's context across the whole review→fix→re-review loop — the payoff of
this substrate over Kata (where each fix round claims a fresh pod):

1. **Coder finishes the coding task → SUSPEND** (`df-run` flips `Sandbox.operatingMode=Suspended`; the
`microvm-lifecycle` reconcile loop calls `suspend-microvm` by the annotated id). Compute is freed;
the VM's memory/disk are snapshotted.
2. DevOps + Security agents review the PR while the coder is suspended.
3. **Findings + "fix" → RESUME the SAME VM** (df-iterate sets `operatingMode=Running` → `resume-microvm`).
Context intact — no cold re-implement.
4. Coder fixes → SUSPEND again; loop 2–4 until both agents clear.
5. **Final exit (merge) → TERMINATE** (`df-merge-teardown` calls `TerminateMicrovm`, then deletes the
claim). This is the **only** place the VM is destroyed — `df-run`'s onExit is substrate-aware and
**keeps** the suspended Lambda VM (unlike Kata, which frees its pod on df-run exit).

The ACK `Microvm` has no suspend field, so the `microvm-lifecycle` loop supplies the intent→SDK
translation — pure shim, no virtual-kubelet. See
[`diagrams/flow-d-microvm-sandbox.md` §D.3a](diagrams/flow-d-microvm-sandbox.md).

### Delivery & status

Shipped as GitOps in its **own chart** — `gitops/addons/charts/agent-sandbox-lambda/` (separate from
the Kata `agent-sandbox` chart), structured as `templates/image/` (KRO RGD + the one platform
`MicrovmSandbox`) and `templates/shim/` (bridge SandboxTemplate + warm pool + `microvm-lifecycle`
controller). **Disabled by default** (`microvm.enabled=false`); the hub overlay
(`clusters/hub/addons/agent-sandbox-lambda/values.yaml`) carries cluster-specific values, and a gated
`agent-sandbox-lambda` addon entry deploys it hub-only. The platform-capability enablement (Managed ACK
+ Managed KRO) lands separately in the **appmod-blueprints** platform repo (they're EKS Capabilities,
like the Managed ArgoCD the hub already runs). This PR delivers the **design + GitOps scaffold**; the
live end-to-end path (enable capabilities → sync controller → publish the arm64 artifact → run a MicroVM
coder with suspend/resume) is the follow-up.

---

## 5. The pluggable coding assistant

The coder is behind a **thin, swappable interface** — a deliberate choice (the industry lesson is
Expand Down
Loading