Skip to content

refactor(ReactExperienceAgentHook): update hooks' priority#30

Merged
canfuu merged 2 commits intomainfrom
feature/update_hook_priority
Mar 2, 2026
Merged

refactor(ReactExperienceAgentHook): update hooks' priority#30
canfuu merged 2 commits intomainfrom
feature/update_hook_priority

Conversation

@canfuu
Copy link
Collaborator

@canfuu canfuu commented Mar 2, 2026

This pull request introduces a new priority constant for the React Experience Hook and updates the ReactExperienceAgentHook class to ensure it executes before the Quick Intent Hook. This change helps guarantee that React strategy experience is injected early in the agent lifecycle, influencing all subsequent hooks.

Hook priority management:

  • Added a new priority constant REACT_EXPERIENCE_HOOK (value 20) to HookPriorityConstants, with documentation specifying its purpose and execution order in the beforeAgent phase.
  • Updated ReactExperienceAgentHook to implement the Prioritized interface and override getOrder() to return the new priority constant, ensuring it runs before the Quick Intent Hook (priority 50). [1] [2]

Imports and documentation:

  • Added necessary imports for HookPriorityConstants and Prioritized in ReactExperienceAgentHook.java.
  • Enhanced class-level documentation in ReactExperienceAgentHook to clarify the hook's priority and execution order.

Copilot AI review requested due to automatic review settings March 2, 2026 08:32
@canfuu canfuu enabled auto-merge March 2, 2026 08:32
Copy link

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

Updates hook ordering so the React strategy “experience” injection runs earlier in the REACT agent lifecycle (before the Fast/Quick Intent hook), ensuring downstream hooks see the injected behavior guidance.

Changes:

  • Introduced HookPriorityConstants.REACT_EXPERIENCE_HOOK = 20 for beforeAgent ordering.
  • Updated ReactExperienceAgentHook to implement Prioritized and return the new priority via getOrder().
  • Expanded Javadoc to document intended ordering.

Reviewed changes

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

File Description
assistant-agent-extensions/src/main/java/com/alibaba/assistant/agent/extension/experience/hook/ReactExperienceAgentHook.java Makes the hook prioritized and documents its intended execution order.
assistant-agent-common/src/main/java/com/alibaba/assistant/agent/common/constant/HookPriorityConstants.java Adds a new priority constant for React experience injection in beforeAgent.

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

@spring-ai-alibaba spring-ai-alibaba deleted a comment from Copilot AI Mar 2, 2026
@spring-ai-alibaba spring-ai-alibaba deleted a comment from Copilot AI Mar 2, 2026
Copy link
Collaborator

@AQing-527 AQing-527 left a comment

Choose a reason for hiding this comment

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

LGTM

@canfuu canfuu merged commit 39377f2 into main Mar 2, 2026
1 check passed
@canfuu canfuu deleted the feature/update_hook_priority branch March 2, 2026 08:48
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