Skip to content

Guidelines: Send a literal apostrophe in the guidelines prompt - #1230

Merged
dkotter merged 2 commits into
WordPress:developfrom
maheshbohara:fix/1228-guidelines-prompt-apostrophe
Oct 27, 2026
Merged

dkotter merged 2 commits into
WordPress:developfrom
maheshbohara:fix/1228-guidelines-prompt-apostrophe

Conversation

@maheshbohara

@maheshbohara maheshbohara commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

What?

Closes #1228

Sends "site's" instead of "site's" in the text added before the site's guidelines.

Why?

The prompt is plain text and is never HTML-decoded, so the model received the HTML entity. Details are in #1228.

How?

Replaced ' with a literal apostrophe in the two copies of the text:

  • Abstract_Ability::get_system_instruction() in includes/Abstracts/Abstract_Ability.php
  • Generate_Image::get_prompt_builder() in includes/Abilities/Image/Generate_Image.php

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus
Used for: Investigation, implementation, tests, and PR wording. I reviewed the changes and the test results, and I take responsibility for the contribution.

Testing Instructions

  1. Add site and image guidelines (wp_knowledge rows, for example with the Gutenberg plugin).
  2. Enable the Image Generation and AI Request Logging experiments under Settings > AI.
  3. In a post, add an Image block, click "Generate Image", enter a prompt and click Generate.
  4. Open Tools > AI Request Logs and "View details" for the openai:generations request. The Input Preview reads "The following guidelines represent the site's editorial standards." On develop it reads "the site's editorial standards".

I ran these steps in Chrome on WordPress 7.1.3 (wp-env, PHP 8.3), with the repo's tests/e2e-testing plugin mocking the provider, first on develop and then on this branch. I added the guidelines with a temporary mu-plugin that registers wp_knowledge and wp_knowledge_type, as the PHPUnit helpers do.

The copy in Abstract_Ability::get_system_instruction() (text abilities such as Excerpt Generation) can't be checked this way: the log keeps only the first 1200 characters of the request, and the system instruction is longer, so the guidelines text is cut off. The PHPUnit test below covers it.

Automated:

  • test_get_system_instruction_appends_guidelines in Abstract_Ability_Guidelines_Test.php now also checks for "site's". It fails on develop.
  • New test_prompt_builder_appends_guidelines_as_plain_text in Image_GenerationTest.php adds guidelines and checks the image prompt built by get_prompt_builder(). It fails on develop. It reads the prompt from the builder's messages, the same way the timeout tests read the request options.
  • npm run test:php passes (2182 tests). npm run lint:php:stan passes.

Changelog Entry

Fixed - Guidelines: the prompt no longer contains the HTML entity '.

Open WordPress Playground Preview

The text added before the site's guidelines contained the HTML entity &WordPress#39; instead of an apostrophe, so the model received "site&WordPress#39;s".
@maheshbohara
maheshbohara requested a review from a team October 27, 2026 05:16
@github-actions

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.

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: maheshbohara <maheshbohara@git.wordpress.org>

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


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@codecov

codecov Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.43%. Comparing base (decc946) to head (09d58f5).

Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #1230      +/-   ##
=============================================
+ Coverage      84.41%   84.43%   +0.01%     
  Complexity      3714     3714              
=============================================
  Files            149      149              
  Lines          14144    14144              
=============================================
+ Hits           11940    11942       +2     
+ Misses          2204     2202       -2     
Flag Coverage Δ
unit 84.43% <100.00%> (+0.01%) ⬆️

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.

@dkotter dkotter added this to the 1.5.0 milestone Oct 27, 2026
@dkotter
dkotter merged commit 69806e3 into WordPress:develop Oct 27, 2026
36 of 37 checks passed
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.

Guidelines: The prompt sends "site&#039;s" to the model instead of "site's"

2 participants