Skip to content

refactor(web): migrate agent v2 app context consumers#38558

Merged
hyoban merged 1 commit into
mainfrom
0708-agent-v2-context
Jul 8, 2026
Merged

refactor(web): migrate agent v2 app context consumers#38558
hyoban merged 1 commit into
mainfrom
0708-agent-v2-context

Conversation

@hyoban

@hyoban hyoban commented Jul 8, 2026

Copy link
Copy Markdown
Member

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

  • Related to [Refactor/Chore] Clarify and decouple web AppContext bootstrap dependencies #38514.
  • Migrates Agent V2 AppContext consumers to direct bootstrap atom reads.
  • Replaces broad context reads with currentWorkspaceIdAtom and userProfileAtom in the Agent V2 prompt icon resolver, preview chat runtime, and versions panel.
  • Updates the affected Agent V2 tests to mock the exact app-context-state atoms used by production code.

From Codex

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 make lint && make type-check (backend) and cd web && pnpm exec vp staged (frontend) to appease the lint gods

Validation

  • pnpm -C web exec eslint features/agent-v2/agent-detail/configure/components/__tests__/agent-prompt-editor.spec.tsx features/agent-v2/agent-detail/configure/components/orchestrate/prompt-editor/hooks.ts features/agent-v2/agent-detail/configure/components/preview/__tests__/chat.spec.tsx features/agent-v2/agent-detail/configure/components/preview/__tests__/versions-panel.spec.tsx features/agent-v2/agent-detail/configure/components/preview/chat-runtime.tsx features/agent-v2/agent-detail/configure/components/preview/versions-panel/index.tsx --cache --quiet
  • pnpm -C web test features/agent-v2/agent-detail/configure/components/__tests__/agent-prompt-editor.spec.tsx features/agent-v2/agent-detail/configure/components/preview/__tests__/chat.spec.tsx features/agent-v2/agent-detail/configure/components/preview/__tests__/versions-panel.spec.tsx
  • pnpm -C web type-check

Note: pnpm -C web exec vp staged currently exits before checking files because this checkout's vite.config.ts has no staged config. I did not change CI or Vite config for this PR.

@github-actions github-actions Bot added the web This relates to changes on the web. label Jul 8, 2026
@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.34%. Comparing base (eca2d41) to head (cab74d9).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #38558   +/-   ##
=======================================
  Coverage   85.34%   85.34%           
=======================================
  Files        5013     5013           
  Lines      265942   265942           
  Branches    50558    50558           
=======================================
  Hits       226980   226980           
  Misses      34509    34509           
  Partials     4453     4453           
Flag Coverage Δ
dify-ui 94.61% <ø> (ø)
web 84.91% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hyoban hyoban marked this pull request as ready for review July 8, 2026 09:32
@hyoban hyoban requested a review from lyzno1 as a code owner July 8, 2026 09:32
@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jul 8, 2026
@hyoban hyoban enabled auto-merge July 8, 2026 09:33
@dosubot dosubot Bot added the refactor label Jul 8, 2026
@hyoban hyoban added this pull request to the merge queue Jul 8, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jul 8, 2026
Merged via the queue into main with commit af5b08a Jul 8, 2026
38 checks passed
@hyoban hyoban deleted the 0708-agent-v2-context branch July 8, 2026 09:50
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 refactor size:S This PR changes 10-29 lines, ignoring generated files. web This relates to changes on the web.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants