Skip to content

Let embedders set the output gate timeout - #8879

Merged
danlapid merged 1 commit into
mainfrom
dlapid/output-gate-timeout-hook
Nov 25, 2026
Merged

danlapid merged 1 commit into
mainfrom
dlapid/output-gate-timeout-hook

Conversation

@danlapid

Copy link
Copy Markdown
Collaborator

A Durable Object storage operation that holds the output gate for 30 seconds breaks the gate and resets the object. The 30 seconds was hard-coded in Worker::Actor, so a test that exercises the timeout had to wait it out.

This adds IsolateLimitEnforcer::getOutputGateTimeout(), which defaults to the same 30 seconds, and reads it when the actor is constructed. An embedder can then lower it, for example in tests. Behavior is unchanged for any enforcer that doesn't override it.

🤖 Generated with Claude Code

A Durable Object storage operation that holds the output gate for
30 seconds breaks the gate and resets the object. The 30 seconds was
hard-coded in Worker::Actor, so a test that exercises the timeout had
to wait it out.

Add IsolateLimitEnforcer::getOutputGateTimeout(), which defaults to
the same 30 seconds, and read it when the actor is constructed. An
embedder can then lower it, for example in tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@danlapid
danlapid marked this pull request as ready for review November 25, 2026 00:15
@danlapid
danlapid requested review from a team as code owners November 25, 2026 00:15

@clanky-the-clanker clanky-the-clanker Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💬 Approved with comments — The change is correct and doesn't alter behaviour for enforcers that keep the default. The only note is an INFO: no test yet uses an overridden timeout.

Findings: 1 info (1 is an inline comment on the diff)

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


📋 Code Quality: 💬 1 info

The change is correct and keeps the old behaviour by default; the new hook has no test yet.

Recommendation: 💬 Optional Nits

  • [INFO] New getOutputGateTimeout() hook has no test that an overridden value reaches the actor's output gate. (src/workerd/io/limit-enforcer.h:115)
View full review

The new hook is wired correctly. worker is initialized before impl is constructed, the HooksImpl members are initialized in declaration order, and the 30-second default matches the old hard-coded value. One optional note: nothing yet tests that an overridden timeout is the one the output gate uses.


✅ All other checks passed

🔒 Security: ✅ LGTM

Only embedder code can change the timeout, by overriding a virtual method on the limit enforcer. Worker input never reaches it. The change adds no new way in, and the default stays the same.


📝 Documentation: ✅ LGTM

The comment on the new method describes the current behaviour and keeps the warning about lowering the timeout in production.


Reviewed commit: e3f130a1

Comment thread src/workerd/io/limit-enforcer.h Resolved
@danlapid
danlapid merged commit 515f13c into main Nov 25, 2026
36 of 38 checks passed
@danlapid
danlapid deleted the dlapid/output-gate-timeout-hook branch November 25, 2026 15:18
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.

4 participants