[PR #32133] fix(console): keep conversation updated_at unchanged when marking read #33563

Closed
opened 2026-02-21 20:53:30 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/32133

State: closed
Merged: Yes


Summary

Fixes #32125.
close #32136
Viewing a conversation in Logs & Annotations marks it as read (read_at/read_account_id). This read-only action should not change updated_at, but SQLAlchemy onupdate was auto-updating it.

This PR keeps updated_at unchanged during the mark-as-read update by explicitly setting updated_at=Conversation.updated_at.

Changes

  • api/controllers/console/app/conversation.py
    • Preserve updated_at when setting read_at and read_account_id in _get_conversation.
  • api/tests/unit_tests/controllers/console/app/test_conversation_read_timestamp.py
    • Add regression test ensuring the generated UPDATE statement does not set updated_at=CURRENT_TIMESTAMP.

Testing

  • uv run --project api --group dev ruff check api/controllers/console/app/conversation.py api/tests/unit_tests/controllers/console/app/test_conversation_read_timestamp.py
  • uv run --project api --group dev pytest api/tests/unit_tests/controllers/console/app/test_conversation_read_timestamp.py -q

Impact

  • Prevents read operations from polluting conversation "Updated Time" sorting/filtering.
**Original Pull Request:** https://github.com/langgenius/dify/pull/32133 **State:** closed **Merged:** Yes --- ## Summary Fixes #32125. close #32136 Viewing a conversation in Logs & Annotations marks it as read (`read_at`/`read_account_id`). This read-only action should not change `updated_at`, but SQLAlchemy `onupdate` was auto-updating it. This PR keeps `updated_at` unchanged during the mark-as-read update by explicitly setting `updated_at=Conversation.updated_at`. ## Changes - `api/controllers/console/app/conversation.py` - Preserve `updated_at` when setting `read_at` and `read_account_id` in `_get_conversation`. - `api/tests/unit_tests/controllers/console/app/test_conversation_read_timestamp.py` - Add regression test ensuring the generated UPDATE statement does not set `updated_at=CURRENT_TIMESTAMP`. ## Testing - `uv run --project api --group dev ruff check api/controllers/console/app/conversation.py api/tests/unit_tests/controllers/console/app/test_conversation_read_timestamp.py` - `uv run --project api --group dev pytest api/tests/unit_tests/controllers/console/app/test_conversation_read_timestamp.py -q` ## Impact - Prevents read operations from polluting conversation "Updated Time" sorting/filtering.
yindo added the pull-request label 2026-02-21 20:53:30 -05:00
yindo closed this issue 2026-02-21 20:53:30 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#33563