Skip to content

fix(ai-slop): skip generated regions in audit and fix - #7646

Merged
kyle-sexton merged 3 commits into
mainfrom
fix/pr-refine-skip-generated-blocks
Oct 17, 2026
Merged

kyle-sexton merged 3 commits into
mainfrom
fix/pr-refine-skip-generated-blocks

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

Closes #7554

Summary

The pr-refine / fix-docs lane runs ai-slop:audit fix (docs/conventions/pr-pipeline.yaml:6-7). Neither the audit's detector nor its fix flow knew about generated regions, so the fix pass rewrote prose inside the plugin-options README block that scripts/sync-plugin-options-docs.py owns, and check-plugins then failed with STALE options docs.

Fix

  • plugins/ai-slop/skills/audit/scripts/detect.sh: a standalone <!-- BEGIN GENERATED: ... --> line through the next standalone <!-- END GENERATED: ... --> line is dropped before any rule runs, like fenced code. A backticked mention opens nothing. A region with no END line is reported on stderr, as an unclosed fence is.
  • plugins/ai-slop/skills/audit/SKILL.md: neither layer audits a generated region, and the fix flow never edits it, rubric and voice rewrites included. That covers the reported edit, which was a judgment rewrite rather than a detector finding.
  • reference/catalog.md: the policy-level exemption lists generated regions.

The rule keys on the shared BEGIN GENERATED: / END GENERATED: spelling, so it also covers the convention-home, config-cascade and instruction-placement generators, not only plugin options.

Verification

  • bash plugins/ai-slop/skills/audit/scripts/detect.test.sh: All 248 cases passed. The 4 new cases cover prose outside a region still being flagged, the line after END being scanned again, region content staying exempt, a backticked marker mention opening nothing, and an unclosed region being reported.
  • detect.sh over all 65 tracked markdown files that carry a BEGIN GENERATED: marker: no unclosed-region warning.
  • shellcheck on detect.sh and detect.test.sh: clean.
  • scripts/check-changelog-fragments.sh --check and --check-required origin/main: pass.

Related

🤖 Generated with Claude Code

https://claude.ai/code/session_01142G3q93eRo5F2pCccf74t

The pr-refine fix-docs lane runs ai-slop:audit fix, which rewrote prose
inside the plugin-options README block that
scripts/sync-plugin-options-docs.py owns, so check-plugins failed with
STALE options docs. A standalone BEGIN GENERATED / END GENERATED pair now
bounds a region neither the detector nor the fix flow touches; an
unclosed region is reported on stderr.

Closes #7554

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01142G3q93eRo5F2pCccf74t
@kyle-sexton
kyle-sexton marked this pull request as ready for review October 16, 2026 19:04
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T19:08:36.118971Z 16ea141 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@claude

claude Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 1m 41s —— View job


Security review complete

  • Gather context (PR diff, changed files)
  • Review detect.sh changes for injection / logic issues
  • Review SKILL.md / catalog.md changes for instruction-surface concerns
  • Review test script changes
  • Report findings

No security issues found.

This PR adds a "generated region" exemption to the ai-slop audit's text extractor
(detect.sh):
a standalone line through the next standalone line is skipped by the extractor before any rule runs, mirroring
the existing ai-slop-ignore-start/ai-slop-ignore-end marker mechanism.

Checked for:

  • Injection / unsafe eval: the new matches are fixed regex literals matched against $0
    ($0 ~ /.../) — file content is never interpreted as code, concatenated into a command, or
    used to build a path. No system(), eval, or shell-out introduced.
  • ReDoS: the new patterns ([^>]* between fixed anchors) are linear, not nested/ambiguous
    quantifiers — no catastrophic-backtracking shape.
  • Control-flow correctness that could matter for scope: a BEGIN GENERATED marker found
    while already inside a fenced code block is not honored (the fence branch returns first), so a
    region can't be opened from inside code — and once a region is open, fence/ignore-marker
    handling is bypassed until END GENERATED or EOF, matching the stated "nothing inside is
    scanned" contract. An unclosed region is reported on stderr like an unclosed fence, so it fails
    loud rather than silently misscanning the rest of the file.
  • Instruction-surface weakening: this isn't a removal/narrowing of a security control. The
    ai-slop audit is a prose-style linter (em dashes, emoji, AI vocabulary), not a security
    boundary, and the new marker has the same self-declared trust model as the pre-existing
    ai-slop-ignore-* markers already in the file — anyone who can edit a markdown file could
    already exempt arbitrary text from this audit. This change doesn't expand that trust boundary
    in a new direction.

No CI workflow files were touched, so Actions-hardening concerns (zizmor's lane) don't apply here.

claude-lane-summary: lane=claude-security-review sha=16ea14133c9b233bc54ccd9a57bd39c2b99839d0 run=38952143892

@claude

claude Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 4m 11s —— View job


Code review

  • Gather context (diff, changed files, CLAUDE.md/REVIEW.md)
  • Review detect.sh region-skip logic
  • Review detect.test.sh new cases
  • Review SKILL.md and catalog.md changes
  • Check changelog fragment
  • Post findings

Findings

1. The fix doesn't cover the layer the bug actually came from (inline comment on plugins/ai-slop/skills/audit/SKILL.md lines 61–65).

The PR body says the original edit (#7554) was "a judgment rewrite rather than a detector finding," but the only code change here is in detect.sh — the deterministic/script layer. The rubric (judgment) layer, which runs through a separate dispatch pipeline, is untouched:

  • context/rubric-fanout.md#L85 lists the exact "boundary rules" handed to each rubric subagent (fenced code, blockquotes, double-quoted spans, inline code, YAML frontmatter, table cells) — generated regions aren't in that list.
  • scripts/rubric-fanout.sh#L502-L512 (cmd_extract) only pulls ### rule- sections tagged v1: rubric plus "Signs of human writing" out of catalog.md. The "Quotation exemption (policy-level)" section — exactly where this PR's catalog.md edit added "generated regions" — is dropped by that extraction, so the rubric subagent never sees it either.

Net effect: SKILL.md's new claim ("Neither layer audits it ... rubric and voice rewrites included") and the matching changelog-fragment wording aren't backed by the rubric pipeline. A rubric finding can still be generated for, and rewritten inside, a generated region — i.e. the reported bug can still recur through the path that reportedly caused it. Full detail and repro trail are in the inline comment.

Everything else checked out:

  • detect.sh's new gen_line state machine (standalone BEGIN/END markers, backtick-quoted mentions not opening a region, unclosed-region stderr warning, re-scanning after END) is placed consistently with the existing fence/ignore-marker precedence and looks correct.
  • The 4 new detect.test.sh cases match the behavior they claim to cover; author-claimed verification (248/248 passing, shellcheck clean) is unverified by me — I did not re-run the test suite in this review.
  • reference/catalog.md's one-line exemption addition is accurate for the detector but, per the finding above, not for the rubric layer it also describes.

claude-lane-summary: lane=claude-review sha=16ea14133c9b233bc54ccd9a57bd39c2b99839d0 run=38952143602

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review has reviewed this pull request through 6c996aa; a later push is reviewed from there.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 16ea14133c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread plugins/ai-slop/skills/audit/SKILL.md Resolved
Comment thread plugins/ai-slop/skills/audit/SKILL.md Resolved
@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

claude-review has reviewed this pull request through 6c996aa; a later push is reviewed from there.

@claude

claude Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 1m 23s —— View job


Security review complete

  • Gather context (PR diff, changed files)
  • Review detect.sh changes for injection / logic issues
  • Review SKILL.md / catalog.md changes for instruction-surface concerns
  • Review test script changes
  • Report findings

No security issues found.

The code at HEAD (b61bb82) is unchanged from the last-reviewed commit (16ea141) in every file this PR touches — the merge from origin/main only brought in unrelated changelog fragments for other plugins. Re-confirming the prior pass against the current head:

  • detect.sh lines 516–519 and line 551: the new gen_line state machine matches fixed regex literals against $0 only ($0 ~ /.../). No system(), eval, or shell interpolation of file content — file content never becomes code or a path.
  • The new patterns ([^>]* between fixed anchors, inside ^[[:space:]]*...[[:space:]]*$) are linear-time; no nested/ambiguous quantifiers, so no ReDoS shape.
  • A BEGIN GENERATED marker found while already inside a fenced code block isn't honored (the fence branch returns first), so a region can't be opened from inside code; an unclosed region is reported on stderr like an unclosed fence rather than silently misscanning the rest of the file.
  • This is a prose-style linter, not a security boundary, and the new marker has the same self-declared trust model as the pre-existing ai-slop-ignore-* markers in the same file (anyone who can edit a markdown file could already exempt text from this audit). Checked the new exemption against the instruction exception register's protected classes (irreversible-action, secret-handling, data-integrity, external-publication, legal-compliance, agent-authority) — a style-audit scanning rule matches none of them, so the broadened exemption isn't a Gate 0 deletion/narrowing concern.
  • SKILL.md/catalog.md/changelog-fragment changes are documentation only; detect.test.sh changes are fixtures/assertions only — no execution surface.

Note: a separate review already flagged (as a correctness/code-quality finding, not security) that the rubric fan-out layer isn't wired to skip generated regions, so the stated "neither layer audits it" guarantee doesn't hold end-to-end. That's a functional gap, not an exploitable security boundary, since the ai-slop audit doesn't gate anything security-sensitive — out of scope for this lane.

No CI workflow files were touched, so Actions-hardening concerns (zizmor's lane) don't apply here.

claude-lane-summary: lane=claude-security-review sha=b61bb822bb328a8e00fab3d6e0d9a16fbe02fbac run=39005746894

@claude

claude Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 50s —— View job


Code review complete

  • Gather context (diff, changed files, CLAUDE.md/REVIEW.md)
  • Review detect.sh region-skip logic
  • Review detect.test.sh new cases
  • Review SKILL.md and catalog.md changes
  • Check changelog fragment
  • Post findings

Result: skip gate — no new review needed

The new HEAD (b61bb822) is a merge of origin/main into this branch. I diffed 16ea1413 (the commit this lane already reviewed) against b61bb822 and confirmed the merge touched no file this PR owns — plugins/ai-slop/skills/audit/{SKILL.md,reference/catalog.md,scripts/detect.sh,scripts/detect.test.sh} and the changelog fragment are byte-identical to what was already reviewed:

git diff 16ea1413 b61bb822 -- plugins/ai-slop .changes/ai-slop
# (no output)

So this lane's prior review at 16ea1413 — including the outstanding finding that the rubric/judgment layer (context/rubric-fanout.md, scripts/rubric-fanout.sh cmd_extract) still has no generated-region boundary, so the bug #7554 describes can recur through that path even though detect.sh is fixed — still fully applies unchanged. Per the skip-gate rule for this lane ("this head already has a successful review from this lane that still applies"), I'm not re-posting that finding or opening new inline comments; the existing review thread covers it. Nothing new to report.

claude-lane-summary: lane=claude-review sha=b61bb822bb328a8e00fab3d6e0d9a16fbe02fbac run=39005746950

…check

The rubric fan-out prompt's boundary list and its cue counter, and the
closing em-dash cross-check, still read generated regions, so the rubric
layer could still edit them and the cross-check reported a false Disagree
row. Each parser now skips a BEGIN GENERATED / END GENERATED region; the
parsers stay separate, since cross-check.sh is an independent parse by
design.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01142G3q93eRo5F2pCccf74t
@claude

claude Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 4m 24s —— View job


Code review complete

  • Gather context (incremental diff, custom instructions)
  • Read changed files: rubric-fanout.md, cross-check.sh/.test.sh, rubric-fanout.sh/.test.sh, changelog fragment
  • Run /review:code-review procedure over the incremental scope
  • Post findings

Scope

Reviewed only the diff since b61bb822 (.claude-lane/incremental.diff): cross-check.sh, cross-check.test.sh, rubric-fanout.md, rubric-fanout.sh, rubric-fanout.test.sh, and the changelog fragment. This is the follow-up to the gap both prior review lanes flagged at 16ea1413/b61bb82: the rubric (judgment) layer and the closing cross-check weren't wired to skip generated regions, so the bug #7554 describes could recur through that path even with detect.sh fixed.

Findings

None. The incremental change closes both previously flagged gaps:

  • Closing cross-check (cross-check.sh#L94-96,128) now carries the same gen state machine as detect.sh, with identical precedence (checked before fence tracking, honored only when fence/block state is clear, BEGIN GENERATED recognized only after fence logic so a marker inside a fence doesn't open a region). I traced this against the exact repro Codex cited, plugins/user-interface/tests/fixtures/config-project/AGENTS.md, which has an em dash on line 4 inside a BEGIN GENERATED/END GENERATED block — with this fix, cross-check.sh now skips that line the same way detect.sh does, so the false Disagree: row is gone. The new test cases in cross-check.test.sh (generated-region em dash not counted, backtick-quoted marker mention opens nothing) match this.
  • Rubric fan-out: the dispatch boundary list in rubric-fanout.md#L85-87 now names generated regions alongside fenced code/blockquotes/etc., and the saturation-cue counter in rubric-fanout.sh's cmd_plan (rubric-fanout.sh#L417,L430-433,L458) carries the same gen skip, with the same ordering relative to fence/HTML-comment state as detect.sh. I confirmed the second $CUE_AWK use site (merge/consistency check, ~line 640) doesn't need the same change — it parses subagent result files, not raw source markdown, so it's out of scope for a raw-content boundary rule. New tests in rubric-fanout.test.sh cover a cue inside a generated region not counting and one after it counting.

Both files' EXPECTED_CASES counts were bumped to match the new assertions (24→26, 177→179), and the changelog fragment's wording was updated to mention the cross-check and rubric-fanout changes. I wasn't able to execute the test suites in this sandbox (script execution is denied here), so I verified the logic by tracing it line-by-line against detect.sh's already-reviewed state machine rather than by running cross-check.test.sh/rubric-fanout.test.sh.

claude-lane-summary: lane=claude-review sha=6c996aa7ac3d7eccb3322209a0ca29db56b2bb95 run=39006774276

@claude

claude Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 1m 23s —— View job


Security review complete

  • Gather context (incremental diff since b61bb82, scoped to the listed files)
  • Review cross-check.sh / cross-check.test.sh generated-region skip logic
  • Review rubric-fanout.sh / rubric-fanout.test.sh generated-region skip logic
  • Review rubric-fanout.md doc change and changelog fragment
  • Check for instruction-surface concerns (this diff adds an audit exemption)
  • Report findings

No security issues found.

This increment wires the same "generated region" exemption that detect.sh already had (reviewed at 16ea141/b61bb82) into the two layers a prior review on this PR flagged as missing it: the closing cross-check.sh em-dash recount and the rubric-fanout.sh cue-count/dispatch pipeline. No new execution surface and no change to trust model:

  • cross-check.sh lines 91, 96, 128: the new gen state is matched with fixed regex literals against $0/line only (line ~ /.../). No system(), eval, or shell interpolation of file content into a command or path.
  • rubric-fanout.sh lines 417, 430-433, 458: same pattern — gen is reset per file (S++; fence = ""; gen = 0; ... at line 417) and toggled on fixed anchors only.
  • Precedence is consistent with the already-reviewed detect.sh behavior: in both files, the BEGIN GENERATED check sits after the fence/HTML-comment-open check, so a marker found inside an already-open fence or comment doesn't open a region (can't be smuggled out of fenced code); and in cross-check.sh the gen check sits before fence handling, so once a region is open its content isn't fed through fence-tracking either. No path lets region content leak into the counted/audited stream or vice versa.
  • ReDoS: all new patterns ([^>]* between fixed anchors) are linear — no nested/ambiguous quantifiers.
  • Instruction-surface / exemption scope: this expands an existing self-declared exemption (same mechanism as the pre-existing ai-slop-ignore-* markers) to more pipeline stages; it doesn't create a new kind of exemption or touch a different trust boundary. The ai-slop audit is a prose-style linter, not a security control, so this doesn't match any class in the instruction exception register (irreversible-action, secret-handling, data-integrity, external-publication, legal-compliance, agent-authority).
  • rubric-fanout.md and the changelog fragment are documentation-only changes describing this wiring; cross-check.test.sh / rubric-fanout.test.sh additions are fixtures/assertions only, no execution surface.

No CI workflow files were touched, so Actions-hardening concerns (zizmor's lane) don't apply here.

claude-lane-summary: lane=claude-security-review sha=6c996aa7ac3d7eccb3322209a0ca29db56b2bb95 run=39006774365

@kyle-sexton
kyle-sexton added this pull request to the merge queue Oct 17, 2026
Merged via the queue into main with commit 18f3d56 Oct 17, 2026
27 checks passed
@kyle-sexton
kyle-sexton deleted the fix/pr-refine-skip-generated-blocks branch October 17, 2026 06:01
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.

fix(ci): the fix-docs lane hand-edits generated plugin-options README blocks, failing check-plugins

1 participant