Skip to content

fix(workflow): pass correct user_from/invoke_from into graph init#30637

Merged
laipz8200 merged 6 commits intomainfrom
c257-pass-the-correct
Jan 7, 2026
Merged

fix(workflow): pass correct user_from/invoke_from into graph init#30637
laipz8200 merged 6 commits intomainfrom
c257-pass-the-correct

Conversation

@laipz8200
Copy link
Member

@laipz8200 laipz8200 commented Jan 6, 2026

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

Fixes #30636.

Propagates user_from and invoke_from from app runners into workflow graph initialization for normal runs, aligns user-from resolution so web apps map to end-user while all other entry points map to account, and keeps single-node runs explicitly in debugger/account context.

Tests: make lint, make type-check.

Screenshots

Before After
N/A N/A

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 dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
Threaded invoke_from/user_from from the generate entities into graph initialization and single-node execution for workflow, advanced chat, and pipeline runners, and aligned WorkflowEntry user_from to the web-app-only end-user rule. Tests not run (not requested).
…e explicit graph params Updated `WorkflowBasedAppRunner._resolve_user_from` to return account for explore/debugger and end-user otherwise, and made `_init_graph` require explicit `user_from`/`invoke_from` to avoid hidden defaults. Tests not run (not requested).
… and update user_from resolution Tests not run (not requested).
make lint (pass) make type-check (pass)
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @laipz8200, 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 refactors how user_from and invoke_from parameters are handled within the application runners, moving away from hardcoded values to a more dynamic and context-aware approach. The change ensures that these critical parameters accurately reflect the origin and type of interaction, which is essential for correct system behavior across various usage scenarios, including web applications, service APIs, and debugging sessions.

Highlights

  • Dynamic Parameter Handling: The user_from and invoke_from parameters are no longer hardcoded but are now dynamically determined based on the application's invocation context, ensuring correct values for different scenarios like web apps, console, or service APIs.
  • Centralized User Source Resolution: A new static method, _resolve_user_from, has been introduced in WorkflowBasedAppRunner to centralize the logic for determining the user_from value based on the invoke_from parameter, promoting consistency and maintainability.
  • Refactored Graph Initialization: The _init_graph and _init_rag_pipeline_graph methods have been updated to accept user_from and invoke_from as explicit parameters, allowing the GraphInitParams object to be constructed with the correct contextual information.
  • Consistent Debugging Context: For single iteration or single loop runs (debugging scenarios), the invoke_from parameter is now consistently set to InvokeFrom.DEBUGGER, ensuring that the user_from is also correctly resolved for these specific cases.

🧠 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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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.

@laipz8200 laipz8200 changed the title Pass the correct user_from and invoke_from parameters. (vibe-kanban) fix(workflow): pass correct user_from/invoke_from into graph init Jan 6, 2026
Copy link
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 refactors the handling of user_from and invoke_from parameters by centralizing the logic and passing them down from the runner, which is a great improvement. The changes are well-implemented across the different app runners. I've made a couple of suggestions to further improve code clarity and consistency by simplifying how these parameters are determined in a couple of files, following the cleaner pattern already present in pipeline/pipeline_runner.py.

@laipz8200 laipz8200 marked this pull request as ready for review January 6, 2026 10:50
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jan 6, 2026
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 6, 2026
@laipz8200 laipz8200 merged commit 7ccf858 into main Jan 7, 2026
15 checks passed
@laipz8200 laipz8200 deleted the c257-pass-the-correct branch January 7, 2026 13:47
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.

2 participants