Skip to content

feat(scripts): add warn-only gate for git-bearing multi-line precompute blocks - #2442

Merged
kyle-sexton merged 2 commits into
mainfrom
cursor/skill-precompute-git-gate-5aad
Aug 12, 2026
Merged

kyle-sexton merged 2 commits into
mainfrom
cursor/skill-precompute-git-gate-5aad

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Aug 12, 2026 •

Copy link
Copy Markdown
Member

Implements the static gate proposed in #1662.

Summary

Decision brief (#1662)

RECOMMENDED: warn-first gate in CI, graduate to --strict once #1619 remediation clears existing violations. This PR ships warn-only as recommended.

Closes #1662.

Related

…te blocks

Encodes the #1619 composition rule: a skill whose Pre-computed context
section has more than one inline injection and any git command will be
refused in worktree-isolated agents. Warn-only by default until the
#1619 remediation wave graduates the gate to --strict.

Closes #1662.

Co-authored-by: Kyle Sexton <kyle-sexton@users.noreply.github.com>
@cursor

cursor Bot commented Aug 12, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@claude

claude Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

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


Security review complete

  • Gather context (PR diff, changed files)
  • Review scripts/check-skill-precompute-compose.sh
  • Review scripts/check-skill-precompute-compose.test.sh
  • Review .github/workflows/ci.yml changes
  • Post findings

No security issues found.

This PR adds a static, read-only lint script (warn-only by default) and wires it into an existing CI job — no new trust-boundary crossing:

  • ci.yml adds two steps to the existing skill-quality-gate job, which runs on pull_request (not pull_request_target), with top-level permissions: contents: read and persist-credentials: false on checkout — no secrets or elevated tokens reach these steps, and the new commands (bash scripts/check-skill-precompute-compose.test.sh, scripts/check-skill-precompute-compose.sh --all) take fixed literal arguments, not PR-controlled input.
  • check-skill-precompute-compose.sh only reads repo-local SKILL.md files via awk/grep on quoted variables — no eval, no sourcing/execution of file content as commands, no network calls, no credential handling. The one path that takes an external "base ref" argument (git rev-parse --verify -- "${base}^{commit}", git diff --name-only "$base") passes it as a discrete argument (not interpolated into a shell string), so it isn't an injection vector, and it's not the code path CI actually exercises (CI always calls --all).
  • The test script (check-skill-precompute-compose.test.sh) only operates against mktemp -d fixtures it creates itself.

Nothing here matches the injection, authorization, secret-handling, or workflow-permission risk patterns this review was scoped to catch. (Supply-chain/action-pin and workflow-trigger/permission patterns are deferred to zizmor's advisory lane per review scope, and I didn't find anything in that category here either — the added steps don't touch permissions:, pinning, or triggers.)

@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: 6ede4bc110

ℹ️ 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".

@claude

claude Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @kyle-sexton's task in 5m 14s —— View job


Review complete

Tasks

  • Gather context (diff, CLAUDE.md, REVIEW.md)
  • Review scripts/check-skill-precompute-compose.sh
  • Review scripts/check-skill-precompute-compose.test.sh
  • Review .github/workflows/ci.yml changes
  • Post findings

(Root CLAUDE.md and .claude-pr/CLAUDE.md are both empty in this checkout — nothing repo-specific to apply beyond REVIEW.md, which scopes this lane to correctness/design/tests and defers security findings; none of the below are security findings.)

Posted 3 inline comments on scripts/check-skill-precompute-compose.sh:

  1. Important — L93–102: the <base-ref> mode's git rev-parse validation and its exit 2 run inside the < <( … ) process substitution feeding mapfile. In bash that exit only kills the subshell — it never reaches the parent script's exit status. An invalid base ref therefore prints an error to stderr but the script still reports 0 skill(s) scanned and exits 0, contradicting the documented contract (2 = usage / environment error) and the fail-closed posture the sibling check-skill-portability.sh achieves by doing the same validation outside any subshell. I confirmed the process-substitution mechanics by inspecting bash semantics and cross-checking the sibling script's equivalent code path, which is structured differently for exactly this reason.
  2. Important — L63–66: line_has_git's regex requires git to immediately follow whitespace/|/backtick/start-of-line. A git call nested inside an outer command substitution — e.g. !`echo "branch: $(git branch --show-current)"` — is preceded by (, so it's never detected. I verified this directly by running the exact ERE against that line with the Grep tool: no match. Since the gate's whole purpose is catching git in precompute blocks, and $(git …) is a very natural way to interpolate git output into formatted text, this is a realistic hole in the detection the PR is built around.
  3. Suggestion — L77–78: line_count is incremented once per physical line that contains at least one !`…` (via grep -q), not once per injection. Two separate injections packed onto one line (one of them git) won't trip line_count > 1, even though that's the composition shape the PR body itself describes.

Test coverage gap (context for #1): check-skill-precompute-compose.test.sh only ever exercises --paths mode — it has zero coverage of --all (the only mode actually wired into CI, at ci.yml#L1015) or of <base-ref> mode at all. The sibling check-skill-portability.test.sh tests both of those modes with real git fixtures (e.g. L579-630) — that's almost certainly why finding #1 wasn't caught here.

Minor, not filed inline: the <base-ref> diff at L107 uses a plain git diff --name-only without --diff-filter=d or NUL-delimited (-z) output, unlike check-skill-portability.sh, which explicitly does both to avoid silently dropping deleted files or C-quoted paths. Low impact today since only --all runs in CI, but worth aligning if <base-ref> mode ever gets wired in.

What looked solid: placement in the skill-quality-gate job and self-test-before-gate ordering both match repo convention; warn-only default matches the PR's stated decision brief; exit-code contract (0/1/2) is otherwise consistent with sibling scripts; --strict/--all/--paths argument parsing handles interleaving correctly for the cases I traced through.

Findings 1–3 are all things I verified directly (regex tested against real input via the Grep tool; process-substitution exit semantics traced through the actual code), not restatements of the PR's own claims. I did not run the test suite itself in this sandbox (script execution required an approval step unavailable here), so CI's own run of check-skill-precompute-compose.test.sh and --all is the authoritative pass/fail signal for the tests as currently written.
· Branch

@github-actions

Copy link
Copy Markdown
Contributor

Claude has reviewed this PR 1 time. The lane skips further automatic reviews after 5; deleting this comment resets the count.

Co-authored-by: Kyle Sexton <kyle-sexton@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

Warning

Automated security review did not complete — this is an infrastructure failure, not a review verdict.

Treat any Claude comment on this PR (including a placeholder like "I'll analyze this and get back to you") as incomplete, not "no findings."

The check is green on purpose, and it is not evidence. It certifies that a security pass ran, and this one did not complete — but the cause is outside this PR's control, so merging is deliberately left unblocked rather than locking every merge for the length of the outage. Nothing was reviewed at this head. Where this check is required, it is satisfied without that evidence; a human should review security-sensitive changes here before merging.

Re-run the job to retry the review; a new push also retries it only if the caller's pull_request triggers include synchronize (the canonical security caller keeps it). An automatic retry may already have run — it is skipped when a partial review could duplicate comments, or when the failure class needs an operator.

Re-running does NOT help for every class:

  • rate-limit that persists across re-runs, or auth — the credential or usage budget needs an operator; retrying will not clear it.
  • a run that exhausted its turn budget ("subtype":"error_max_turns" above) will exhaust it again. As the PR author, split the change into smaller PRs; raising --max-turns is a change to the caller workflow, not something you can set on this PR.

@kyle-sexton
kyle-sexton merged commit b4ec8c7 into main Aug 12, 2026
1 check passed
@kyle-sexton
kyle-sexton deleted the cursor/skill-precompute-git-gate-5aad branch August 12, 2026 12:57
@github-actions

Copy link
Copy Markdown
Contributor

Warning

Automated review did not complete — this is an infrastructure failure, not a review verdict.

Treat any Claude comment on this PR (including a placeholder like "I'll analyze this and get back to you") as incomplete, not "no findings."

Re-run the job to retry the review. A new push re-triggers this lane only if the caller's pull_request triggers include synchronize (the canonical caller omits it).
An automatic retry may already have run — it is skipped when a partial review could duplicate comments, or when the failure class needs an operator (auth).

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.

ci(skills): no gate catches a second precompute line silently breaking a git-bearing skill under worktree isolation

2 participants