Repository navigation
chore: dep inject for session - #35934
Merged
Merged
Conversation
asukaminato0721
marked this pull request as ready for review
May 8, 2026 10:35
asukaminato0721
enabled auto-merge
May 8, 2026 10:35
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-05-08 10:35:51.868764822 +0000
+++ /tmp/pyrefly_pr.txt 2026-05-08 10:35:39.119713651 +0000
@@ -3,9 +3,9 @@
ERROR `str` is not assignable to `Literal['aliyun-oss', 'azure-blob', 'baidu-obs', 'clickzetta-volume', 'google-storage', 'huawei-obs', 'local', 'oci-storage', 'opendal', 's3', 'supabase', 'tencent-cos', 'volcengine-tos']` [bad-assignment]
--> configs/middleware/__init__.py:69:9
ERROR `str` is not assignable to `Literal['advanced-chat', 'agent-chat', 'all', 'channel', 'chat', 'completion', 'workflow']` [bad-assignment]
- --> controllers/console/app/app.py:68:104
+ --> controllers/console/app/app.py:69:104
ERROR Object of class `App` has no attribute `access_mode` [missing-attribute]
- --> controllers/console/app/app.py:573:13
+ --> controllers/console/app/app.py:574:13
ERROR Argument `str | None` is not assignable to parameter `language` with type `str` in function `services.account_service.AccountService.send_email_register_email` [bad-argument-type]
--> controllers/console/auth/email_register.py:75:108
ERROR Object of class `MissingRouter` has no attribute `get` [missing-attribute]
|
Contributor
Pyrefly Type Coverage
|
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Refactors app tracing config retrieval to use dependency-injected DB sessions, aligning with the “one session per HTTP endpoint” pattern and avoiding nested session usage.
Changes:
- Update
OpsTraceManager.get_app_tracing_configto accept an injected SQLAlchemySession. - Adjust console controller to create and pass a session per request.
- Update unit tests to pass a mocked session object into the updated API.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| api/tests/unit_tests/core/ops/test_ops_trace_manager.py | Updates unit tests to pass the injected session argument. |
| api/core/ops/ops_trace_manager.py | Changes tracing-config fetch to use an injected Session instead of a global session. |
| api/controllers/console/app/app.py | Creates a per-request session and injects it into OpsTraceManager.get_app_tracing_config. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-05-08 10:37:50.226564345 +0000
+++ /tmp/pyrefly_pr.txt 2026-05-08 10:37:39.074492153 +0000
@@ -3,9 +3,9 @@
ERROR `str` is not assignable to `Literal['aliyun-oss', 'azure-blob', 'baidu-obs', 'clickzetta-volume', 'google-storage', 'huawei-obs', 'local', 'oci-storage', 'opendal', 's3', 'supabase', 'tencent-cos', 'volcengine-tos']` [bad-assignment]
--> configs/middleware/__init__.py:69:9
ERROR `str` is not assignable to `Literal['advanced-chat', 'agent-chat', 'all', 'channel', 'chat', 'completion', 'workflow']` [bad-assignment]
- --> controllers/console/app/app.py:68:104
+ --> controllers/console/app/app.py:69:104
ERROR Object of class `App` has no attribute `access_mode` [missing-attribute]
- --> controllers/console/app/app.py:573:13
+ --> controllers/console/app/app.py:574:13
ERROR Argument `str | None` is not assignable to parameter `language` with type `str` in function `services.account_service.AccountService.send_email_register_email` [bad-argument-type]
--> controllers/console/auth/email_register.py:75:108
ERROR Object of class `MissingRouter` has no attribute `get` [missing-attribute]
|
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-05-08 10:42:56.724062898 +0000
+++ /tmp/pyrefly_pr.txt 2026-05-08 10:42:46.798953894 +0000
@@ -3,9 +3,9 @@
ERROR `str` is not assignable to `Literal['aliyun-oss', 'azure-blob', 'baidu-obs', 'clickzetta-volume', 'google-storage', 'huawei-obs', 'local', 'oci-storage', 'opendal', 's3', 'supabase', 'tencent-cos', 'volcengine-tos']` [bad-assignment]
--> configs/middleware/__init__.py:69:9
ERROR `str` is not assignable to `Literal['advanced-chat', 'agent-chat', 'all', 'channel', 'chat', 'completion', 'workflow']` [bad-assignment]
- --> controllers/console/app/app.py:68:104
+ --> controllers/console/app/app.py:69:104
ERROR Object of class `App` has no attribute `access_mode` [missing-attribute]
- --> controllers/console/app/app.py:573:13
+ --> controllers/console/app/app.py:574:13
ERROR Argument `str | None` is not assignable to parameter `language` with type `str` in function `services.account_service.AccountService.send_email_register_email` [bad-argument-type]
--> controllers/console/auth/email_register.py:75:108
ERROR Object of class `MissingRouter` has no attribute `get` [missing-attribute]
|
WH-2099
approved these changes
May 8, 2026
6 tasks done
Merged
5 tasks
Ssazurov
pushed a commit
to Ssazurov/dify
that referenced
this pull request
Aug 8, 2026
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
Fixes #<issue number>.Summary
let's do this style: for http endpoint, we create a with session.
for any sub call, we do dep injection so no more nest session.
#24138
Screenshots
Checklist
make lint && make type-check(backend) andcd web && pnpm exec vp staged(frontend) to appease the lint gods