Repository navigation
Studio Code: Show a core block's declared settings in tool results that show the block - #5307
Merged
Merged
Conversation
chubes4
marked this pull request as ready for review
October 23, 2026 01:54
Collaborator
📊 Performance Test ResultsComparing daa71b2 vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
This was referenced Oct 23, 2026
chubes4
added a commit
that referenced
this pull request
Oct 23, 2026
…y changes (#5308) ## Related issues - Of the 120 PRs merged since Oct 1, 20 changed only Studio Code agent files (`apps/cli/ai/**`, `apps/cli/commands/ai/**`, `scripts/eval/**`). Each one still waited on desktop E2E and Performance Metrics, the two slowest jobs (about 17.5 min each on build 23481), even though neither suite runs agent code. ## How AI was used in this PR Claude (via the Pi coding agent in a Roadie session) measured job times from Buildkite logs, classified merged PRs by changed paths, checked which suites can reach agent code, and wrote the change. I reviewed the diff and the evidence. ## Proposed Changes `should-skip-job.sh` gets an `AGENT_PATTERNS` list and an `e2e` job type: - **Desktop E2E** (`run-e2e-tests.sh`) now uses `--job-type e2e`: the `validation` rules, plus a skip when every changed file is an agent file. - **Performance Metrics** adds the same agent patterns to its existing skip list. - **Lint, Unit Tests and CLI E2E** keep `--job-type validation` and still run on agent-only PRs. A skipped job exits 0 the same way the existing docs-only skips do, so the required statuses still report as passed. Why these two suites never exercise agent code: - The desktop E2E sessions launch with `agenticFeaturesEnabled: false` (`apps/studio/e2e/e2e-helpers.ts`), and no desktop test drives the chat or Studio Code. - The metrics suites (`tools/metrics/tests/{app-size,site-editor,site-startup}`) measure app size, site editor load and site startup. - The agent is loaded lazily from `apps/cli/index.ts` (`cli/commands/ai`) and from `studio mcp`. The one module under `apps/cli/ai/` used outside the agent, `browser-utils.ts`, is reached only through URL imports (`data-liberation-client`, `capture-preview`). The desktop E2E suite doesn't test those, and Unit and CLI E2E still run on any change to it. A PR that also touches anything else (`apps/ui`, `packages/common`, other `apps/cli` code, `package.json`) runs every job as before. One thing an agent-only PR no longer gets: the app-size line of the performance comment. `compare-perf` never fails a PR, and dependency changes still run metrics. Expected effect on agent-only PRs: the gate drops from about 19 min (p50 of the 39 PR builds since build 23377) to about 10 min, set by CLI E2E on Windows. ## Testing Instructions This PR only touches `.buildkite/**`, which the existing rules already skip, so its own CI doesn't run the new path. To check it locally: - Real diff: from a checkout of #5307 (`daa71b227`, agent-only), run `BUILDKITE_PULL_REQUEST=5307 BUILDKITE_PULL_REQUEST_BASE_BRANCH=trunk .buildkite/commands/should-skip-job.sh --job-type <type>`. Result: `validation` runs (exit 1), and `e2e` and `metrics` skip (exit 0). - Stubbed `pr_changed_files` with fixed file lists: | Changed files | validation | e2e | metrics | build | |---|---|---|---|---| | agent only (`apps/cli/ai/**` + tests) | run | skip | skip | run | | `apps/cli/commands/ai/**` + `scripts/eval/**` | run | skip | skip | run | | agent + `apps/cli/commands/site/create.ts` | run | run | run | run | | agent + `apps/ui/**` | run | run | run | run | | agent + `packages/common/ai/**` | run | run | run | run | | `apps/ui/**` only | run | run | run | run | | docs only | skip | skip | skip | skip | | `apps/studio/e2e/**` only | run | run | skip | run | - `bash -n` passes. `shellcheck` reports nothing on the changed lines; its two findings are on existing lines. ## Pre-merge Checklist - [x] Lint, Unit Tests and CLI E2E still run on agent-only PRs. - [x] Mixed PRs run every job as before.
Contributor
It would also help to know how often the "rebuild a built-in block setting in JS/CSS" pattern shows up in real sessions beyond this eval. That would tell us how much this is worth beyond the one case. |
1 task done
chubes4
added a commit
that referenced
this pull request
Oct 23, 2026
…5333) ## Related issues - Follows #5307, addressing the review there: the block settings notes only reached Studio Code, not agents using `studio mcp`. ## How AI was used in this PR Claude (via the Pi coding agent in a Roadie session) wrote the change and the test and ran the end-to-end check below. I reviewed the diff and the results. ## Proposed Changes #5307 adds the declared settings of each core block a tool result shows (read from the site's own `wp-includes/blocks/<block>/block.json`). The notes are wired up in the Pi runtime's `toToolDefinition`, which the MCP server bypasses: it calls `tool.rawHandler` directly. So Claude Code, Codex, and the AI plugins never got them. - **One module for result notes, `cli/ai/result-notes.ts`.** `createResultNotes()` returns `( sitePath, text ) => notes`: the facts read from that site about what the result shows, each stated once per tracker. Block settings are the only kind today; a new kind is added there and reaches every surface. - **Both surfaces use it the same way.** Each creates one tracker per conversation it can see and passes the site it works on: - Studio Code: one per turn, with the turn's active site (as #5307 did). - `studio mcp`: one per MCP session, with the site the call names (`nameOrPath`). A call that names no site, or one that isn't found, gets no notes. - The MCP call path moves into `runtimes/mcp/served-tool.ts` (`runServedTool`); pending work reports and error handling are unchanged. Limits: - MCP clients read theme files with their own Read tool, which never passes through Studio. Notes only fire for Studio tools (`wp_cli` and the like), not for files the client reads itself. - Once per tracker means a note stated early can be lost if the context is compacted later: within a Studio Code turn (the tracker is created in `createStudioAgentSession`, which `runAgentSessionTurn` calls, so it is per turn, not per session), and within an MCP session, whose compaction Studio can't see. ## Testing Instructions - `npx vitest run apps/cli/ai/runtimes/mcp`: `served-tool.test.ts` resolves a real site from a `cli.json` (no mocks): no notes for a call without a site or with an unknown one, the settings for the named site, then none on a repeat call in the same session. - End-to-end, on a throwaway site with an isolated config: built the CLI, ran `studio mcp` over stdio, and called `wp_cli` with `post get 2 --field=post_content` twice, then `option get blogname`. The first result had the page content plus: ``` core/paragraph settings, declared in <site>/wp-includes/blocks/paragraph/block.json: dropCap (boolean, default false), placeholder (string), direction ("ltr"|"rtl"). core/quote settings, declared in <site>/wp-includes/blocks/quote/block.json: textAlign (string). ``` The repeat call and `option get blogname` had no notes. ## Pre-merge Checklist - [x] Have you checked for TypeScript, React or other console errors?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issues
How AI was used in this PR
Claude (via the Pi coding agent in a Roadie session) read the failing eval transcripts, wrote the change and its tests, and ran the evals below. I reviewed the code and the transcripts.
Proposed Changes
When a tool result shows block markup, Studio Code adds one line for each core block type in it, listing the settings that block type declares in the site's own
wp-includes/blocks/<block>/block.json. For example:source) are content, so they are left out, along with internal__unstable/__experimentalones.wp_cli post get,ReadandBash catall get it.block.jsonare skipped.Why. In the template-part eval ("Make the header navigation open its submenus on click instead of on hover"), the failing runs reason "there's no built-in 'open on click' toggle … this requires custom JavaScript", then write a script and CSS into the theme, at 1–1.7M tokens per run. The navigation block declares
submenuVisibility: "click". The model doesn't remember it and has no reason to openblock.json. Stating the declared settings where the block appears means the model reads them while it is looking at the block.Testing Instructions
npx vitest run apps/cli/ai/tests/block-settings.test.ts: describes the core blocks in a header from theirblock.json, describes each one once, and leaves out content attributes, closing comments and blocks without ablock.json.template-part-db-override, 6 runs per arm, run against this branch and current trunk (09253bcef) at the same time:One trunk run stalled at the 420s timeout after 91k tokens without reaching an answer. It is left out above as an infrastructure stall. Counted as a failure, trunk is 4/6.
core/navigation settingsline in thepost get 5orRead parts/header.htmlresult, and every branch run setsubmenuVisibilityin the saved header. No branch run wrote JavaScript or read core'snavigation/view.js. On trunk, one run wrote a script and another readview.jsthree times before finding the setting.global-styles-db-overridedesign-system-annotationactive-site-reusedBoth trunk failures are unrelated to this change: one is a port collision during inspection, the other discarded the saved styles. The settings line appeared in only 1 of these 18 runs (it passed), because these tasks rarely read block markup, so this check shows no harm rather than a gain.
Pre-merge Checklist