Commit 210ea7a
Neha Prasad
fix(core): propagate agent logger to combined processor workflow (#16369)
### description
- Fixes logger propagation for processor-combined internal workflows so
processor step failures use the configured agent logger instead of
default console logging.
Adds a focused regression test to prevent this from regressing.
Related Issue(s)
fixes #16364
### Type of Change
[x] Bug fix (non-breaking change that fixes an issue)
[x] Test update
#### Checklist
[x] I have added tests that prove my fix is effective or that my feature
works
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## ELI5
When you combine multiple processors into a workflow within an agent,
the internal workflow wasn't using the agent's logger. So if something
went wrong, errors were printed to the console instead of going through
your configured logging system (like DataDog). This PR adds one line of
code to make sure the internal workflow uses the agent's logger, so all
error logs flow through the proper logging pipeline.
---
## Changes
### agent.ts
Added explicit logger propagation in
`Agent.combineProcessorsIntoWorkflow()`. After creating the chained
processor workflow via `createWorkflow(...)`, the code now calls
`workflow.__setLogger(this.logger)` to ensure the internal workflow uses
the agent's configured logger instance instead of the default console
logger.
### agent-processor.test.ts
Added a new regression test under "Workflow as Processor" that verifies
logger propagation works correctly. The test creates an input processor
that fails, runs it through `agent.generate()`, and confirms that:
- The error is properly rejected with "Input processor error"
- The agent's `logger.error` is called with a message containing the
processor id
- The agent's `logger.trackException` is invoked
### Changeset
Updated `.changeset/blue-snails-see.md` to document a `patch` release
for `@mastra/core` describing the logging fix for processor-combined
workflows.
---
## Impact
- Processor step failures in combined workflows now route through the
configured agent logger, enabling proper log aggregation and structured
logging pipelines
- Breaking change: None
- Tests added: Yes, with focused regression test to prevent future
regressions
<!-- end of auto-generated comment: release notes by coderabbit.ai -->1 parent 0abde18 commit 210ea7a
3 files changed
Lines changed: 45 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
2567 | 2568 | | |
2568 | 2569 | | |
2569 | 2570 | | |
| 2571 | + | |
| 2572 | + | |
| 2573 | + | |
| 2574 | + | |
| 2575 | + | |
| 2576 | + | |
| 2577 | + | |
| 2578 | + | |
| 2579 | + | |
| 2580 | + | |
| 2581 | + | |
| 2582 | + | |
| 2583 | + | |
| 2584 | + | |
| 2585 | + | |
| 2586 | + | |
| 2587 | + | |
| 2588 | + | |
| 2589 | + | |
| 2590 | + | |
| 2591 | + | |
| 2592 | + | |
| 2593 | + | |
| 2594 | + | |
| 2595 | + | |
| 2596 | + | |
| 2597 | + | |
| 2598 | + | |
| 2599 | + | |
| 2600 | + | |
| 2601 | + | |
| 2602 | + | |
| 2603 | + | |
| 2604 | + | |
| 2605 | + | |
| 2606 | + | |
| 2607 | + | |
2570 | 2608 | | |
2571 | 2609 | | |
2572 | 2610 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
848 | 848 | | |
849 | 849 | | |
850 | 850 | | |
| 851 | + | |
851 | 852 | | |
852 | 853 | | |
853 | 854 | | |
| |||
0 commit comments