Skip to content

fix: fixes error forwarding to connectors - #5491

Merged
akshaydeo merged 2 commits into
devfrom
07-23-fix_fixes_error_forwarding_to_connectors
Jul 23, 2026
Merged

fix: fixes error forwarding to connectors#5491
akshaydeo merged 2 commits into
devfrom
07-23-fix_fixes_error_forwarding_to_connectors

Conversation

@roroghost17

@roroghost17 roroghost17 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Tracing spans for failed streaming requests were silently reporting unknown status because error attributes were never stamped when a stream errored out. This fixes two code paths where a BifrostError exists but PopulateLLMResponseAttributes was never called: failed stream requests in the retry loop and streams that fail before the first chunk arrives during deferred span completion.

Changes

  • In executeRequestWithRetries, added an else if branch to call PopulateLLMResponseAttributes with a nil response and the error when a stream request fails — previously the cast to a non-stream response type would miss this case entirely.
  • In completeDeferredSpan, added an else if branch to stamp error attributes when a stream errors before producing any chunks, ensuring the span is not left with unknown/empty attributes.

Type of change

  • Bug fix
  • Feature
  • Refactor
  • Documentation
  • Chore/CI

Affected areas

  • Core (Go)
  • Transports (HTTP)
  • Providers/Integrations
  • Plugins
  • UI (React)
  • Docs

How to test

Trigger a streaming request that is expected to fail (e.g., invalid model name, bad credentials, or a provider that returns an error before streaming begins) and verify that the resulting trace span contains the correct error attributes rather than reporting unknown status.

go test ./...

Screenshots/Recordings

N/A

Breaking changes

  • Yes
  • No

Related issues

N/A

Security considerations

No security implications. This change only affects observability/tracing attribute population.

Checklist

  • I read docs/contributing/README.md and followed the guidelines
  • I added/updated tests where appropriate
  • I updated documentation where needed
  • I verified builds succeed (Go and UI)
  • I verified the CI pipeline passes locally if applicable

@CLAassistant

CLAassistant commented Jul 23, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Tracing now populates LLM response attributes for request and streaming failures that produce no response object.

Changes

Tracing error attribute coverage

Layer / File(s) Summary
Error-path span enrichment
core/bifrost.go, core/providers/utils/utils.go
Request failures after response type assertion and streaming failures without accumulated chunks now pass the error with a nil response to tracing attribute population.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

  • maximhq/bifrost#5467: Updates related deferred-span tracing instrumentation in completeDeferredSpan.

Suggested reviewers: pratham-mishra04, akshaydeo, tejasghatte

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title mentions error forwarding to connectors, but the PR actually fixes missing tracing attributes for failed streaming requests. Rename it to describe the tracing fix, e.g. "fix: populate error attributes for failed streaming spans".
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description matches the template well and includes summary, changes, type, affected areas, testing, breaking changes, and security notes.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 07-23-fix_fixes_error_forwarding_to_connectors

Comment @coderabbitai help to get the list of available commands.

roroghost17 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 23, 2026

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This repository has used its 100 free open-source review credits for this billing period. An organization admin can enable additional billed reviews, or reviews resume next period.

@roroghost17 roroghost17 mentioned this pull request Jul 23, 2026
18 tasks
akshaydeo
akshaydeo previously approved these changes Jul 23, 2026

akshaydeo commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Merge activity

  • Jul 23, 4:00 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jul 23, 4:01 PM UTC: Graphite couldn't merge this PR because it was not satisfying all requirements (PR does not have required approvals).
  • Jul 23, 4:02 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jul 23, 4:03 PM UTC: @akshaydeo merged this pull request with Graphite.

@akshaydeo
akshaydeo changed the base branch from 07-23-fix_fixes_whitespace_trimming_on_connectors_form_fields to graphite-base/5491 July 23, 2026 16:00
@akshaydeo
akshaydeo changed the base branch from graphite-base/5491 to dev July 23, 2026 16:00
@akshaydeo
akshaydeo dismissed stale reviews from coderabbitai[bot] and themself July 23, 2026 16:00

The base branch was changed.

@akshaydeo
akshaydeo merged commit 3ae13ae into dev Jul 23, 2026
8 of 9 checks passed
@akshaydeo
akshaydeo deleted the 07-23-fix_fixes_error_forwarding_to_connectors branch July 23, 2026 16:03
akshaydeo pushed a commit that referenced this pull request Jul 24, 2026
## Summary

Tracing spans for failed streaming requests were silently reporting unknown status because error attributes were never stamped when a stream errored out. This fixes two code paths where a `BifrostError` exists but `PopulateLLMResponseAttributes` was never called: failed stream requests in the retry loop and streams that fail before the first chunk arrives during deferred span completion.

## Changes

- In `executeRequestWithRetries`, added an `else if` branch to call `PopulateLLMResponseAttributes` with a nil response and the error when a stream request fails — previously the cast to a non-stream response type would miss this case entirely.
- In `completeDeferredSpan`, added an `else if` branch to stamp error attributes when a stream errors before producing any chunks, ensuring the span is not left with unknown/empty attributes.

