Skip to content

Read review rules inline instead of forking a skill per file - #355

Merged
theletterf merged 2 commits into
mainfrom
experiment/docs-review-luna
Sep 20, 2026
Merged

theletterf merged 2 commits into
mainfrom
experiment/docs-review-luna

Conversation

@theletterf

@theletterf theletterf commented Sep 20, 2026 •

Copy link
Copy Markdown
Member

Why

docs-review on v1 cannot finish a multi-file PR. Claude Code runs forked skills in the foreground in non-interactive mode — which is exactly how gh-aw runs it — so one fork per skill per file serialises. The orchestrator asks for parallelism and the harness takes it away: ten Skill calls emitted within six seconds, results arriving over 27 minutes.

On a six-file sandbox PR that meant 36 forks at roughly 52s each. It hit the 30-minute cap at 31 of them and posted nothing, for $5.41. docs-content PRs are routinely multi-file, so this is the common case, not an edge case.

What changes

The six rule sets are now Read into the orchestrator's context once per run instead of invoked through the Skill tool. Same model, same engine, same rubric — no subagents.

Measured on identical six-file content:

Forked (v1 today) Inlined (this PR)
Six files timed out at 30 min 4m21s
Comments posted 0 6, 6/6 correctly anchored
Cost $5.41 $0.86

Wall clock is near-flat in file count — 3m34s for one file, 4m21s for six. Reading the rules is a fixed cost; each extra file adds only a read. A 20-file PR extrapolates to about 6-7 minutes, against roughly 3.5 hours forked.

The catalog is untouched. context: fork stays on the skills and is still the right default locally, where forks run in the background and give real concurrency. This only changes how the workflow consumes them.

Also in here

Anchor comments to a line derived with grep -n, with an exactly-one-match pre-flight and a fall back to the review body when a snippet can't be made unique. Across nine sandbox runs, grep -n usage predicted anchor correctness perfectly — six arms, no exceptions. Without it, comments landed up to 134 lines from the text they described, with bodies contradicting their own anchor ("in this sentence", pointing at a heading 37 lines away).

Require elastic.co for documentation links. elastic.com is not an Elastic docs domain; the safe-output sanitizer strips those URLs and leaves mangled markdown like [formatting guidelines]((www.elastic.com/redacted) in the posted comment.

OpenRouter attribution for gh-aw-issue-scope, via the codex provider's http_headers (openai/codex#1473). Scope runs were landing with a null app_id, empty origin, and a random-hash session, so that spend couldn't be attributed to a workflow. Verified end-to-end on the OpenRouter dashboard.

Known gap

Inlining removes the per-criterion evidence gathering that forks forced: 31 elastic-docs MCP calls forked, 3 inlined. Each forked skill independently fetched the published guidance its criterion needed; the orchestrator with all six rule sets in context satisfices instead.

On one dense page that cost roughly a third of recall. On six files it doesn't come close to mattering, because the alternative posts nothing at all — but it should be closed. Two halves, tracked separately:

  • The 7 style-guide fetches are identical every run and belong in a pre-agent step, same pattern as the Vale pre-step. Verified retrievable by plain curl against the anonymous MCP endpoint with includeBody: true — 110 KB, ~27.6K tokens for all six style pages.
  • The content-specific verification (15 searches on this PR, which produced the best findings) can't be pre-fetched, and needs a forced tool-ordering rule with a pre-flight check.

Not in here

The model. Seven arms were compared on one 23-defect page today; Sonnet had the best recall (~21/23 at $1.46) and Luna the best value (15/23 at $0.10). That's a separate decision, and worth making after this lands so a regression can be attributed to one change rather than two.

🤖 Generated with Claude Code

https://claude.ai/code/session_01H3vJ764kbRQMFqEtZxh42b

Related to #402

@theletterf theletterf added the enhancement New feature or request label Sep 20, 2026
@theletterf theletterf changed the title EXPERIMENT: docs-review on GPT-5.6 Luna (not for merge) Evaluate GPT-5.6 Luna for docs-review, and derive comment anchors mechanically Sep 20, 2026
@theletterf theletterf changed the title Evaluate GPT-5.6 Luna for docs-review, and derive comment anchors mechanically Change docs-review to GPT-5.6 Luna, and derive comment anchors mechanically Sep 20, 2026
… per file

docs-review on `v1` cannot finish a multi-file PR. Claude Code runs forked
skills in the foreground in non-interactive mode, which is how gh-aw runs it:
the orchestrator emitted ten Skill calls within six seconds and the results
arrived over 27 minutes. A six-file sandbox PR needed 36 forks at ~52s each,
hit the 30-minute cap at 31 of them, and posted nothing for $5.41.

Reading the six SKILL.md bodies into the orchestrator's context once per run
removes every fork. Measured on identical six-file content: 4m21s and a
complete review with 6/6 correctly anchored comments, against a timeout. Wall
clock is near-flat in file count -- 3m34s for one file, 4m21s for six -- because
reading the rules is a fixed cost and each extra file adds only a read.

The catalog is untouched. `context: fork` stays, and is still the right default
for local use, where forks run in the background and give real concurrency.

Also:

- Anchor every inline comment to a line derived with `grep -n`, with an
  exactly-one-match pre-flight and a fall back to the review body. Across nine
  runs, `grep -n` usage predicted anchor correctness perfectly; without it,
  comments landed on lines up to 134 away from the text they described, with
  bodies contradicting their own anchor.
- Require elastic.co for documentation links. elastic.com is not an Elastic docs
  domain; the safe-output sanitizer strips those URLs and leaves mangled
  markdown in the posted comment.
- Send OpenRouter attribution from gh-aw-issue-scope via the codex provider's
  http_headers (openai/codex#1473). Scope runs were landing with a null app_id
  and a random-hash session. Verified end-to-end on the OpenRouter dashboard.

Known gap: inlining removes the per-criterion evidence gathering that forks
forced -- 31 elastic-docs MCP calls forked, 3 inlined. Tracked separately.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01H3vJ764kbRQMFqEtZxh42b
@theletterf
theletterf force-pushed the experiment/docs-review-luna branch from a371943 to 09a2d96 Compare September 20, 2026 17:50
@theletterf theletterf changed the title Change docs-review to GPT-5.6 Luna, and derive comment anchors mechanically Read review rules inline instead of forking a skill per file Sep 20, 2026
…omment

Reading the rules inline removed the per-criterion evidence gathering that forks
forced: 31 elastic-docs calls forked, 3 inlined. The fact checks are the half
worth keeping -- they are what found "dead letter queue" used for what is now
the failure store, port 8220 applied to Serverless where it does not exist, and
a Fleet Diagnostics button the UI no longer has.

The rule names the tool and takes something away: skip the search and the
finding loses its inline slot. The same shape moved gh-aw-issue-scope from zero
docs-MCP calls in every prior run to search_docs firing before the first repo
read in 3 of 3 sandbox runs.

Style-guide pages are deliberately not pre-fetched. The agent already reads the
six SKILL.md bodies, which encode those rules; the published pages add 110 KB
(~27.6K tokens) against a review whose entire input was 22K.

Verify from the run log, not the review body -- three models today reported
using the MCP server while making zero calls:

  grep tools/call in mcp-logs/rpc-messages.jsonl, count server_id elastic-docs

Baseline is 3. Forked scored 31.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01H3vJ764kbRQMFqEtZxh42b
@theletterf
theletterf marked this pull request as ready for review September 20, 2026 19:21
@theletterf
theletterf requested a review from a team as a code owner September 20, 2026 19:21
@theletterf
theletterf requested a review from technige September 20, 2026 19:21
@theletterf
theletterf merged commit 6867996 into main Sep 20, 2026
7 checks passed
@theletterf
theletterf deleted the experiment/docs-review-luna branch September 20, 2026 19:21

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes: the inline comments identify two workflow-instruction regressions that can break execution and should be resolved before merge.


What is this? | From workflow: PR Review

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.


# Append engine-level custom Codex config
cat >> "/tmp/gh-aw/mcp-config/config.toml" << GH_AW_CODEX_CUSTOM_CONFIG_354d4e24d0867f5e_EOF
[model_providers.openai-proxy.http_headers]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[HIGH] Duplicate TOML table declaration in generated Codex config

[model_providers.openai-proxy.http_headers] is emitted twice in this file (line 919 and this line). The startup script copies the first occurrence into /tmp/gh-aw/mcp-config/config.toml and then appends the same table again, which can make TOML parsing fail at runtime due to table redefinition.

Please keep a single insertion path for this table (in source .md, then regenerate the lock) so the final config contains one http_headers table.

After completing Step 3, run the contradictions skill on the eligible changed files with `Skill({skill: "docs-check-contradictions", args: "<file-path>"})` to find places in the existing docs — both in the local repo and in published Elastic docs — that contradict or conflict with the new or updated content.
After completing Step 3, apply the `docs-check-contradictions` rules you read in Step 3 to the eligible changed files, to find places in the existing docs — both in the local repo and in published Elastic docs — that contradict or conflict with the new or updated content.

Call the skill once for each eligible file, passing the file path as the argument. If there are many eligible files, group them by directory and call the skill once per directory instead.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MEDIUM] Step 4 still instructs forbidden Skill invocation

This workflow now states Do not use the Skill tool in this workflow (line 352), but this line still says to call the skill per file. The conflicting instructions can push the agent back into Skill calls and break the intended inlined-rules execution path.

Update Step 4 to apply the already-read docs-check-contradictions rules directly (no Skill calls), matching the Step 3 model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant