Skip to content

test: Give Apify builds more time in scheduled e2e templates test#1909

Merged
vdusek merged 2 commits into
masterfrom
test/stagehand-build-wait-client-side
May 22, 2026
Merged

test: Give Apify builds more time in scheduled e2e templates test#1909
vdusek merged 2 commits into
masterfrom
test/stagehand-build-wait-client-side

Conversation

@vdusek
Copy link
Copy Markdown
Collaborator

@vdusek vdusek commented May 22, 2026

Summary

Two related scheduled e2e failures, both fixed by giving Apify builds more time to complete.

1. Stagehand rebuild: wait_for_finish=600 was silently clipped to 60s

The scheduled stagehand tests have been failing on every run since #1900 added the post-env_vars.create rebuild (example):

apify_client.errors.ApifyApiError: The build has not finished or was not successful.

ActorClientAsync.build()'s wait_for_finish parameter is clipped server-side to a max of 60s ("By default it is 0, the maximum value is 60"). A stagehand build (playwright + browser deps) does not finish in 60s, so actor.build() returned a still-PROCESSING build and actor.start(build=build_number) was rejected.

Fix: After triggering the rebuild, poll client-side via client.build(<id>).wait_for_finish(wait_secs=900) — which uses long-poll requests and actually waits up to the requested duration — then assert status == 'SUCCEEDED' before passing the build to actor.start().

2. apify push 120s timeout was too tight for heavier templates

The poetry-curl-impersonate-adaptive-parsel variant times out on every rerun (example):

subprocess.TimeoutExpired: Command '['apify', 'push']' timed out after 120 seconds

apify push waits server-side for the Docker build to finish before returning. The captured stderr shows a ~550 MB base image mid-download when the timeout fires — the CLI isn't hung, the build is just legitimately slower than 120s for heavier templates. Job total (522s ≈ 4 × 120s) confirms every rerun hits the same wall, so retries don't help.

Fix: Bump all three apify-cli subprocess.run timeouts (login, init, push) from 120s to 600s. The 1800s pytest-timeout per test still bounds a truly hung CLI; @pytest.mark.flaky(reruns=3) still covers transient network/CLI flakes.

…for_finish cap

`actor.build(wait_for_finish=600)` is silently clipped to the API's 60s
maximum, so the stagehand rebuild (playwright + browser deps) returned
before completion and `actor.start(build=...)` rejected the run with
"The build has not finished or was not successful." Poll on the build
client and assert SUCCEEDED before starting.
@vdusek vdusek added t-tooling Issues with this label are in the ownership of the tooling team. adhoc Ad-hoc unplanned task added during the sprint. labels May 22, 2026
@vdusek vdusek self-assigned this May 22, 2026
@github-actions github-actions Bot added this to the 141st sprint - Tooling team milestone May 22, 2026
@github-actions github-actions Bot added the tested Temporary label used only programatically for some analytics. label May 22, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.85%. Comparing base (41433a3) to head (2178830).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1909      +/-   ##
==========================================
- Coverage   92.89%   92.85%   -0.05%     
==========================================
  Files         167      167              
  Lines       11714    11714              
==========================================
- Hits        10882    10877       -5     
- Misses        832      837       +5     
Flag Coverage Δ
unit 92.85% <ø> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

`apify push` waits server-side for the actor's Docker build to complete
before returning, and the heavier templates (e.g. adaptive-parsel with a
~550 MB base image) consistently exceed the previous 120s budget — all
4 rerun attempts hit the timeout, so retries don't help. Bump every
apify-cli subprocess timeout to 600s; the 1800s pytest-timeout still
bounds a truly hung CLI.
@vdusek vdusek changed the title test: Poll stagehand build client-side to avoid 60s server-side wait_for_finish cap test: Give Apify builds more time in scheduled e2e templates test May 22, 2026
@vdusek vdusek merged commit b13af58 into master May 22, 2026
31 checks passed
@vdusek vdusek deleted the test/stagehand-build-wait-client-side branch May 22, 2026 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants