Conversation
A class-based action that declares `__context` (or `__tracer`) in its run signature has that parameter name-mangled by Python, e.g. to `_MyAction__context`. The sync run path remaps the injected input to the mangled name, but the async run path and both multi-step streaming paths passed `__context=` as-is, so the action failed with `TypeError: run() got an unexpected keyword argument '__context'`. Apply the same remap in `_arun_function` and in the sync and async multi-step streaming runners. Generated-by: Claude Code (Claude Opus 5.5) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Class-based actions can take the injected
__context(or__tracer) as arunparameter, but that only works on the sync, non-streaming path. Anasync def run(self, state, __context)action, or aStreamingAction/AsyncStreamingActionwhosestream_runtakes__context, fails when it runs:Inside a class body, Python name-mangles
__contextto_ClassName__context. #449 and #452 fixed this for_run_functionby remapping the injected inputs to the mangled names with_remap_dunder_parameters._arun_function,_run_multi_step_streaming_actionand_arun_multi_step_streaming_actionstill pass__context=unchanged.Changes
burr/core/application.py: add a small_remap_injected_inputs(method, inputs)helper that wraps the existing check-and-remap from_run_function. Call it in_run_function(behavior unchanged),_arun_function, and the sync and async multi-step streaming runners, onstream_run.runtakes**run_kwargs, so no parameter name ends in__contextand the inputs pass through unchanged.tests/core/test_application.py: three end-to-end regressions that build an app with a class-based action reading__context.app_id. They go throughastep(),stream_result()andastream_result().How I tested this
main(8161159), the three new tests fail with theTypeErrors above.pytest tests/core: 403 passed (with thegraphvizpackage installed; without it, only the existing graphviz display tests fail, the same as onmain).--line-length=100), isort 5.12.0 and flake8 6.1.0 at the pre-commit pins are clean on the changed files.git diff --checkis clean.Notes
run()path has had the remap since late 2024 (Fixes __context for classed based actions #449 / Fixes __tracer for class based actions #452). This change brings the async and streaming class APIs to parity. The single-step internal classes (SingleStepAction,SingleStepStreamingAction) are documented as not user-facing, so I left them alone to keep the change focused.Checklist
_remap_injected_inputsis a private helper with a docstring)__contextdocs)AI disclosure (per the ASF Generative Tooling guidance): an AI coding tool (Claude Code, Claude Opus 5.5) wrote this change through the
breken-aiaccount. The tool found the bug, wrote the fix and the tests, and wrote this description. The commit carries aGenerated-by:trailer. The diff is a small original change to existing Burr code and includes no third-party material. The red/green runs above are real, and you can re-run them from the diff. If you would rather not take AI-assisted contributions here, say so and I will close this.🤖 Generated with Claude Code