support async context for mutable proxies#6691
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e0d0b19a90
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Greptile SummaryThis PR adds
Confidence Score: 5/5Safe to merge — the changes are well-scoped to the proxy layer, no state-manager or serialization logic is touched, and the existing test suite is augmented with six targeted async tests including edge-case recovery scenarios. Path tracking is logically consistent across all access methods and the exception-safety issues from earlier review rounds have been resolved. No new unsafe patterns were introduced. No files require special attention. Important Files Changed
Reviews (11): Last reviewed commit: "Optimize dataclass mutable proxy cache" | Re-trigger Greptile |
Merging this PR will improve performance by 9.3%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ⚡ | test_var_access[mutable_list] |
70.9 ms | 64.8 ms | +9.3% |
Tip
Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.
Comparing harsh21234i:fix/mutable-proxy-async-context-6689 (a3bfa51) with main (9a5c4d3)
Footnotes
-
8 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
|
Addressed the review feedback in d8f12f3. Changes made:
Checks passed:
|
|
@codspeedbot fix this regression |
|
hey can you go through this @masenf @FarhanAliRaza |
FarhanAliRaza
left a comment
There was a problem hiding this comment.
Thanks — the overall design here is solid: delegating to the bound StateProxy, replaying a recorded access path on the refreshed state, and poisoning iteration-sourced proxies so they fail loudly is the right shape, and the exception paths are carefully handled and tested. Tests, ruff, and pyright all pass locally.
Requesting changes for one confirmed correctness bug (reproduced locally): proxies returned by dict.get()/setdefault() carry their parent's access path, so async with on them silently rebinds the proxy to the parent container — in the worst case writes land in the wrong container with no error. Details inline, along with a few smaller comments.
|
hey @FarhanAliRaza Changes made:
|
Fixes #6689
Summary
ImmutableMutableProxy
context
async with proxyTesting
test_state.py::test_immutable_mutable_proxy_async_context_manager tests/
units/test_state.py::test_rebind_mutable_proxy tests/units/istate/
test_proxy.py -q
upstream/main