## Type of change

- [x] Bug fix
- [ ] Feature
- [ ] Refactor
- [ ] Documentation
- [ ] Chore/CI

## Affected areas

- [x] Core (Go)
- [ ] Transports (HTTP)
- [ ] Providers/Integrations
- [ ] Plugins
- [ ] UI (React)
- [ ] Docs

## How to test

Trigger a streaming request that is expected to fail (e.g., invalid model name, bad credentials, or a provider that returns an error before streaming begins) and verify that the resulting trace span contains the correct error attributes rather than reporting unknown status.

```sh
go test ./...
```

## Screenshots/Recordings

N/A

## Breaking changes

- [ ] Yes
- [x] No

## Related issues

N/A

## Security considerations

No security implications. This change only affects observability/tracing attribute population.

## Checklist

- [ ] I read `docs/contributing/README.md` and followed the guidelines
- [ ] I added/updated tests where appropriate
- [ ] I updated documentation where needed
- [ ] I verified builds succeed (Go and UI)
- [ ] I verified the CI pipeline passes locally if applicable
akhsaul pushed a commit to akhsaul/bifrost that referenced this pull request Aug 27, 2026
## Summary

Tracing spans for failed streaming requests were silently reporting unknown status because error attributes were never stamped when a stream errored out. This fixes two code paths where a `BifrostError` exists but `PopulateLLMResponseAttributes` was never called: failed stream requests in the retry loop and streams that fail before the first chunk arrives during deferred span completion.

## Changes

- In `executeRequestWithRetries`, added an `else if` branch to call `PopulateLLMResponseAttributes` with a nil response and the error when a stream request fails — previously the cast to a non-stream response type would miss this case entirely.
- In `completeDeferredSpan`, added an `else if` branch to stamp error attributes when a stream errors before producing any chunks, ensuring the span is not left with unknown/empty attributes.

## Type of change

- [x] Bug fix
- [ ] Feature
- [ ] Refactor
- [ ] Documentation
- [ ] Chore/CI

## Affected areas

- [x] Core (Go)
- [ ] Transports (HTTP)
- [ ] Providers/Integrations
- [ ] Plugins
- [ ] UI (React)
- [ ] Docs

## How to test

Trigger a streaming request that is expected to fail (e.g., invalid model name, bad credentials, or a provider that returns an error before streaming begins) and verify that the resulting trace span contains the correct error attributes rather than reporting unknown status.

```sh
go test ./...
```

## Screenshots/Recordings

N/A

## Breaking changes

- [ ] Yes
- [x] No

## Related issues

N/A

## Security considerations

No security implications. This change only affects observability/tracing attribute population.

## Checklist

- [ ] I read `docs/contributing/README.md` and followed the guidelines
- [ ] I added/updated tests where appropriate
- [ ] I updated documentation where needed
- [ ] I verified builds succeed (Go and UI)
- [ ] I verified the CI pipeline passes locally if applicable
occcat pushed a commit to occcat/bifrost that referenced this pull request Sep 2, 2026
## Summary

Tracing spans for failed streaming requests were silently reporting unknown status because error attributes were never stamped when a stream errored out. This fixes two code paths where a `BifrostError` exists but `PopulateLLMResponseAttributes` was never called: failed stream requests in the retry loop and streams that fail before the first chunk arrives during deferred span completion.

## Changes

- In `executeRequestWithRetries`, added an `else if` branch to call `PopulateLLMResponseAttributes` with a nil response and the error when a stream request fails — previously the cast to a non-stream response type would miss this case entirely.
- In `completeDeferredSpan`, added an `else if` branch to stamp error attributes when a stream errors before producing any chunks, ensuring the span is not left with unknown/empty attributes.

## Type of change

- [x] Bug fix
- [ ] Feature
- [ ] Refactor
- [ ] Documentation
- [ ] Chore/CI

## Affected areas

- [x] Core (Go)
- [ ] Transports (HTTP)
- [ ] Providers/Integrations
- [ ] Plugins
- [ ] UI (React)
- [ ] Docs

## How to test

Trigger a streaming request that is expected to fail (e.g., invalid model name, bad credentials, or a provider that returns an error before streaming begins) and verify that the resulting trace span contains the correct error attributes rather than reporting unknown status.

```sh
go test ./...
```

## Screenshots/Recordings

N/A

## Breaking changes

- [ ] Yes
- [x] No

## Related issues

N/A

## Security considerations

No security implications. This change only affects observability/tracing attribute population.

## Checklist

- [ ] I read `docs/contributing/README.md` and followed the guidelines
- [ ] I added/updated tests where appropriate
- [ ] I updated documentation where needed
- [ ] I verified builds succeed (Go and UI)
- [ ] I verified the CI pipeline passes locally if applicable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants