fix(backend/blocks): propagate tool credentials in Orchestrator dispatch - #13178
fix(backend/blocks): propagate tool credentials in Orchestrator dispatch#13178kcze wants to merge 2 commits into
Conversation
…spatch (OPEN-3132) OrchestratorBlock dispatches tool calls directly via on_node_execution, bypassing the normal graph queue dispatch in manager._on_graph_execution where graph_exec.nodes_input_masks gets merged into the queued node's inputs. As a result, tool blocks launched from Library or AutoPilot — where credentials live in nodes_input_masks rather than node.input_default — ran without their credentials and failed with a missing-credentials error. Expose nodes_input_masks on the ExecutionProcessor and read+merge the sink-node mask in _execute_single_tool_with_manager before upserting inputs. Also forward the masks to on_node_execution so downstream dispatch behaves the same as the normal queue path.
🔍 PR Overlap DetectionThis check compares your PR against all other open PRs targeting the same branch to detect potential merge conflicts early. 🔴 Merge Conflicts DetectedThe following PRs have been tested and will have merge conflicts if merged after this PR. Consider coordinating with the authors.
🟢 Low Risk — File Overlap OnlyThese PRs touch the same files but different sections (click to expand)
Summary: 2 conflict(s), 0 medium risk, 3 low risk (out of 5 PRs with file overlap) Auto-generated on push. Ignores: |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
✅ Files skipped from review due to trivial changes (1)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
🧰 Additional context used📓 Path-based instructions (5)autogpt_platform/backend/**/*.py📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
autogpt_platform/backend/backend/blocks/**/*.py📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
autogpt_platform/backend/**/test/**/*.py📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
autogpt_platform/{backend,autogpt_libs}/**/*.py📄 CodeRabbit inference engine (AGENTS.md)
Files:
autogpt_platform/backend/**/test_*.py📄 CodeRabbit inference engine (autogpt_platform/AGENTS.md)
Files:
🧠 Learnings (15)📚 Learning: 2026-02-05T04:11:00.596ZApplied to files:
📚 Learning: 2026-03-16T16:32:21.686ZApplied to files:
📚 Learning: 2026-04-23T12:55:26.122ZApplied to files:
📚 Learning: 2026-02-26T17:02:22.448ZApplied to files:
📚 Learning: 2026-03-05T15:42:08.207ZApplied to files:
📚 Learning: 2026-03-16T16:30:11.452ZApplied to files:
📚 Learning: 2026-03-16T16:30:23.196ZApplied to files:
📚 Learning: 2026-03-16T16:30:11.452ZApplied to files:
📚 Learning: 2026-03-16T16:35:40.236ZApplied to files:
📚 Learning: 2026-03-19T15:10:50.676ZApplied to files:
📚 Learning: 2026-03-31T15:37:38.626ZApplied to files:
📚 Learning: 2026-04-15T02:43:36.890ZApplied to files:
📚 Learning: 2026-04-22T11:46:04.431ZApplied to files:
📚 Learning: 2026-04-22T11:46:12.892ZApplied to files:
📚 Learning: 2026-05-07T18:48:14.242ZApplied to files:
🔇 Additional comments (3)
WalkthroughExecutionProcessor exposes per-node ChangesCredential mask propagation through orchestrator tool dispatch
Sequence Diagram(s)sequenceDiagram
participant Client
participant OrchestratorBlock
participant ExecutionProcessor
participant ToolExecutor
Client->>OrchestratorBlock: trigger tool dispatch (sink_node)
OrchestratorBlock->>ExecutionProcessor: read nodes_input_masks[sink_node_id]
OrchestratorBlock->>OrchestratorBlock: merge mask into merged_input_data
OrchestratorBlock->>ExecutionProcessor: on_node_execution(node_id, merged_input_data, nodes_input_masks)
ExecutionProcessor->>ToolExecutor: execute tool with merged inputs and applied masks
ToolExecutor-->>ExecutionProcessor: execution result
ExecutionProcessor-->>OrchestratorBlock: completion callback/result
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## dev #13178 +/- ##
==========================================
+ Coverage 71.43% 71.60% +0.17%
==========================================
Files 2214 2221 +7
Lines 166908 169032 +2124
Branches 17024 17340 +316
==========================================
+ Hits 119224 121039 +1815
- Misses 44127 44447 +320
+ Partials 3557 3546 -11
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
…s_input_masks read The orchestrator's tool dispatch now reads execution_processor.nodes_input_masks, so existing tests that mocked the processor with a bare AsyncMock() ended up with a truthy auto-attribute and tripped the new merge path. Pin nodes_input_masks = None on those mocks to keep them on the Builder path, and drop a now-stray ticket reference from comments/docstrings.
Why / What / How
Why — Linear OPEN-3132 (Urgent / production). Agents built with
OrchestratorBlock+ a credential-bearing tool block run fine from the Builder but fail with a missing-credentials error when launched from the Library or AutoPilot.Root cause: the Builder persists credential metadata into
node.input_default, so it travels with the node. Library/AutoPilot strip that and instead ship credentials separately ingraph_exec.nodes_input_masks. The normal queue dispatch inmanager._on_graph_executionmerges those masks into the queued node's inputs — butOrchestratorBlock._execute_single_tool_with_managerdispatches tool calls directly throughon_node_execution, bypassing that merge step. The tool node therefore runs without its credentials.What — Make the orchestrator's tool-dispatch path honour
nodes_input_masks, matching the behaviour of the normal queue dispatch.How
ExecutionProcessornow storesnodes_input_maskson the instance (initialised toNoneinon_graph_executor_start, set per-execution in_on_graph_execution)._execute_single_tool_with_managerreads the mask for the sink node and merges it intomerged_input_databefore callingupsert_execution_input.nodes_input_masksis now forwarded toon_node_execution(was hardcodedNone) so downstream dispatch from the tool node stays consistent with the normal path.Changes 🏗️
backend/executor/manager.pyExecutionProcessor.on_graph_executor_start: declareself.nodes_input_masks: Optional[NodesInputMasks] = Noneso the attribute is always defined.ExecutionProcessor._on_graph_execution: setself.nodes_input_masks = graph_exec.nodes_input_masksalongside the other per-execution state holders.backend/blocks/orchestrator.py_execute_single_tool_with_manager: mergeexecution_processor.nodes_input_masks[sink_node_id]into the tool node's inputs before upsert.nodes_input_maskstoon_node_executioninstead ofNone.backend/blocks/test/test_orchestrator.py: two new regression tests covering the Library/AutoPilot path (creds innodes_input_masks) and the Builder path (creds ininput_default, masksNone).backend/blocks/test/test_orchestrator_responses_api.py,backend/blocks/test/test_orchestrator_dynamic_fields.py: pinmock_execution_processor.nodes_input_masks = Noneso existing mocks keep the Builder path now that the orchestrator actually reads the attribute.Checklist 📋
For code changes:
OrchestratorBlock._execute_single_tool_with_managerinvoked withnodes_input_masks={sink: {"credentials": {...}}}and emptyinput_default→upsert_execution_inputis now called withinput_name="credentials"(was missing before the fix).input_defaultandnodes_input_masks=Nonestill works;on_node_executionreceivesnodes_input_masks=Noneso behaviour is unchanged.pyright/black/isortclean on the modified files.For configuration changes:
.env.defaultis updated or already compatible with my changesdocker-compose.ymlis updated or already compatible with my changes