An open-source, faster Devin alternative
TypeScript
refactor(deploy): scope builder coordinates to Flue profile
Igor Zalutskia09d886963e6
diff --git a/ci/flue-builder-substrate-probe.py b/ci/flue-builder-substrate-probe.pyindex 075782c8..35e47d0c 100755--- a/ci/flue-builder-substrate-probe.py+++ b/ci/flue-builder-substrate-probe.py@@ -27,16 +27,30 @@ STARTER_REF = "5c51d7edbbf2472fbe48386c4f9b192279330c9b"# command was still running, which made its worker-local async handle disappear.SANDBOX_TIMEOUT_SECONDS = 30 * 60FORBIDDEN_CREDENTIAL_NAMES = (+ "V3_DATABASE_URL",+ "AGENTS_DATABASE_URL","OPENCOMPUTER_API_KEY","GITHUB_TOKEN","GH_TOKEN",+ "GITHUB_APP_PRIVATE_KEY",+ "GITHUB_APP_PRIVATE_KEY_BASE64","AGENT_BUILD_SOURCE_TOKEN","AGENT_BUILD_SOURCE_BROKER_SECRET",+ "AGENT_BUILD_BROKER_AUTH_SECRET",+ "AGENT_BUILD_TRIGGER_AUTH_SECRET","AGENT_WORKER_WFP_API_TOKEN",+ "AGENT_WORKER_WFP_ACCOUNT_ID","WFP_API_TOKEN",+ "V3_INTERNAL_AUTH_SECRET",+ "INFISICAL_TOKEN",+ "V3_SECRET_STORE_KEY","CLOUDFLARE_API_TOKEN","R2_ACCESS_KEY_ID","R2_SECRET_ACCESS_KEY",+ "REPO_ARTIFACTS_R2_ACCESS_KEY_ID",+ "REPO_ARTIFACTS_R2_SECRET_ACCESS_KEY",+ "AGENT_BUNDLES_R2_ACCESS_KEY_ID",+ "AGENT_BUNDLES_R2_SECRET_ACCESS_KEY","AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN",@@ -72,10 +86,10 @@ def safe_api_url(raw: str) -> str:except SNAPSHOT.SnapshotError as exc:raise ProbeError(str(exc)) from excparsed = parse.urlsplit(normalized)- if parsed.scheme == "http" and os.environ.get("AGENT_BUILD_PROBE_ALLOW_HTTP") != "1":- raise ProbeError("HTTP API URLs require AGENT_BUILD_PROBE_ALLOW_HTTP=1")- if parsed.hostname in PRODUCTION_HOSTS and os.environ.get("AGENT_BUILD_PROBE_ALLOW_PRODUCTION") != "1":- raise ProbeError("production probing requires AGENT_BUILD_PROBE_ALLOW_PRODUCTION=1")+ if parsed.scheme == "http" and os.environ.get("FLUE_BUILD_PROBE_ALLOW_HTTP") != "1":+ raise ProbeError("HTTP API URLs require FLUE_BUILD_PROBE_ALLOW_HTTP=1")+ if parsed.hostname in PRODUCTION_HOSTS and os.environ.get("FLUE_BUILD_PROBE_ALLOW_PRODUCTION") != "1":+ raise ProbeError("production probing requires FLUE_BUILD_PROBE_ALLOW_PRODUCTION=1")return normalized@@ -106,21 +120,21 @@ class LiveProbe:self.api_url = safe_api_url(require_env("OPENCOMPUTER_API_URL"))self.api_key = require_env("OPENCOMPUTER_API_KEY")self.api = SNAPSHOT.API(self.api_url, self.api_key)- self.checkpoint_id = require_env("AGENT_BUILD_SANDBOX_CHECKPOINT_ID")+ self.checkpoint_id = require_env("FLUE_BUILD_SANDBOX_CHECKPOINT_ID")try:uuid.UUID(self.checkpoint_id)except ValueError as exc:raise ProbeError(- "AGENT_BUILD_SANDBOX_CHECKPOINT_ID must be a UUID from snapshot.py's receipt"+ "FLUE_BUILD_SANDBOX_CHECKPOINT_ID must be a UUID from snapshot.py's receipt") from excexpected = coordinate["attestation"]configured = {- "AGENT_BUILD_SANDBOX_SNAPSHOT": self.snapshot_name,- "AGENT_BUILD_NODE_VERSION": expected["node"]["version"],- "AGENT_BUILD_NPM_VERSION": expected["npm"]["version"],- "AGENT_BUILD_OC_VERSION": expected["oc"]["version"],- "AGENT_BUILD_OC_BINARY_SHA256": expected["oc"]["binarySha256"],+ "FLUE_BUILD_SANDBOX_SNAPSHOT": self.snapshot_name,+ "FLUE_BUILD_NODE_VERSION": expected["node"]["version"],+ "FLUE_BUILD_NPM_VERSION": expected["npm"]["version"],+ "FLUE_BUILD_OC_VERSION": expected["oc"]["version"],+ "FLUE_BUILD_OC_BINARY_SHA256": expected["oc"]["binarySha256"],}for name, expected_value in configured.items():if require_env(name) != expected_value:diff --git a/ci/flue-managed-build-golden.sh b/ci/flue-managed-build-golden.shindex 8ac4c61c..901be8af 100755--- a/ci/flue-managed-build-golden.sh+++ b/ci/flue-managed-build-golden.sh@@ -8,15 +8,15 @@ set -euo pipefail# STARTER_REF=<commit> ./ci/flue-managed-build-golden.shSTARTER_REPO="${STARTER_REPO:-https://github.com/diggerhq/oc-flue-starter.git}"STARTER_REF="${STARTER_REF:-5c51d7edbbf2472fbe48386c4f9b192279330c9b}"-AGENT_BUILD_NODE_VERSION="22.19.0"+FLUE_BUILD_NODE_VERSION="22.19.0"ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"TMP="$(mktemp -d)"trap 'rm -rf "$TMP"' EXITNODE_VERSION="$(node -p 'process.versions.node')"-if [[ "$NODE_VERSION" != "$AGENT_BUILD_NODE_VERSION" ]]; then- echo "managed-build golden requires Node $AGENT_BUILD_NODE_VERSION (found $NODE_VERSION)" >&2+if [[ "$NODE_VERSION" != "$FLUE_BUILD_NODE_VERSION" ]]; then+ echo "managed-build golden requires Node $FLUE_BUILD_NODE_VERSION (found $NODE_VERSION)" >&2exit 1fidiff --git a/ci/test_flue_builder_substrate_probe.py b/ci/test_flue_builder_substrate_probe.pyindex 952bdcc1..9248ce52 100644--- a/ci/test_flue_builder_substrate_probe.py+++ b/ci/test_flue_builder_substrate_probe.py@@ -45,8 +45,8 @@ class SandboxProbeTest(unittest.TestCase):with mock.patch.dict(os.environ,{- "AGENT_BUILD_PROBE_ALLOW_PRODUCTION": "1",- "AGENT_BUILD_PROBE_ALLOW_HTTP": "1",+ "FLUE_BUILD_PROBE_ALLOW_PRODUCTION": "1",+ "FLUE_BUILD_PROBE_ALLOW_HTTP": "1",},clear=True,):diff --git a/deploy/flue-builder/README.md b/deploy/flue-builder/README.mdindex f589246b..2646755f 100644--- a/deploy/flue-builder/README.md+++ b/deploy/flue-builder/README.md@@ -76,8 +76,8 @@ without printing it and run:```bashexport OPENCOMPUTER_API_URL='https://app.opencomputer.dev'export OPENCOMPUTER_API_KEY='...'-export AGENT_BUILD_SNAPSHOT_ALLOW_CREATE=1-export AGENT_BUILD_SNAPSHOT_ALLOW_PRODUCTION=1+export FLUE_BUILD_SNAPSHOT_ALLOW_CREATE=1+export FLUE_BUILD_SNAPSHOT_ALLOW_PRODUCTION=1python3 deploy/flue-builder/snapshot.py create \--confirm-name flue-build-node22-19-0-oc-c39b315-r3 \@@ -87,18 +87,18 @@ python3 deploy/flue-builder/snapshot.py create \The command is idempotent only when an existing snapshot has the exact pinnedmanifest. It never deletes or replaces a snapshot. A mismatch fails andrequires a new snapshot name. Known production hosts require the separate-production guard; local HTTP requires `AGENT_BUILD_SNAPSHOT_ALLOW_HTTP=1`.+production guard; local HTTP requires `FLUE_BUILD_SNAPSHOT_ALLOW_HTTP=1`.Store the receipt in non-secret release metadata. Do not commit environmentfiles or API keys. Configure the build worker from the coordinate and receipt:```text-AGENT_BUILD_SANDBOX_SNAPSHOT=flue-build-node22-19-0-oc-c39b315-r3-AGENT_BUILD_SANDBOX_CHECKPOINT_ID=<receipt checkpointId>-AGENT_BUILD_NODE_VERSION=22.19.0-AGENT_BUILD_NPM_VERSION=10.9.3-AGENT_BUILD_OC_VERSION=oc@c39b31560cb78e0d5708a9eda4cfb30ec372eed9-AGENT_BUILD_OC_BINARY_SHA256=7f7286095aefe78c3027efb79465442070370c6dcf3cda67c9b1315949a42bc1+FLUE_BUILD_SANDBOX_SNAPSHOT=flue-build-node22-19-0-oc-c39b315-r3+FLUE_BUILD_SANDBOX_CHECKPOINT_ID=<receipt checkpointId>+FLUE_BUILD_NODE_VERSION=22.19.0+FLUE_BUILD_NPM_VERSION=10.9.3+FLUE_BUILD_OC_VERSION=oc@c39b31560cb78e0d5708a9eda4cfb30ec372eed9+FLUE_BUILD_OC_BINARY_SHA256=7f7286095aefe78c3027efb79465442070370c6dcf3cda67c9b1315949a42bc1```Worker readiness must compare the live snapshot manifest and checkpoint ID to@@ -124,19 +124,19 @@ and prints only the sandbox ID for operator cleanup.```bashexport OPENCOMPUTER_API_URL='https://app.opencomputer.dev'export OPENCOMPUTER_API_KEY='...'-export AGENT_BUILD_SANDBOX_SNAPSHOT='flue-build-node22-19-0-oc-c39b315-r3'-export AGENT_BUILD_SANDBOX_CHECKPOINT_ID='<receipt checkpointId>'-export AGENT_BUILD_NODE_VERSION='22.19.0'-export AGENT_BUILD_NPM_VERSION='10.9.3'-export AGENT_BUILD_OC_VERSION='oc@c39b31560cb78e0d5708a9eda4cfb30ec372eed9'-export AGENT_BUILD_OC_BINARY_SHA256='7f7286095aefe78c3027efb79465442070370c6dcf3cda67c9b1315949a42bc1'-export AGENT_BUILD_PROBE_ALLOW_PRODUCTION=1+export FLUE_BUILD_SANDBOX_SNAPSHOT='flue-build-node22-19-0-oc-c39b315-r3'+export FLUE_BUILD_SANDBOX_CHECKPOINT_ID='<receipt checkpointId>'+export FLUE_BUILD_NODE_VERSION='22.19.0'+export FLUE_BUILD_NPM_VERSION='10.9.3'+export FLUE_BUILD_OC_VERSION='oc@c39b31560cb78e0d5708a9eda4cfb30ec372eed9'+export FLUE_BUILD_OC_BINARY_SHA256='7f7286095aefe78c3027efb79465442070370c6dcf3cda67c9b1315949a42bc1'+export FLUE_BUILD_PROBE_ALLOW_PRODUCTION=1python3 ci/flue-builder-substrate-probe.py --run```The script refuses known production hosts without the production guard and-refuses HTTP control planes without `AGENT_BUILD_PROBE_ALLOW_HTTP=1`.+refuses HTTP control planes without `FLUE_BUILD_PROBE_ALLOW_HTTP=1`.This proof deliberately tests the repository-deploy feature as a consumer ofOpenComputer's existing public sandbox contract, without feature-specificdiff --git a/deploy/flue-builder/snapshot.py b/deploy/flue-builder/snapshot.pyindex 6ee2bb6a..66d6a41d 100755--- a/deploy/flue-builder/snapshot.py+++ b/deploy/flue-builder/snapshot.py@@ -254,18 +254,18 @@ def create_snapshot(args: argparse.Namespace) -> None:expected_name = coordinate["snapshot"]["name"]if args.confirm_name != expected_name:raise SnapshotError(f"--confirm-name must exactly equal {expected_name}")- if os.environ.get("AGENT_BUILD_SNAPSHOT_ALLOW_CREATE") != "1":- raise SnapshotError("set AGENT_BUILD_SNAPSHOT_ALLOW_CREATE=1 to permit snapshot creation")+ if os.environ.get("FLUE_BUILD_SNAPSHOT_ALLOW_CREATE") != "1":+ raise SnapshotError("set FLUE_BUILD_SNAPSHOT_ALLOW_CREATE=1 to permit snapshot creation")api_url = args.api_url or os.environ.get("OPENCOMPUTER_API_URL", "")if not api_url:raise SnapshotError("provide --api-url or OPENCOMPUTER_API_URL")normalized = normalize_api_url(api_url)parsed = parse.urlsplit(normalized)- if parsed.scheme == "http" and os.environ.get("AGENT_BUILD_SNAPSHOT_ALLOW_HTTP") != "1":- raise SnapshotError("HTTP API URLs require AGENT_BUILD_SNAPSHOT_ALLOW_HTTP=1")- if parsed.hostname in PRODUCTION_HOSTS and os.environ.get("AGENT_BUILD_SNAPSHOT_ALLOW_PRODUCTION") != "1":- raise SnapshotError("production snapshot creation requires AGENT_BUILD_SNAPSHOT_ALLOW_PRODUCTION=1")+ if parsed.scheme == "http" and os.environ.get("FLUE_BUILD_SNAPSHOT_ALLOW_HTTP") != "1":+ raise SnapshotError("HTTP API URLs require FLUE_BUILD_SNAPSHOT_ALLOW_HTTP=1")+ if parsed.hostname in PRODUCTION_HOSTS and os.environ.get("FLUE_BUILD_SNAPSHOT_ALLOW_PRODUCTION") != "1":+ raise SnapshotError("production snapshot creation requires FLUE_BUILD_SNAPSHOT_ALLOW_PRODUCTION=1")api_key = os.environ.get(args.api_key_env, "")if not api_key:@@ -311,7 +311,7 @@ def create_snapshot(args: argparse.Namespace) -> None:raise SnapshotError(f"snapshot ended in status {current.get('status')!r}")write_receipt(Path(args.receipt), current, coordinate)print(f"Snapshot is ready; immutable checkpoint receipt written to {args.receipt}")- print("Set AGENT_BUILD_SANDBOX_CHECKPOINT_ID from that receipt before running the sandbox probe.")+ print("Set FLUE_BUILD_SANDBOX_CHECKPOINT_ID from that receipt before running the sandbox probe.")def parse_args() -> argparse.Namespace: