Skip to content

Make image generation request timeout configurable - #862

Merged
dkotter merged 8 commits into
WordPress:developfrom
ishitaj34:fix/issue-853
Jul 14, 2026
Merged

Make image generation request timeout configurable#862
dkotter merged 8 commits into
WordPress:developfrom
ishitaj34:fix/issue-853

Conversation

@ishitaj34

@ishitaj34 ishitaj34 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

What?

Closes #853

This PR makes the request timeout for the image generation ability configurable via the wp_ai_client_default_request_timeout filter, while retaining 90 seconds as the default timeout.

Why?

The timeout was hardcoded to 90 seconds which completely bypassed the wp_ai_client_default_request_timeout global filter, meaning developers could not customise or extend the timeout for slower image generation requests.

How?

  • Replaced hardcoded $request_options->setTimeout( 90 ) call with a filtered value:
$request_options->setTimeout( apply_filters( 'wp_ai_client_default_request_timeout', 90 ) )
  • Added integration tests test_request_timeout_defaults_to_90 and test_request_timeout_can_be_filtered to verify the defaults and overridden filter values.
  • Created a helper subclass Testable_Generate_Image to bypass environment checks so the tests can run anywhere.

Use of AI Tools

AI assistance: Yes
Tool(s): Gemini 3.5 Flash)
Used for: Drafting integration test assertions and preparing validation commands.

Testing Instructions

Run the automated tests:

npm run test:php -- --filter=Image_GenerationTest

Changelog Entry

Changed - Make image generation request timeout configurable via the wp_ai_client_default_request_timeout filter.

Open WordPress Playground Preview
@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.43%. Comparing base (8c3606a) to head (e9d79e5).

Additional details and impacted files
@@              Coverage Diff              @@
##             develop     #862      +/-   ##
=============================================
+ Coverage      78.40%   78.43%   +0.03%     
  Complexity      2454     2454              
=============================================
  Files            104      104              
  Lines           9918     9920       +2     
=============================================
+ Hits            7776     7781       +5     
+ Misses          2142     2139       -3     
Flag Coverage Δ
unit 78.43% <100.00%> (+0.03%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 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.
@ishitaj34
ishitaj34 marked this pull request as ready for review July 13, 2026 15:44
@ishitaj34
ishitaj34 requested a review from a team July 13, 2026 15:44
@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: ishitaj34 <ishitaj34@git.wordpress.org>
Co-authored-by: jeffpaul <jeffpaul@git.wordpress.org>
Co-authored-by: dkotter <dkotter@git.wordpress.org>
Co-authored-by: jonathanbossenger <psykro@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@jeffpaul jeffpaul added this to the 1.2.0 milestone Jul 13, 2026
@jeffpaul jeffpaul mentioned this pull request Jul 13, 2026
28 tasks
Comment thread includes/Abilities/Image/Generate_Image.php Outdated
Comment thread tests/Integration/Includes/Abilities/Image_GenerationTest.php Outdated
Comment thread tests/Integration/Includes/Abilities/Image_GenerationTest.php Outdated
@dkotter
dkotter merged commit 2c32597 into WordPress:develop Jul 14, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants