feat: add shadow LangGraph orchestrator runtime

This commit is contained in:
john
2026-07-24 21:25:40 +08:00
parent 46ea22b342
commit 24336d0178
29 changed files with 3247 additions and 25 deletions
@@ -54,6 +54,11 @@ Native selection.
The initial workflow allowlist contains only `code-run-v1`. Ordinary chat and
existing Goosed session traffic remain outside the Orchestrator path.
Phase 2 implements only the `off` and `shadow` execution semantics. Although
Canary and Active can be configured and evaluated by the control plane, the
Portal does not hand execution ownership to LangGraph yet. This prevents an
administrative configuration mistake from creating two task executors.
## Protocol
The framework-neutral contracts are:
@@ -61,7 +66,7 @@ The framework-neutral contracts are:
- `orchestrator-run-v1`
- `orchestrator-event-v1`
The eventual internal API is:
The implemented internal API is:
```text
POST /v1/runs
@@ -75,13 +80,38 @@ External state changes must use an idempotency key derived from run, graph
version, node, and attempt. Graph state stores resource references and decisions,
not API keys, large logs, binary artifacts, or absolute production paths.
The Phase 2 graph has three deterministic nodes:
```text
validate_run -> build_plan -> finalize_run
```
It requires `policy.executionMode=observe-only` and
`policy.sideEffectsAllowed=false`. It projects the Native executor boundary but
cannot call Goosed, Aider, OpenHands, Tool Gateway, or the filesystem.
## Failure isolation
Portal invokes Shadow only after the product run and its `queued` event have
been committed. The observation is scheduled without awaiting it. A timeout or
failure:
1. cannot reject or delay `createRun`;
2. cannot mutate the Native run status;
3. is projected as `workflow_shadow_failed`;
4. remains removable by deleting the observer wiring and changing only the
service URL boundary.
Successful observations are projected as `workflow_shadow_completed`; graph
checkpoints stay in the Orchestrator-owned PostgreSQL database.
## Deployment evolution
1. Local native Orchestrator process with a development checkpoint database.
2. 103 shadow LaunchAgent; no production task claim.
3. User-allowlisted code-run canary with Native rollback.
4. Isolated Aider/OpenHands executor workers.
5. Containerized Orchestrator in its own Compose project.
1. Local native Orchestrator process with an explicit MemorySaver for debugging.
2. Colima Compose with an isolated PostgreSQL checkpoint database.
3. Approved server-side shadow service; no production task claim.
4. User-allowlisted code-run canary with Native rollback.
5. Isolated Aider/OpenHands executor workers.
6. Move the same service contract to Linux or Kubernetes when horizontal scaling
or independent ownership becomes necessary.