-
Notifications
You must be signed in to change notification settings - Fork 12
fix(workflow-executor): surface the cause when MCP tool loading fails #1806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hercemer42
wants to merge
10
commits into
main
Choose a base branch
from
feature/prd-876-ai-proxy-diagnostics-never-reach-production-no-logger
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
313e6e9
fix(workflow-executor): pass the executor logger to ai-proxy's AiClient
hercemer42 b7b165c
fix(workflow-executor): keep a throwing host logger out of ai-proxy
hercemer42 16f9089
fix(workflow-executor): name the cause when MCP tools fail to load
hercemer42 16d12e9
refactor(workflow-executor): tighten comments to why-only
hercemer42 b1a1fe9
refactor(workflow-executor): collapse the OAuth fetch tail to one return
hercemer42 1d26e33
docs(workflow-executor): say what a failed MCP tool load logs
hercemer42 743d48a
fix(workflow-executor): drop undefined context keys from pretty logs
hercemer42 db5ba65
fix(workflow-executor): say when an MCP load recovered after a refresh
hercemer42 71e1e25
fix(workflow-executor): report a retry that fails for a non-auth reason
hercemer42 1c2aabc
test(workflow-executor): assert which configs reach the tool load
hercemer42 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
32 changes: 32 additions & 0 deletions
32
packages/workflow-executor/src/adapters/to-ai-proxy-logger.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import type { Logger, LoggerLevel } from '../ports/logger-port'; | ||
|
|
||
| import { extractErrorMessage } from '../errors'; | ||
|
|
||
| // ai-proxy hands the cause as an Error, the executor's logger expects a context object. | ||
| export type AiProxyLogger = (level: LoggerLevel, message: string, error?: Error) => void; | ||
|
|
||
| // An Error's own properties are non-enumerable, so forwarding it as the context would emit the line | ||
| // with the cause silently stripped — flatten it the way the rest of the executor logs causes. | ||
| export default function toAiProxyLogger(logger: Logger): AiProxyLogger { | ||
| return (level, message, error) => { | ||
| // ai-proxy logs from inside its catch blocks before recording the failure it caught, so a host | ||
| // logger that throws here would abort a whole tool load instead of one server's. | ||
| try { | ||
| if (error === undefined || error === null) { | ||
| logger(level, message); | ||
|
|
||
| return; | ||
| } | ||
|
|
||
| const { cause } = error as { cause?: unknown }; | ||
|
|
||
| logger(level, message, { | ||
| error: extractErrorMessage(error), | ||
| cause: extractErrorMessage(cause), | ||
| stack: error instanceof Error ? error.stack : undefined, | ||
| }); | ||
| } catch { | ||
| // A broken logger must not become control flow. | ||
| } | ||
| }; | ||
| } | ||
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.