Repository navigation
fix(python): copy metadata in copilotkit_customize_config - #6943
BenTaylorDev merged 7 commits into
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthrough
ChangesPython metadata isolation
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The metadata isolation fix and null handling are covered by regression tests, with no remaining merge-blocking risk identified. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thanks — this is the right fix and the test genuinely fails without it (verified on 3.14 against unpatched main). One addition before merge, borrowed from @AyushCipher's parallel PR #7076: guard the None case. metadata = dict(base_config.get("metadata", {}) or {}) if base_config else {}Without |
190bac0 to
a7365e6
Compare
|
@BenTaylorDev @Zsanz3 I can implement the Since #6943 is on Zsanz3's fork, would you like me to make the change directly on the PR branch if edits are enabled, or should I prepare the commit on my fork for you/Zsanz3 to apply? Happy to handle the change. |
|
@BenTaylorDev Added the metadata = dict(base_config.get("metadata", {}) or {}) if base_config else {}Also covered |
|
@AyushCipher Thanks for offering — the |
`.get("metadata")` aliases the caller's dict, so emit flags leaked
onto later LangChain calls that reused the original config.
Fixes CopilotKit#6941
Co-authored-by: Zsanz3 <[email protected]>
Treat explicit metadata=None as {} so dict() does not raise TypeError.
Co-authored-by: Zsanz3 <[email protected]>
8a5b4cd to
389e6dd
Compare
BenTaylorDev
left a comment
There was a problem hiding this comment.
Verified locally before approving.
Ran the full sdk-python suite on the branch: 241 passed, 12 skipped. Then reverted the one-line guard and re-ran just tests/test_customize_config.py — both new tests fail without it:
test_none_metadata_is_treated_as_empty_dict→TypeError: 'NoneType' object does not support item assignmenttest_shared_metadata_dict_is_not_mutated→ mutation assertion fails
So the coverage is real, not vacuous. CI is green across the full matrix (3.10–3.14 × ag-ui-langgraph 0.0.42–0.0.44).
@AyushCipher — thanks for offering to carry this; #7076 is already closed and nothing further is needed from you here.
Merging.
Fixes #6941
Problem
copilotkit_customize_configaliased the caller'sconfig["metadata"]dict, so writing mute / emit flags mutated shared metadata used by later LangChain calls.Fix
Shallow-copy metadata before writing CopilotKit keys:
Test
sdk-python/tests/test_customize_config.pyasserts a shared metadata dict is not mutated and the returned config still carries the emit keys.Python only; does not touch the JS SDK or #6930.
Summary by CodeRabbit
Bug Fixes
Tests