Skip to content

Fix excerpt generation post context payload#651

Merged
dkotter merged 1 commit into
WordPress:developfrom
ekamran:shifteq/fix-excerpt-generation-post-context
Jun 3, 2026
Merged

Fix excerpt generation post context payload#651
dkotter merged 1 commit into
WordPress:developfrom
ekamran:shifteq/fix-excerpt-generation-post-context

Conversation

@ekamran

@ekamran ekamran commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

What?

Fixes the Excerpt Generation editor request so it passes the current post ID through the ability's existing context field instead of sending an unsupported post_id field.

Why?

The ai/excerpt-generation ability schema accepts content and context. Its post ID path is triggered when context is numeric.

Before this change, the editor sent post_id, which is not part of the Excerpt Generation ability schema. The request could still generate an excerpt because content was also sent, but the ability skipped the intended post-context path.

This brings Excerpt Generation in line with the existing ability contract and with sibling features like Title Generation and Summarization.

How?

  • Sends context: postId.toString() from the Excerpt Generation editor hook.
  • Updates the TypeScript input type to match the ability schema.

Testing Instructions

Automated checks run locally:

npm run typecheck
npm run lint:js -- src/experiments/excerpt-generation/components/useExcerptGeneration.ts src/experiments/excerpt-generation/types.ts
npx wp-env run cli --env-cwd=wp-content/plugins/develop vendor/bin/phpunit -c phpunit.xml.dist --filter Excerpt_GenerationTest
npm run build
git diff --check

Manual testing:

  1. Enable AI features and the Excerpt Generation experiment.
  2. Configure an AI connector.
  3. Open a post in the editor.
  4. Open DevTools → Network.
  5. Click Generate excerpt in the Excerpt panel.
  6. Confirm the request to wp-abilities/v1/abilities/ai/excerpt-generation/run sends input.context with the post ID instead of input.post_id.
  7. Confirm the excerpt is generated and inserted.

Screenshots/Screencast

Before:

BEFORE

After:

AFTER

Use of AI Tools

AI assistance: Yes
Tool(s): ChatGPT / Codex
Used for: Repository review, reproduction planning, implementation guidance, test updates, and local verification. I reviewed the changes, tested the behavior locally, and take responsibility for the final submission.

Open WordPress Playground Preview

@github-actions

github-actions Bot commented Jun 3, 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: ekamran <ekamran@git.wordpress.org>

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

@codecov

codecov Bot commented Jun 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.58%. Comparing base (35be266) to head (2404785).

Additional details and impacted files
@@            Coverage Diff             @@
##             develop     #651   +/-   ##
==========================================
  Coverage      74.58%   74.58%           
  Complexity      1754     1754           
==========================================
  Files             85       85           
  Lines           7547     7547           
==========================================
  Hits            5629     5629           
  Misses          1918     1918           
Flag Coverage Δ
unit 74.58% <ø> (ø)

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.

@dkotter dkotter added this to the 1.1.0 milestone Jun 3, 2026
@dkotter dkotter merged commit 64e8032 into WordPress:develop Jun 3, 2026
23 of 24 checks passed
@ekamran ekamran deleted the shifteq/fix-excerpt-generation-post-context branch June 7, 2026 17:50
jorgefilipecosta pushed a commit that referenced this pull request Jun 15, 2026
Fixed - Excerpt generation post context payload.

Co-authored-by: ekamran <ekamran@git.wordpress.org>
Co-authored-by: dkotter <dkotter@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants