Skip to content

fix(agent): preserve completed thought elapsed time - #39777

Open
qdivan wants to merge 1 commit into
langgenius:mainfrom
qdivan:fix/agent-log-elapsed-time-39757
Open

fix(agent): preserve completed thought elapsed time#39777
qdivan wants to merge 1 commit into
langgenius:mainfrom
qdivan:fix/agent-log-elapsed-time-39757

Conversation

@qdivan

@qdivan qdivan commented Jul 29, 2026

Copy link
Copy Markdown

Summary

  • preserve a previously observed positive, finite Agent Thought elapsed_time when the final log for the same message_id reports 0 or omits the field
  • continue accepting later positive, finite elapsed-time updates while rejecting booleans and non-finite values as authoritative durations
  • add focused regression coverage for zero, missing, updated, non-finite, boolean, and distinct-message cases

Closes #39757.

Validation

  • Baseline regression: 4 failed, 6 passed against the unpatched implementation
  • PYTHONDONTWRITEBYTECODE=1 uv run --project api pytest -p no:cacheprovider -o addopts='' api/tests/unit_tests/core/workflow/nodes/agent/test_message_transformer.py -q (10 passed)
  • uv run --project api --dev ruff check api/core/workflow/nodes/agent/message_transformer.py api/tests/unit_tests/core/workflow/nodes/agent/test_message_transformer.py
  • uv run --project api --dev ruff format --check api/core/workflow/nodes/agent/message_transformer.py api/tests/unit_tests/core/workflow/nodes/agent/test_message_transformer.py
  • git diff --check

Duplicate Check

Checked the live issue timeline, open and closed pull requests by issue number, affected symbols, paths, and behavior, plus the current canonical main at 72c20daa61adb2448caa02f7d4e807af35f6a84e. No equivalent active fix, merged fix, public implementation claim, assignment, or contribution lock was found. PRs #35301, #35574, and #35932 concern different UI or behavior boundaries.

Browser / Playwright

Not run. The regression is isolated to backend Agent log aggregation and is deterministically covered by unit tests. A full browser reproduction requires a configured Dify service, model/Agent plugin, and workflow; no frontend code is changed.

@qdivan
qdivan marked this pull request as ready for review July 29, 2026 19:36
@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agent node Thought duration shows 0.0s in workflow run history and webapp executions

1 participant