-
Notifications
You must be signed in to change notification settings - Fork 4.3k
fix(api-service): surface provider delivery errors in agents flow fixes NV-7410 #10877
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
Changes from all commits
81d0d3b
97198b7
4a09c63
e2e5ede
ea08eed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| /** | ||
| * Thrown by `ctx.reply()` and `handle.edit()` when the upstream message delivery | ||
| * fails — e.g. the configured email provider returns 401, Slack rejects the token, | ||
| * or Teams rejects the request. | ||
| * | ||
| * The `message` property contains the original provider error text | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * import { AgentDeliveryError } from '@novu/framework'; | ||
| * | ||
| * try { | ||
| * await ctx.reply('Hello!'); | ||
| * } catch (err) { | ||
| * if (err instanceof AgentDeliveryError) { | ||
| * // Delivery failed (misconfigured provider, rate limit, etc.) | ||
| * console.error('Delivery failed:', err.message); | ||
| * return; | ||
| * } | ||
| * throw err; | ||
| * } | ||
| * ``` | ||
| */ | ||
| export class AgentDeliveryError extends Error { | ||
| readonly statusCode: number; | ||
|
|
||
| constructor(statusCode: number, message: string) { | ||
| super(message); | ||
| this.name = 'AgentDeliveryError'; | ||
| this.statusCode = statusCode; | ||
| } | ||
| } | ||
|
Comment on lines
+24
to
+32
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# 1) Check the framework's compile target(s) — ES2015+ means instanceof works natively.
fd -t f -i 'tsconfig*.json' packages/framework -x sh -c 'echo "=== {} ==="; cat {}'
# 2) Confirm version of `@novu/framework` (PR should bump it because of the new public export).
fd -t f '^package.json$' packages/framework --max-depth 2 -x sh -c 'echo "=== {} ==="; jq "{name,version}" {}'
# 3) Confirm AgentDeliveryError is not silently re-introducing a name clash anywhere else.
rg -nP '\bclass\s+AgentDeliveryError\b'Repository: novuhq/novu Length of output: 1977 🏁 Script executed: #!/bin/bash
# 1) Check if AgentDeliveryError is exported from the main `@novu/framework` entry point
echo "=== Checking main entry points for `@novu/framework` ==="
fd -t f '^index\.(ts|js)$' packages/framework/src --max-depth 1 -x sh -c 'echo "=== {} ==="; head -50 {}'
# 2) Search for AgentDeliveryError exports across the codebase
echo ""
echo "=== Searching for AgentDeliveryError exports ==="
rg -n 'export.*AgentDeliveryError|from.*agent\.errors'
# 3) Check if the version in package.json was changed in recent commits
echo ""
echo "=== Checking git history for version changes ==="
git log --oneline -20 -- packages/framework/package.json
# 4) Get the previous version to confirm if a bump is needed
echo ""
echo "=== Previous package versions ==="
git show HEAD~1:packages/framework/package.json 2>/dev/null | jq '.version' || echo "Could not retrieve previous version"Repository: novuhq/novu Length of output: 1602 🏁 Script executed: #!/bin/bash
# Check current git status and compare versions
echo "=== Current package.json version ==="
cat packages/framework/package.json | jq '.version'
echo ""
echo "=== Check if there are uncommitted changes to package.json ==="
git status --porcelain packages/framework/package.json
echo ""
echo "=== List recent commits to see if version was already bumped ==="
git log --oneline -30 | head -15
echo ""
echo "=== Check the actual diff if package.json was modified ==="
git diff HEAD -- packages/framework/package.json | head -20Repository: novuhq/novu Length of output: 388 🏁 Script executed: #!/bin/bash
# Double-check if AgentDeliveryError was actually new in this commit
echo "=== Search for AgentDeliveryError in git history ==="
git log --all --oneline --grep="AgentDeliveryError" | head -10
echo ""
echo "=== Check if agent.errors.ts exists in parent commit ==="
git show HEAD~1:packages/framework/src/resources/agent/agent.errors.ts 2>/dev/null | head -30 || echo "File did not exist in parent commit"
echo ""
echo "=== Verify this is truly a new export by checking the agent resource index ==="
git show HEAD~1:packages/framework/src/resources/agent/index.ts 2>/dev/null | grep -i "AgentDeliveryError" || echo "AgentDeliveryError not exported in parent commit"Repository: novuhq/novu Length of output: 384 Bump
Update 🤖 Prompt for AI Agents |
||
Uh oh!
There was an error while loading. Please reload this page.