An open-source, faster Devin alternative
TypeScript
test(webhooks): igor-dev e2e stack + deploy --delete fix
Igor Zalutskie6893bb64aaf
diff --git a/.agents/work/sandbox-webhooks-rearchitecture.md b/.agents/work/sandbox-webhooks-rearchitecture.mdindex 98bb30dc..c6a720cd 100644--- a/.agents/work/sandbox-webhooks-rearchitecture.md+++ b/.agents/work/sandbox-webhooks-rearchitecture.md@@ -373,6 +373,38 @@ everything is prefixed `…-igor-dev`. The path under test:Delete the two workers + D1 + R2 (or leave, clearly labeled). Optionally delete dev Svix apps by`uid` prefix.+### 8.6 Results (2026-06-24) — STOOD UP + PASSED+Live stack in Mo's acct `b8f23cb87a7a6c64040d3134643da448`: D1 `opencomputer-igor-dev`+(`d5bbb12a-…`), R2 `events-archive-igor-dev`, workers `opencomputer-events-ingest-igor-dev` ++`opencomputer-api-edge-igor-dev` (dev tomls: `events-ingest/wrangler.igor-dev.toml`,+`api-edge/wrangler.igor-dev.toml`). Validated end-to-end against **real Svix Cloud**:+- **Delivery path** (synthetic HMAC `/ingest` batch, no box): HMAC verify; `sandbox.*` filter;+ dormancy gate both ways (`has_webhooks` 1→delivers, 0→0 Svix msgs even with an app present);+ createMessage→Svix→webhook.site attempt status=0; envelope = SDK+ `WebhookDelivery<SandboxLifecycleEvent>` + `svix-*` headers; eventId `:`→`.` sanitize + raw-id+ idempotency dedup.+- **Management/inline** (api-edge): API-key auth (401 on bad key); POST/GET/PATCH `/api/webhooks`+ (create returns secret once, writes Svix endpoint + D1 row + flips `has_webhooks`); `/test`,+ `/deliveries` (Svix attempt index lags ~5–8 s; status 0→`success`), `/redeliver`; HMAC+ `/internal/webhooks/register` → channel-scoped endpoint (`channels=[sandboxId]`).+- **Real CP lifecycle** (branch deployed to the box): live sandbox `sb-2a8594a9` →+ `sandbox.created` + `sandbox.ready` + `sandbox.stopped` all delivered; box outbox drains to 0+ after each (relay deletes after publish — the transient-outbox guarantee).++**Deploy gotchas (for next time):** (1) the deploy `rsync` needed `--delete` (now added) or+in-branch-deleted files linger on the box and break the build. (2) pass+`INSTANCE_NAME=opensandbox-qemu-dev-igor` (the script default doesn't match this box, and the+mismatch aborts the deploy *after* it stops services). (3) the box PG had migration **v49** already+applied (old 4-table 049) — for the table rename, drop the old `webhook_*`/`sandbox_lifecycle_*`+tables + `DELETE FROM schema_migrations WHERE version=49` so the renamed 049 re-creates+`sandbox_lifecycle_outbox`. (4) with `OPENSANDBOX_CF_EDGE_BASE_URL` set, the CP resolves *templates*+via the edge (`LookupTemplate`→D1, empty here) → "template not found"; blank it on the box to use+local public templates (the lifecycle path via `CF_EVENT_ENDPOINT` is independent).++**Optional follow-ups (non-blocking):** §8.4 #3 inline-on-create via the *live* CP (seed D1+templates + re-wire the edge URL on the box); §8.4 #5 durable-handoff 503-retry (break the Svix+token, confirm the forwarder PEL retries).+## 9. References- Shipped design + decision log: `sandbox-lifecycle-webhooks.md` (same dir). PR body: `/tmp/pr410_body.md`.diff --git a/cloudflare-workers/api-edge/wrangler.igor-dev.toml b/cloudflare-workers/api-edge/wrangler.igor-dev.tomlnew file mode 100644index 00000000..e6fe3e2d--- /dev/null+++ b/cloudflare-workers/api-edge/wrangler.igor-dev.toml@@ -0,0 +1,37 @@+# api-edge — one-off `igor-dev` dev stack for the sandbox-webhooks+# rearchitecture e2e (PR #410), Milestone D (management + inline). Lives in+# **Mo's CF account b8f23cb8**. STRIPPED vs prod: no public routes, no SPA+# [assets] (no ./assets dir in-repo), no autumn cron [triggers], no tail_consumer+# (Axiom log-tail is prod-only), no SESSIONS_KV (the webhooks + api-key-auth path+# is pure D1 — webhooks.ts reads only EVENT_SECRET, OPENCOMPUTER_DB,+# SVIX_API_TOKEN). The CreditAccount DO is kept (self-contained, off the webhook+# path) so the worker's `export { CreditAccount }` has a matching migration.+# Deploy with:+# wrangler deploy --config wrangler.igor-dev.toml+# wrangler secret put EVENT_SECRET --config wrangler.igor-dev.toml # == events-ingest-igor-dev EVENT_SECRET+# wrangler secret put SVIX_API_TOKEN --config wrangler.igor-dev.toml+# See .agents/work/sandbox-webhooks-rearchitecture.md §8.++name = "opencomputer-api-edge-igor-dev"+main = "src/index.ts"+compatibility_date = "2026-04-28"+compatibility_flags = ["nodejs_compat"]+account_id = "b8f23cb87a7a6c64040d3134643da448"++[[d1_databases]]+binding = "OPENCOMPUTER_DB"+database_name = "opencomputer-igor-dev"+database_id = "d5bbb12a-0491-4a95-9d7d-32ed8c3ce15d"++# CreditAccount DO is self-hosted by this worker (script_name defaults to self).+[[durable_objects.bindings]]+name = "CREDIT_ACCOUNT"+class_name = "CreditAccount"++[[migrations]]+tag = "v1"+new_sqlite_classes = ["CreditAccount"]++[vars]+WORKER_ENV = "igor-dev"+BURST_CELL_ID = ""diff --git a/cloudflare-workers/events-ingest/wrangler.igor-dev.toml b/cloudflare-workers/events-ingest/wrangler.igor-dev.tomlnew file mode 100644index 00000000..48c78868--- /dev/null+++ b/cloudflare-workers/events-ingest/wrangler.igor-dev.toml@@ -0,0 +1,28 @@+# events-ingest — one-off `igor-dev` dev stack for the sandbox-webhooks+# rearchitecture e2e (PR #410). Lives in **Mo's CF account b8f23cb8** (the local+# CLOUDFLARE_API_TOKEN/OAuth can reach it). STRIPPED vs prod: no CreditAccount DO+# binding (free-tier debit is off the webhook path; usage_tick debit would log a+# harmless waitUntil error and never blocks the 202) and no tail_consumer (the+# Axiom log-tail service only exists in the prod account). Deploy with:+# wrangler deploy --config wrangler.igor-dev.toml+# wrangler secret put EVENT_SECRET --config wrangler.igor-dev.toml+# wrangler secret put SVIX_API_TOKEN --config wrangler.igor-dev.toml+# See .agents/work/sandbox-webhooks-rearchitecture.md §8.++name = "opencomputer-events-ingest-igor-dev"+main = "src/index.ts"+compatibility_date = "2026-04-28"+compatibility_flags = ["nodejs_compat"]+account_id = "b8f23cb87a7a6c64040d3134643da448"++[[d1_databases]]+binding = "OPENCOMPUTER_DB"+database_name = "opencomputer-igor-dev"+database_id = "d5bbb12a-0491-4a95-9d7d-32ed8c3ce15d"++[[r2_buckets]]+binding = "EVENTS_ARCHIVE"+bucket_name = "events-archive-igor-dev"++[vars]+WORKER_ENV = "igor-dev"diff --git a/deploy/gcp/deploy-qemu-dev.sh b/deploy/gcp/deploy-qemu-dev.shindex b9c86037..d10528bb 100755--- a/deploy/gcp/deploy-qemu-dev.sh+++ b/deploy/gcp/deploy-qemu-dev.sh@@ -216,7 +216,10 @@ cmd_deploy() {log "Deploying branch '$branch' to $public_ip..."log "Syncing code..."- rsync -az --progress \+ # --delete mirrors the tree so files removed in the local branch (e.g. a+ # deleted .go file) are also removed on the box. Without it, a stale source+ # file referencing now-deleted symbols lingers and breaks the on-box build.+ rsync -az --progress --delete \-e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i $SSH_KEY" \--exclude '.git' --exclude 'bin/' --exclude 'node_modules/' \--exclude '.claude/' --exclude '*.ext4' \