Skip to content

Fix timeout errors causing step history to be lost. #16259

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

samwho
Copy link
Collaborator

@samwho samwho commented Jun 3, 2025

Description

If an automation times out, we never appended the step results to the automation results causing it to look like the automation didn't do anything. This PR fixes that by keeping track of intermediate results and using them if the automation times out.

Launchcontrol

No longer loses automation step history if the automation times out.

@samwho samwho requested a review from Copilot June 3, 2025 16:18
@samwho samwho requested a review from a team as a code owner June 3, 2025 16:18
@samwho samwho requested review from adrinr and removed request for a team June 3, 2025 16:18
Copy link

linear bot commented Jun 3, 2025

Copy link

qa-wolf bot commented Jun 3, 2025

QA Wolf here! As you write new code it's important that your test coverage is keeping up.
Click here to request test coverage for this PR!

@github-actions github-actions bot added the size/m label Jun 3, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR ensures intermediate automation step results are retained and returned when an automation run times out.

  • Introduce a _stepResults buffer on AutomationContext and in Orchestrator to accumulate step outputs.
  • Refactor timeout handling to use helpers.withTimeout and append buffered results after timeout.
  • Add comprehensive tests for various timeout and nested-trigger scenarios.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/server/src/threads/automation.ts Add _stepResults handling, refactor timeout logic, update branch step behavior
packages/server/src/definitions/automations.ts Add _stepResults to AutomationContext interface
packages/server/src/automations/tests/steps/triggerAutomationRun.spec.ts Add tests covering step-history preservation on timeouts
Comments suppressed due to low confidence (2)

packages/server/src/threads/automation.ts:34

  • The code references helpers.withTimeout, but helpers is not imported. Add helpers to the import from @budibase/backend-core to avoid runtime errors.
import { context, logging, configs } from "@budibase/backend-core"

packages/server/src/threads/automation.ts:352

  • Calling span.addTags without checking if span is defined may throw an error. Consider using span?.addTags or guarding against undefined.
span.addTags({ timeout: true })

Copy link
Collaborator

@adrinr adrinr left a comment

Choose a reason for hiding this comment

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

Thx for the tests!

@samwho samwho enabled auto-merge June 9, 2025 13:50
@samwho samwho merged commit a7c9429 into master Jun 9, 2025
22 checks passed
@samwho samwho deleted the budi-9374-trigger-automation-actions-run-asynchronously-and-timeouts branch June 9, 2025 13:59
@github-actions github-actions bot locked and limited conversation to collaborators Jun 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants