fix: use step-internal context for debug breakpoints in llamaindex runtime#274
Merged
radu-mocanu merged 1 commit intomainfrom Apr 9, 2026
Merged
Conversation
radugheo
approved these changes
Apr 9, 2026
e96336f to
30d9b31
Compare
the breakpoint wrapper was calling wait_for_event on the workflow-level ExternalContext instead of a per-step InternalContext. this caused ContextStateError on every uipath debug run (uipath run was unaffected because it skips breakpoint injection). fix: create an InternalContext via Context._create_internal(workflow) inside the wrapper, which runs within the step worker where the framework has already set up the required context variables. also adds a pexpect-based integration test (testcases/debug-breakpoints) that exercises single/multiple breakpoints, step mode, and quit against the debug-agent sample.
30d9b31 to
24a0d2b
Compare
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.
Summary
uipath debugwith llamaindex workflows fails withContextStateErroruipath runis unaffected (breakpoint injection is skipped)the error
root cause
the breakpoint wrapper calls
ctx.wait_for_event()to pause a step before execution. this requires aContextinInternalContextstate (the per-step context the framework creates).the old code read
self.contextfrom the workflow instance, which was theExternalContextset by the runtime at_run_workflow()time:the fix
create an
InternalContextviaContext._create_internal(workflow=self)inside the wrapper. this works because the wrapper executes inside the step worker whereStepWorkerStateContextVaris already set:other changes
DebuggableWorkflowprotocol and the runtime code that setdebug_workflow.context(no longer needed)uipath-llamaindexto0.5.9testcases/debug-breakpoints) covering single/multiple breakpoints, step mode, and quitWhy
breakpoints are a core part of the
uipath debugexperience. this regression made debug mode unusable for all llamaindex workflow agents.Llamaindex opened issue: run-llama/llama-agents#505