Skip to content

fix: Ensure that ctx and env __init__ arguments are always wrapped#131

Merged
hoodmane merged 1 commit into
cloudflare:mainfrom
hoodmane:hoodmane/fix-wrap-init-args
Jul 1, 2026
Merged

fix: Ensure that ctx and env __init__ arguments are always wrapped#131
hoodmane merged 1 commit into
cloudflare:mainfrom
hoodmane:hoodmane/fix-wrap-init-args

Conversation

@hoodmane

Copy link
Copy Markdown
Contributor

We fixed the double-wrapping problem in #126 but added a new problem that ctx and env args in subclasses won't be wrapped at all. This switches to wrapping all init functions but making DurableObjectContext and _EnvWrapper idempotent so that double wrapping them is not possible.

Comment thread packages/runtime-sdk/src/workers/_workers.py
Comment thread packages/runtime-sdk/src/workers/_workers.py
Comment thread packages/runtime-sdk/src/workers/_workers.py
@hoodmane hoodmane force-pushed the hoodmane/fix-wrap-init-args branch 2 times, most recently from 7bdfe04 to 39cb7de Compare June 30, 2026 17:36

@ryanking13 ryanking13 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks. could you add a testcase that wasn't covered by the previous patch?

@hoodmane

hoodmane commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

The updates to the test suite did not pass before the change.

We fixed the double-wrapping problem in cloudflare#126 but added a new problem that ctx
and env args in subclasses won't be wrapped at all. This switches to wrapping
all __init__ functions but making DurableObjectContext and _EnvWrapper
idempotent so that double wrapping them is not possible.
@hoodmane hoodmane force-pushed the hoodmane/fix-wrap-init-args branch from 39cb7de to f76e9f1 Compare July 1, 2026 22:32
@hoodmane hoodmane merged commit 465c702 into cloudflare:main Jul 1, 2026
8 checks passed
@hoodmane hoodmane deleted the hoodmane/fix-wrap-init-args branch July 1, 2026 23: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.

2 participants