Skip to content

feat(triggers): persist isolated Standard allocation - #5624

Merged
pandemicsyn merged 1 commit into
mainfrom
feat/trigger-isolated-standard-allocation
Aug 28, 2026
Merged

feat(triggers): persist isolated Standard allocation#5624
pandemicsyn merged 1 commit into
mainfrom
feat/trigger-isolated-standard-allocation

Conversation

@pandemicsyn

@pandemicsyn pandemicsyn commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Summary

PR 2 of the three-PR Dedicated Standard trigger rollout, following merged #5520.

  • Persist optional sandboxAllocation: "isolated-standard" in TriggerDO SQLite and its existing KV configuration mirror. Generated Durable SQLite migration 0004_bumpy_firebird adds nullable sandbox_allocation; existing rows remain Automatic. No shared PostgreSQL migration.
  • Accept the allocation only for Cloud Agent targets in both webhook and scheduled modes. Updates validate the authoritative stored target: omission preserves the value, null clears it, and isolated-standard sets it. Direct DO calls are guarded too.
  • Reload current trigger configuration during queue consumption and forward the value only to trusted prepareSession; omit it for Automatic. Queue messages and captured request payloads are unchanged.
  • Leave browser mutation/router/client inputs and UI untouched. KiloClaw execution behavior is unchanged.

Verification

Manual local smoke exercised real webhook and scheduled execution through Docker sandboxes and completion callbacks, plus clearing allocation back to Automatic. Two isolated webhook runs, a fresh scheduled run, and the Automatic run completed. The first scheduled attempt allocated correctly but failed with an unresolved wrapper_no_output runtime stall. Full evidence and limitations: #5624 (comment)

No deployed production or UI tests were run; no services were deployed.

Automated checks

  • pnpm --filter cloudflare-webhook-agent-ingest test — 115 tests passed.
  • pnpm --filter cloudflare-webhook-agent-ingest test:integration — 36 tests passed using real Durable Object SQLite.
  • pnpm --filter cloudflare-webhook-agent-ingest typecheck — passed.
  • pnpm --filter cloudflare-webhook-agent-ingest lint — passed, zero warnings/errors.
  • Package format check, targeted formatting/checks including integration tests and migration artifacts, integration-file lint, and git diff --check — passed.
  • Migration regressions cover 0002→0003 and 0003→0004 row preservation. Tests cover set/hydrate/preserve/clear, NULL Automatic, invalid persisted values, both activation modes, stored-target validation, omitted forwarding, and unchanged KiloClaw dispatch. No live PostgreSQL was required.

Visual Changes

N/A

Reviewer Notes

  • Deploy the Cloud Agent capability from feat(cloud-agent-next): add isolated Standard allocation #5520 before this worker forwards allocation intent. Keep the later PR 3 feature flag disabled until all participating services are deployed.
  • PR 3 will add server-side PostHog eligibility, authorized web mutation inputs, and the Automatic/Dedicated Standard selector.
  • Existing Cloud Agent containment, Standard SKU billing, and fail-closed restrictions remain authoritative. Explicit allocation still does not support workspace_* control-plane sessions.
  • Configuration edits affect future session creations; already-queued requests may observe current configuration. This does not strengthen the existing split prepareSession/request-association idempotency guarantees.
  • SQLite is authoritative and written before the retained KV mirror. These remain separate operations; this PR does not replace the mirror or claim transactional atomicity between them.

@kilo-code-bot

kilo-code-bot Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (12 files)
  • services/webhook-agent-ingest/drizzle/0004_bumpy_firebird.sql
  • services/webhook-agent-ingest/drizzle/meta/0004_snapshot.json
  • services/webhook-agent-ingest/drizzle/meta/_journal.json
  • services/webhook-agent-ingest/drizzle/migrations.js
  • services/webhook-agent-ingest/src/db/sqlite-schema.migration.test.ts
  • services/webhook-agent-ingest/src/db/sqlite-schema.ts
  • services/webhook-agent-ingest/src/dos/TriggerDO.ts
  • services/webhook-agent-ingest/src/queue-consumer.test.ts
  • services/webhook-agent-ingest/src/queue-consumer.ts
  • services/webhook-agent-ingest/src/routes/api.test.ts
  • services/webhook-agent-ingest/src/routes/api.ts
  • services/webhook-agent-ingest/test/integration/trigger-do.test.ts

Reviewed by grok-4.6 · Input: 239.7K · Output: 13K · Cached: 377.7K

Review guidance: REVIEW.md from base branch main

@pandemicsyn

Copy link
Copy Markdown
Contributor Author

Manual local smoke — 2026-08-27

Ran the real local webhook Worker → TriggerDO → delivery queue → Cloud Agent service binding → Docker sandbox → wrapper/CLI → completion callback path. Used a disposable local user/profile, an existing authorized GitHub App installation with read-only use of a small public repository, and kilo/fake-deterministic through the real local Next.js gateway. No PR 3/browser changes or production deployment were required.

Case Observed result
Webhook execution 1 Completed; istd-* identity; owned Docker Sandbox container dcdbc50b0449; request callback success and message completed.
Webhook execution 2 Completed; different istd-* identity and different container 99db047e436e. An unrelated prompt edit preserved allocation.
First actual scheduled alarm Real alarm created a SCHEDULED request and allocated an istd-* / Sandbox container. Execution subsequently failed with wrapper_no_output / post_dispatch_no_activity; no fake-inference request arrived.
Fresh scheduled retry Real alarm fired at 22:35:39 UTC; completed in distinct istd-* / Sandbox container 89be0b91ecf4, with request callback success and message completed. No product-code changes between attempts.
Clear allocation with null Readback omitted allocation; next webhook completed using ses-* and SandboxSmall container bace39498381, matching local Automatic policy.

Caveat: this was not a completely clean first-pass smoke. The first scheduled execution hit an unresolved runtime stall after successful allocation and prompt acceptance. The wrapper SDK stream ended and the no-output watchdog eventually failed the message; a fresh scheduled run passed. This is not enough evidence to assign the stall to allocation or rule out a separate runtime issue.

Boundaries: validates real configuration propagation, container identity/class, execution, real cron firing, and callback completion. It does not validate production Cloudflare CPU/RAM/disk limits, actual billing charges, PR 3 authorization/UI, or containment-enabled execution (local containment flags remained disabled). The driver was temporary/manual, reusing the Cloud Agent E2E helpers; no permanent webhook E2E harness was added.

Cleanup verified: three triggers deleted; all five sessions deleted; owned sandbox/proxy containers stopped; no fake-inference waiters; smoke user/profile/integration/CLI session rows removed. Original four-service core dev stack restored. Working tree remains clean.

@pandemicsyn
pandemicsyn merged commit 726b8ab into main Aug 28, 2026
17 checks passed
@pandemicsyn
pandemicsyn deleted the feat/trigger-isolated-standard-allocation branch August 28, 2026 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants