Skip to content

fix: add responding error information when obtain pipeline template detail failed#33628

Merged
FFXN merged 12 commits intomainfrom
fix/issue-33624
Mar 18, 2026
Merged

fix: add responding error information when obtain pipeline template detail failed#33628
FFXN merged 12 commits intomainfrom
fix/issue-33624

Conversation

@FFXN
Copy link
Copy Markdown
Contributor

@FFXN FFXN commented Mar 18, 2026

fixex #33624

Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

When obtain pipeline template detail failed from upstream service including remote template service and database, return responding error message.

Screenshots

Before After
... ...

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran make lint and make type-check (backend) and cd web && npx lint-staged (frontend) to appease the lint gods

Copilot AI review requested due to automatic review settings March 18, 2026 02:56
@FFXN FFXN requested a review from JohnJyong as a code owner March 18, 2026 02:56
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Mar 18, 2026
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refines the error handling mechanisms for retrieving RAG pipeline templates within the application. It ensures that when a template cannot be found, either from remote services or internally, a clear and informative error message is returned to the user or logged for debugging. This change prevents silent failures, provides better feedback to API consumers, and improves the overall robustness and diagnosability of the pipeline template retrieval process.

Highlights

  • Improved Error Handling: Enhanced the system to return explicit error messages and appropriate HTTP status codes (404) when pipeline template details cannot be obtained from upstream services or the database.
  • Remote Service Robustness: Modified the remote retrieval service to raise a ValueError with detailed information upon receiving non-200 HTTP responses, rather than silently returning None.
  • Enhanced Logging: Added warning logs for instances where built-in pipeline templates are not found after all retrieval attempts, aiding in debugging and monitoring.
  • Code Clarity: Updated type hints and docstrings for methods involved in pipeline template retrieval to improve code readability and maintainability.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

No changes detected.

1 similar comment
@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

No changes detected.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request effectively improves error handling when fetching pipeline template details. The changes ensure that when a template isn't found, a proper 404 error is returned to the client, and exceptions are raised internally for better error propagation instead of silently returning None. Additionally, a new warning log has been added to improve observability when a template cannot be located after all retrieval attempts.

The implementation is solid. I've added one suggestion to truncate the response body in an exception message to prevent log spamming.

For future consideration, I noticed that in api/services/rag_pipeline/pipeline_template/remote/remote_retrieval.py, the class docstring and a log message seem to be copy-pasted from a 'recommended app' feature and could be updated to refer to 'pipeline templates' for better clarity. Since these are outside the changed lines of this PR, I couldn't add specific comments.

@FFXN FFXN changed the title Fix/add responding error information when obtain pipeline template detail failed fix: add responding error information when obtain pipeline template detail failed Mar 18, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

No changes detected.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the RAG pipeline template detail retrieval flow to avoid returning 200 with a null body when a template can’t be obtained from upstream sources (remote service and/or database), instead returning an error response.

Changes:

  • Add a 404 error response from the console API when a pipeline template detail lookup returns no result.
  • Improve service-side logging when built-in template detail retrieval yields no result.
  • Change remote template-detail fetching to raise an exception on non-200 responses (enabling fallback behavior and better diagnostics).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
api/services/rag_pipeline/rag_pipeline.py Adds warning logging when built-in template detail retrieval returns no result.
api/services/rag_pipeline/pipeline_template/remote/remote_retrieval.py Raises on non-200 upstream responses for template detail fetches (instead of returning None).
api/controllers/console/datasets/rag_pipeline/rag_pipeline.py Returns a 404 error payload when template detail retrieval returns no template.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings March 18, 2026 03:00
@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

No changes detected.

@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

No changes detected.

1 similar comment
@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

No changes detected.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses issue #33624 by ensuring the pipeline template detail endpoint does not return 200 with a null/empty body when retrieval fails, and adds additional logging/error signaling around upstream template retrieval.

Changes:

  • Return 404 from the console API when a pipeline template detail cannot be retrieved.
  • Update remote retrieval to raise on non-200 upstream responses (enabling fallback behavior) and enrich docstrings.
  • Add warning logging when built-in template detail is not found after retrieval attempts.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
api/services/rag_pipeline/rag_pipeline.py Adds docstring clarity and a warning when built-in template detail retrieval returns no result.
api/services/rag_pipeline/pipeline_template/remote/remote_retrieval.py Raises an error on non-200 upstream responses (instead of returning None), affecting fallback/logging behavior.
api/controllers/console/datasets/rag_pipeline/rag_pipeline.py Returns a 404 error payload when get_pipeline_template_detail returns no template.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 18, 2026 03:05
@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

No changes detected.

1 similar comment
@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

No changes detected.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

No changes detected.

1 similar comment
@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

No changes detected.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to address issue #33624 by ensuring the pipeline template detail endpoint no longer returns 200 with a null body when retrieval fails, and by improving error visibility when upstream template retrieval fails.

Changes:

  • Add a 404 response when a pipeline template detail lookup returns no result.
  • Log a warning when built-in template detail retrieval returns an empty result.
  • Treat non-200 responses from the remote template service as errors (raise) so the DB fallback path is exercised.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
api/services/rag_pipeline/rag_pipeline.py Adds warning logging when template detail retrieval returns empty for built-in mode.
api/services/rag_pipeline/pipeline_template/remote/remote_retrieval.py Raises on non-200 remote responses to enable fallback logic and preserve upstream error details in exceptions/logs.
api/controllers/console/datasets/rag_pipeline/rag_pipeline.py Returns a 404 + error payload when template detail is missing instead of 200, null.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

No changes detected.

1 similar comment
@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

No changes detected.

…m service including remote template service and database, return responding error message.
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Mar 18, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

No changes detected.

1 similar comment
@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

No changes detected.

Copilot AI review requested due to automatic review settings March 18, 2026 03:23
@FFXN FFXN review requested due to automatic review settings March 18, 2026 03:23
@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

No changes detected.

1 similar comment
@github-actions
Copy link
Copy Markdown
Contributor

Pyrefly Diff

No changes detected.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Mar 18, 2026
@FFXN FFXN merged commit dc69f65 into main Mar 18, 2026
17 checks passed
@FFXN FFXN deleted the fix/issue-33624 branch March 18, 2026 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants