Skip to content

[Bug] Shared db.session used for side-effect writes in multimodal streaming and RAG callback handlers #38176

Description

@agarwalpranav0711

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.15.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

While reading PR #37895 I noticed the same db.session.commit()
side-effect bug exists in two more files that were not part of that fix.

File 1: api/core/app/apps/base_app_runner.py lines 440-442

File 2: api/core/callback_handler/index_tool_callback_handler.py
lines 49-50 and 73-89

✔️ Expected Behavior

These methods should use an independent session for side-effect writes,
same as the pattern applied in #37895.

❌ Actual Behavior

Both files still call db.session.commit() on the shared request-scoped
session. Happy to submit a PR with the fix if this looks right.

Metadata

Metadata

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions