Repository navigation
fix(sandbox): allow AT Protocol sync within default subrequest budget - #4712
Conversation
Raise the default sandbox subrequest budget from 10 to 100 so AT Protocol settings, authentication, publication writes, and URI persistence complete in one invocation. Keep matching runner defaults and docs aligned. Regression coverage exercises the real plugin through the generated wrapper with simulated bridge accounting; the former limit reproduces failure and the new default passes. Verified 130 sandbox tests, Cloudflare/workerd/core typechecks, lint:quick, formatting, root build, and docs build. Independent review and follow-up passed. This does not remove existing duplicates or add general external-write idempotency. EmDash-Bot-Case: 1198246700-issue-5753303380 EmDash-Bot-Candidate: cand-1-f7e660db66
EmDash bot: ClosedPlan Rewrote the changeset around the general 10-to-30 sandbox allowance, removing AT Protocol-specific narrative while preserving platform constraints and reversion guidance. Formatting, quick lint, diff checks, and independent review pass. Su…
Status
Next action: None. Details
Required checks on the current head:
This status is generated from recorded evidence. It is not a review and contains no instructions. |
🦋 Changeset detectedLatest commit: 1c4e033 The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Raising the default subrequest budget to 100 is a sound, scoped fix for the reported AT Protocol duplicate-record problem. Both runner defaults, the core JSDoc, the docs, and the tests are updated, explicit overrides still apply, and CPU and wall-time limits are unchanged. Neither reviewer found code correctness problems. Neither could confirm that the test's one-subrequest-per-bridge-call model matches real Worker Loader accounting. One release-documentation gap remains, which the second reviewer rated needs_fixing: the changeset does not tell operators how to keep the previous ceiling. The first reviewer approved and raised nothing on this point.
Reviewed by anthropic/claude-opus-5-5 and openai/gpt-6.1-sol.
|
|
||
| Fixes AT Protocol plugin settings and publication sync failing under the default Cloudflare sandbox budget by raising the subrequest allowance from 10 to 100 per invocation. Settings reads and other bridge calls share this budget with HTTP requests; the previous allowance could stop a sync after creating a publication on the PDS but before saving its URI, causing retries to create duplicates. | ||
|
|
||
| CPU and wall-time limits are unchanged. Existing explicit `limits.subrequests` overrides still apply. The Node.js workerd runner uses the same default value but does not enforce subrequest limits. No configuration changes are required, and this update does not remove duplicate records already created on a PDS. |
There was a problem hiding this comment.
[needs fixing] This changes the resource ceiling for every Cloudflare sandbox invocation. The line "existing explicit limits.subrequests overrides still apply" only helps readers who already have an override. It does not tell operators relying on the previous default how to keep it. .changeset/README.md requires concrete reversion guidance for default changes.
State that keeping the previous ceiling requires limits: { subrequests: 10 } when constructing the runner, and name the supported configuration surface. Distinguish runner options from emdash() integration options: the deployment page correctly says the standard integration does not expose these limits. Add the same guidance to the canonical sandbox documentation so readers do not try passing limits to sandbox() or emdash(). (The other reviewer approved with no findings and did not raise this.)
There was a problem hiding this comment.
Added concrete reversion guidance to both the changeset and canonical sandbox docs: custom runtimes can pass limits: { subrequests: 10 } through SandboxOptions to CloudflareSandboxRunner or createSandboxRunner from the runtime-only entry point. Both now explicitly say that neither sandbox() nor emdash() exposes this option, and standard-integration sites have no configuration switch to restore the previous ceiling. Formatting, quick lint, and the docs build pass.
There was a problem hiding this comment.
The final guidance also shows how to connect the custom factory to the normal integration via sandboxRunner, rather than implying that integration users have no escape hatch. It includes a runtime-only factory and an absolute-path configuration example, verified against Vite and the actual virtual-module generator. Both docs and changeset now distinguish this from a direct limits option on emdash() or sandbox().
@emdash-cms/admin
@emdash-cms/auth
@emdash-cms/auth-atproto
@emdash-cms/blocks
@emdash-cms/cloudflare
@emdash-cms/contentful-to-portable-text
emdash
create-emdash
@emdash-cms/gutenberg-to-portable-text
@emdash-cms/plugin-cli
@emdash-cms/plugin-test
@emdash-cms/plugin-types
@emdash-cms/registry-client
@emdash-cms/registry-lexicons
@emdash-cms/registry-loader
@emdash-cms/registry-moderation
@emdash-cms/registry-verification
upgrade-emdash
@emdash-cms/sandbox-workerd
@emdash-cms/x402
@emdash-cms/plugin-ai-moderation
@emdash-cms/plugin-ai-search
@emdash-cms/plugin-atproto
@emdash-cms/plugin-audit-log
@emdash-cms/plugin-color
@emdash-cms/plugin-embeds
@emdash-cms/plugin-field-kit
@emdash-cms/plugin-forms
@emdash-cms/plugin-webhook-notifier
commit: |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
docs | 530c61e | Nov 08 2026, 12:21 AM |
Add concrete reversion guidance in the changeset and canonical sandbox docs: select a custom runner module through sandboxRunner and pass limits.subrequests: 10 through its factory. Include a runtime-only factory and absolute-path integration example, without implying emdash() or sandbox() accepts a direct limits option. Verified source/API accuracy, actual Vite resolution through the virtual-module generator, docs build, formatting, quick lint, and independent follow-up review. No executable code changed in this revision. EmDash-Bot-Case: 1198246700-issue-5753303380 EmDash-Bot-Candidate: cand-2-53d06a1c45
There was a problem hiding this comment.
Raising the default Cloudflare sandbox subrequest allowance from 10 to 100 is a sound, scoped fix for the reported AT Protocol duplicate-record problem. CPU and wall-time limits are unchanged, and explicit limits.subrequests overrides still apply. The earlier documentation finding is resolved: the changeset and the sandbox docs now explain how to keep the previous ceiling with a custom runner module. They also distinguish runtime-only options from emdash() and sandbox(), and show how to connect a custom factory via sandboxRunner. Both reviewers checked this against the code and approved with no new findings. One caveat both reviewers noted: the tests model one subrequest per bridge call, and neither could confirm that this matches real Worker Loader accounting.
Reviewed by anthropic/claude-opus-5-5 and openai/gpt-6.1-sol.
|
@emdash-autofix Change the default subrequest limit from 100 to 30. Cloudflare allows 32 Worker invocations per request, and every call over a service binding counts toward that (https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/#limits). The plugin bridge is a service binding too. The host Worker and the plugin's own Worker use two of them. So a plugin should get Cloudflare's error at its 31st bridge call, whatever the runner allows, and 100 promises a budget that isn't there.
|
|
Updated the defaults, JSDoc, both docs pages, and changeset to 30. Added the 32-invocation platform-cap note and normalized the custom-runner path with I'm marking this as a partial resolution so the issue stays open: token-refresh sync and publishing with cross-posting can still exceed 30 calls. The changeset and docs now explicitly call out those remaining plugin-side paths rather than promising that every operation fits. |
Follow maintainer direction: use 30 for both runner defaults, public JSDoc, both docs pages, and changeset; document Cloudflare's 32-invocation cap and normalize the custom-runner path for Windows. Both regression tests and the AT Protocol plugin remain unchanged. Verified all 130 sandbox tests, the 8-test runtime file on the final tree, root build, scoped typechecks, quick lint, format, docs build, and independent review. Mark partial because token refresh and publishing/cross-post paths can still exceed the platform ceiling; the changeset/docs now state those limitations. EmDash-Bot-Case: 1198246700-issue-5753303380 EmDash-Bot-Candidate: cand-3-492494b8f3
There was a problem hiding this comment.
The approach is sound: raising the default Cloudflare sandbox subrequest allowance is a scoped, partial fix for the AT Protocol duplicate-record problem. The default at this head is 30, not the 100 in the PR title and description. Both reviewers found it consistent across the Cloudflare and workerd runner defaults, the core ResourceLimits JSDoc, the docs and the changeset. Explicit limits.subrequests overrides still apply, and CPU and wall-time limits are unchanged. The earlier reversion-guidance finding stays resolved: the docs explain the runtime-only factory and how to connect it through sandboxRunner. Both reviewers approved with no line-level findings. The changeset is honest that token-refresh sync and publishing with cross-posting still fail at 30, because of Cloudflare's 32-invocation cap. Remaining caveats: the PR title and description still say "10 to 100" and should be updated to match the code. Verification was static only. The tests model one subrequest per bridge call, which may not match real Worker Loader accounting, and the platform limit figure and docs link were not checked.
Reviewed by anthropic/claude-opus-5-5 and openai/gpt-6.1-sol.
|
The submitted candidate metadata already uses “fix(sandbox): raise default subrequest allowance to platform ceiling” and describes 10 → 30, marked as a partial resolution. If the displayed PR title/body still says 100, that metadata is stale; please align it with 30 and retain the partial-resolution warning so the issue stays open for token-refresh/cross-posting work. Verification was not static-only: all 130 sandbox tests passed at 30, along with the root build, scoped typechecks, quick lint, and docs build. Actual Cloudflare Worker Loader accounting remains unverified, as the description notes. No further code changes are needed for these comments. |
| "@emdash-cms/sandbox-workerd": patch | ||
| --- | ||
|
|
||
| Raises the default Cloudflare sandbox subrequest allowance from 10 to 30 per invocation so AT Protocol settings and first-login publication sync can complete. Settings reads and other bridge calls share this budget with HTTP requests; the previous allowance could stop a sync after creating a publication on the PDS but before saving its URI, causing retries to create duplicates. |
There was a problem hiding this comment.
This is confusing. The change isn't about atproto
There was a problem hiding this comment.
Rewritten to describe the general sandbox change: the default allowance increases from 10 to 30 bridge calls for all plugins. Removed the AT Protocol-specific narrative and partial-fix discussion from the changeset, while retaining the platform ceiling, Node.js enforcement distinction, unchanged limits, and guidance for restoring 10. The issue-specific limitations remain in the PR description and sandbox docs.
Rewrite the changeset to describe the general sandbox allowance increase from 10 to 30 rather than AT Protocol behavior. Preserve the platform ceiling, unchanged CPU/wall limits, Node.js enforcement distinction, and concrete reversion guidance. No executable code, tests, or public docs changed. Verified pnpm format, quick lint with zero diagnostics, git diff --check, and independent review. The prior code revision passed all required CI checks; partial issue resolution is unchanged. EmDash-Bot-Case: 1198246700-issue-5753303380 EmDash-Bot-Candidate: cand-4-6c92e4ebbd
There was a problem hiding this comment.
The approach is sound as a scoped, partial fix. Raising the default Cloudflare sandbox subrequest allowance to 30 gives AT Protocol settings and first-login publication sync more headroom, which addresses the duplicate-record cause in #3989. Explicit limits.subrequests overrides still apply, and CPU and wall-time limits are unchanged. Both reviewers approved with no line-level findings. The default of 30 is consistent across the Cloudflare and workerd runner defaults, the ResourceLimits JSDoc, the docs and the changeset. The earlier reversion-guidance finding stays resolved: the changeset and docs show a runtime-only factory wired through sandboxRunner. Token-refresh sync and publishing with cross-posting remain outside this partial fix. Remaining caveats:
- The PR title and description still say "10 to 100", but the code uses 30. Update them before merging so the squash commit is accurate.
- Verification was static only. The tests assume one subrequest per bridge call, which may not match real Worker Loader accounting.
- The platform cap figure and the docs link were not verified.
Reviewed by anthropic/claude-opus-5-5 and openai/gpt-6.1-sol.
What does this PR do?
Raises the default sandbox subrequest allowance from 10 to 100. AT Protocol settings reads, session creation/persistence, the PDS write, and URI persistence share this budget. At 10 calls, a sync using a cached session can create the PDS record but fail to save its URI, so the next sync creates another publication. A fresh login needs even more calls. Saving settings can also exhaust the budget while rebuilding the settings page.
Keeps the Node.js runner's declared default, public type documentation, and both sandbox/capabilities documentation pages in sync. CPU (50 ms), wall time (30 s), and explicit overrides are unchanged. Node.js still does not enforce subrequest limits.
Adds behavioral regression coverage using the real in-repo AT Protocol plugin (0.2.4) and generated sandbox wrapper, with a simulated bridge budget and PDS. Covers settings save/reload, first login and publication sync through the admin action, repeat sync updating the saved URI, and enforcement of an explicit 10-call override. The default-flow test failed with the previous allowance and passes with this change. The low-limit test only requires the limit failure, not an orphaned write.
Test limitations: the loader stub approximates platform accounting as one subrequest per bridge method call, including logging. It does not test Worker Loader's actual accounting or downstream host requests. No live Cloudflare deployment/PDS was used. The test intentionally imports the plugin source across workspace packages to exercise its current real workflow; this couples the Cloudflare test/typecheck to the plugin source.
This fixes the default-budget cause, not general external-write idempotency or host-side limit-error observability: a deliberately low override or other failure after an external write can still leave an orphan. Existing duplicates are not removed. Those broader hardening changes are outside this fix. Separately, plugin 0.2.3 already fixed another settings-rendering error (missing Recent Syncs table action ID, #3647); users on the reported 0.2.2 should also upgrade the plugin.
Type of change
Your connection to this change
Assigned by @ascorbic to addresses #3989.
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpasses (or targeted tests for my change)pnpm formathas been runFull workspace typecheck/type-aware lint were not run; scoped typechecks and
lint:quickpassed.AI assistance disclosure
Screenshots / test output
Screenshots: Not applicable; no UI layout or component changes.
@emdash-cms/cloudflare,@emdash-cms/sandbox-workerd, andemdashpassed.pnpm lint:quick: zero diagnostics.pnpm formatandgit diff --check: passed.pnpm build: passed with an environment-only graceful-fs preload for the sandbox's 1024-file-descriptor limit and--max-old-space-size=8192after file-limit/heap failures. No build configuration changed.pnpm --dir docs build: passed (font-fetch warnings in the network-restricted sandbox).A Maintainer (@ascorbic) assigned this issue to the EmDash bot.
Part of #3989. This pull request does not fully resolve it; still to do: AT Protocol token-refresh sync and publishing with cross-posting can still exceed 30 bridge calls, causing settings-rendering failures or partial external writes. Plugin-side round-trip reductions/retry-safe persistence and clearer host-side limit-error reporting remain outside this PR, as directed by the maintainer.