Skip to content

fix(editor): Don't render now when startedAt is null #15283

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

despairblue
Copy link
Contributor

@despairblue despairblue commented May 11, 2025

Summary

Executions can fail before they were started in queue mode. This happens when the worker looses the connection to postgres, but not to redis.
Then fetching or updating the execution fails, the error gets propagated to the main instance which marks the execution as failed. Then the execution won't have startedAt set.

This leads to the executions appearing as always new. Additionally they block all other executions in the executions list because startedAt: null is considered larger than a date and thus comes first when sorted descendingly.
This was dubbed "ghost executions" by some customers, because they assumed the executions would continue running.

Date before:

pay-2777-before.mp4

Date after:

pay-2777-after.mp4

Sorting before:

pay-2777-2-before.mp4

Sorting after:

pay-2777-2-after.mp4

Related Linear tickets, Github issues, and Community forum posts

https://linear.app/n8n/issue/PAY-2777/executions-list-always-shows-executions-as-recently-finished-if-they

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

Copy link

codecov bot commented May 11, 2025

Codecov Report

Attention: Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
.../frontend/editor-ui/src/stores/executions.store.ts 0.00% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@n8n-assistant n8n-assistant bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team labels May 11, 2025
@despairblue despairblue marked this pull request as ready for review May 12, 2025 10:33
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mrge found 5 issues across 10 files. Review them in mrge.io

@@ -130,7 +130,7 @@ const formattedStoppedAtDate = computed(() => {
return props.execution.stoppedAt
? locale.displayTimer(
new Date(props.execution.stoppedAt).getTime() -
new Date(props.execution.startedAt).getTime(),
new Date(props.execution.startedAt ?? props.execution.createdAt).getTime(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be nice for readability and maintainability to extract that into a function, what do you think ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like this:

export function startedAtOrCreatedAt(execution: ExecutionSummary) {
	return execution.startedAt ?? execution.createdAt
}

I'm not sure if this increases readability. It contains just one line and the name of the function is almost as long as the implementation. But it does create an abstraction that you have to learn.

I think what could make sense is to fix the types, for example one of these:

  1. creating a domain specific interface and have the store map the execution summary internally, e.g. when it get's it back from the API, it could create a field that is used by the executions lists to, e.g. lastUpdated or something more specific
  2. create a mapping function that maps the execution summary to distinct types by status that this component can render, then the startedAt would exist for success, not exist for queued and be optional for failure

But all of this I would leave up to those who maintain the editor code base.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sense. I like the second solution, but agreed on the whole reply

Copy link
Contributor

@guillaumejacquart guillaumejacquart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a small comment

Copy link
Contributor

⚠️ Some Cypress E2E specs are failing, please fix them before merging

Copy link
Contributor

⚠️ Some Cypress E2E specs are failing, please fix them before merging

Copy link
Contributor

✅ All Cypress E2E specs passed

Copy link
Contributor

✅ All Cypress E2E specs passed

@despairblue despairblue merged commit 44ecad5 into master May 14, 2025
111 checks passed
@despairblue despairblue deleted the pay-2777-executions-list-always-shows-executions-as-recently-finished branch May 14, 2025 08:31
@github-actions github-actions bot mentioned this pull request May 19, 2025
@janober
Copy link
Member

janober commented May 19, 2025

Got released with n8n@1.94.0

ozcangungor pushed a commit to ozcangungor/n8n that referenced this pull request May 25, 2025
etobella pushed a commit to etobella/n8n that referenced this pull request May 25, 2025
Alexandero89 pushed a commit to Alexandero89/n8n that referenced this pull request May 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants