Skip to content

ci: add /cr Claude PR review pipeline - #5

Merged
gandalfboon[bot] merged 3 commits into
boonfrom
worktree-cr-pipeline
Jun 3, 2026
Merged

gandalfboon[bot] merged 3 commits into
boonfrom
worktree-cr-pipeline

Conversation

@insomnius

@insomnius insomnius commented Jun 2, 2026 •

Copy link
Copy Markdown

Summary

Adds a /cr Claude PR review pipeline, replicating getboon/boon's claude-pr-review workflow and wiring it to GitHub Actions in this fork.

New file: .github/workflows/claude-pr-review.yml. It runs the pr-review-toolkit:review-pr skill via anthropics/claude-code-action, posts inline review comments, then a single consolidated severity-grouped summary comment.

  • Triggers: auto on PR open (non-draft, not authored by claude[bot]) and on-demand via a /cr (exact) or /claude-review comment from a human.
  • Advisory: continue-on-error: true — never gates merge. ClawSweeper / CodeQL / opengrep remain the gating reviewers.
  • Model: claude-sonnet-4-6, --max-turns 50, narrow --allowedTools.

Repo-convention adaptations (vs boon's copy)

  • Third-party action SHA-pinned: anthropics/claude-code-action@787c5a0ce96a9a6cfb050ea0c8f4c05f2447c251 # v1.
  • .yml, no tabs, actionlint-clean to pass workflow-sanity.yml.
  • concurrency keyed on PR number with cancel-in-progress.

Operator prerequisite

Requires an ANTHROPIC_API_KEY repo secret. Without it the step fails but continue-on-error keeps the check neutral. Same-repo PRs receive the secret; outside-fork PRs do not (GitHub security) — same posture as boon.

Verification

  • actionlint 1.7.11 (the exact binary workflow-sanity.yml runs) — clean.
  • No-tabs byte scan — clean.
  • YAML parse — valid.
  • v1 tag dereferenced to the pinned commit SHA via the GitHub API.

Real behavior proof

Behavior addressed: New /cr Claude PR review GitHub Action that reviews PRs and posts inline + summary comments.
Real environment tested: Local lint/parse only (no ANTHROPIC_API_KEY available in this environment).
Exact steps or command run after this patch: actionlint .github/workflows/claude-pr-review.yml; tab byte-scan; python3 yaml.safe_load.
Evidence after fix: actionlint exited 0 ("ACTIONLINT CLEAN"); no tabs; YAML parsed OK.
Observed result after fix: Workflow is syntactically valid and passes the same gates CI enforces.
What was not tested: A live review run (opening a PR / commenting /cr) — depends on the ANTHROPIC_API_KEY secret being set; verify on this PR once the secret exists.


Summary by cubic

Adds a GitHub Actions workflow that runs a Claude-powered PR review on new PRs and on-demand via a /cr or /claude-review comment, posting inline comments and a single severity-grouped summary. It’s non-blocking, limits comment runs to trusted roles, and now blocks fork-PR comment runs and omits the id-token to shrink the privileged surface.

  • New Features

    • Adds .github/workflows/claude-pr-review.yml using anthropics/claude-code-action to run pr-review-toolkit:review-pr.
    • Triggers: auto on non-draft PR open; manual via /cr or /claude-review from OWNER/MEMBER/COLLABORATOR only; exact-match commands; skips claude[bot].
    • Posts inline review comments and one consolidated summary grouped by severity.
    • Safety: non-blocking (continue-on-error: true), PR-scoped concurrency with cancel-in-progress, SHA-pinned to v1.
    • Hardening: reject /cr on fork PRs to avoid untrusted checkout; drop id-token permission.
  • Migration

    • Add ANTHROPIC_API_KEY as a repo secret to enable runs (not available to fork PRs).

Written for commit 2d369ec. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai 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.

2 issues found across 1 file

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread .github/workflows/claude-pr-review.yml Resolved
Comment thread .github/workflows/claude-pr-review.yml Resolved
insomnius and others added 2 commits June 3, 2026 13:27
Replicate getboon/boon's claude-pr-review workflow: runs the
pr-review-toolkit:review-pr skill via anthropics/claude-code-action,
posting inline comments plus a consolidated severity-grouped summary.

- Triggers: auto on PR open (non-draft, not claude[bot]) and on a
  /cr or /claude-review comment from a human.
- Advisory (continue-on-error): never gates merge; ClawSweeper/CodeQL
  remain the gating reviewers.
- Adapted to repo conventions: third-party action SHA-pinned to v1,
  .yml, actionlint/no-tabs clean.

Requires an ANTHROPIC_API_KEY repo secret to run.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Address cubic review on PR #5:
- P1: restrict the issue_comment path to OWNER/MEMBER/COLLABORATOR. This
  repo is public and issue_comment runs with secrets regardless of
  commenter, so any drive-by user could otherwise spend the API budget.
- P2: replace contains('/claude-review') with exact match plus a
  'cmd '-prefix allowance, so comments merely mentioning the command
  don't trigger a run.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@insomnius
insomnius changed the base branch from main to boon June 3, 2026 06:28
@insomnius
insomnius force-pushed the worktree-cr-pipeline branch from 52af314 to 26ba389 Compare June 3, 2026 06:28
@insomnius insomnius self-assigned this Jun 3, 2026
Address CodeQL actions/untrusted-checkout(-toctou)/high on PR #5:
- Refuse fork (cross-repository) PRs on the issue_comment path so the
  privileged job never checks out untrusted code; /cr on a fork PR has
  no usable secret anyway, and same-repo branches are push-gated to
  collaborators, so their head is trusted.
- Drop id-token: write; the action authenticates via ANTHROPIC_API_KEY,
  so OIDC is unused and withholding it shrinks the privileged surface.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Comment thread .github/workflows/claude-pr-review.yml Dismissed
Comment thread .github/workflows/claude-pr-review.yml Dismissed

@gandalfboon gandalfboon 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.

Approved — privileged workflow security posture is sound (trusted-role gate, fork refusal before checkout, id-token dropped, continue-on-error, exact-match commands, SHA-pinned action, allowed_bots explicit). All checks green. Pin 787c5a0c verified as a real claude-code-action commit.

@gandalfboon
gandalfboon Bot merged commit 9d0ae04 into boon Jun 3, 2026
79 of 80 checks passed
@gandalfboon
gandalfboon Bot deleted the worktree-cr-pipeline branch June 3, 2026 10:38
william-antoline-boon added a commit that referenced this pull request Oct 1, 2026
* feat(sentry-monitor): tag captures with session_id (ENG-20876)

Reliability Metric #5 tracks per-customer/day error rate (account_id tag,
already live) but has no per-session dimension: session_id was only ever
in contexts, which Sentry does not index, so a session's errors could not
be searched for or grouped. Promotes the session correlation value each
builder already had available into an indexed tag, for model_call_ended,
before_tool_call_hook_failed, message_sent, cron_changed, session_end, and
after_tool_call (whose ctx carries sessionId even though the event itself
doesn't — threaded through register.ts the same way agent_end already
does). delivery_recovery_exhausted and subagent_ended are left untouched:
neither has an existing session_id-shaped value to promote, and inventing
one (which of two session keys subagent_ended's ctx exposes; conflating
sessionKey into session_id with no prior precedent for either hook) is a
bigger call than this ticket asks for.

103 tests pass (60 in captures.test.ts, 8 new), oxlint clean, oxfmt --check
clean.

* fix(deps): bump the brace-expansion override 5.0.9 -> 5.0.12 for GHSA-qhr7-859c-m2p7 / GHSA-6j4f-fj2g-mc7p

Two HIGH advisories published after the 5.0.9 pin (itself a fix for two
older brace-expansion DoS advisories) cover 5.0.9 too: unbounded recursion
on nested brace groups (<5.0.11) and in parseCommaParts (<5.0.10). Moves
the pnpm-workspace.yaml override to 5.0.12 and regenerates pnpm-lock.yaml
+ the root npm-shrinkwrap.json. pnpm-audit-prod (security-fast's gate)
now reports no high-or-higher advisories in production dependencies.

Unrelated to this branch's actual change (session_id tagging) — this was
failing on any current PR against boon, caught while getting CI green.

* fix(feishu): pin timeout-wrapper return types against axios 1.20's new R generic

axios 1.20.0's request/get/post/... methods gained a new R generic
(R = AxiosResponseDefault, an unexported sentinel) so callers can override
the response type. createTimeoutHttpInstance's wrapper methods assign
plain arrow functions against Lark.HttpInstance's own generic method
signature (request<T=any, R=T, D=any>(...): Promise<R>) with no explicit
type arguments on either side. Under contextual inference the two
same-named R type parameters collide, and axios's conditional response
type (R extends AxiosResponseDefault ? AxiosResponse<...> : R) never
reduces, so TS2322 fires on all 8 wrapper methods (check-prod-types,
check-test-types, check-additional-extension-package-boundary).

Pinning each wrapper's return type to `Promise<any>` (Lark's own default
when its R is left unspecified) breaks the collision without changing
behavior — these are pure pass-through wrappers, runtime shape is
unaffected either way.

Verified: pnpm tsgo:core, tsgo:extensions, tsgo:core:test,
tsgo:extensions:test, and test:extensions:package-boundary:compile (117
extensions) all clean. Feishu's own suite (72 files / 962 tests) and
sentry-monitor's (103 tests) still green.

* fix: avoid bare any lint error; update axios pin assertion to 1.20.0

check-lint (both the plain and bundled-extension shard) flagged the
previous fix's 8 inline `Promise<any>` return annotations against
no-explicit-any. Consolidated to one local `WrapperResponse` type alias
with a single oxlint-disable, so the literal `any` token appears once
instead of eight times.

Separately, checks-node-bundle-infra-small-4 failed because
src/infra/npm-managed-root.test.ts asserts the real pnpm-workspace.yaml
override value for axios via toMatchObject — it had "1.18.1" hardcoded
from before this branch's security bump; updated to "1.20.0".

Verified: pnpm lint --threads=8, run-bundled-extension-oxlint.mjs,
tsgo:extensions, test:extensions:package-boundary:compile, the specific
npm-managed-root.test.ts (27/27), and feishu's + sentry-monitor's full
suites all green.

* test: register the new feishu client.ts suppression on the explicit allowlist

test/scripts/lint-suppressions.test.ts inventories every production
oxlint-disable via an explicit allowlist (both an overall list and a
no-explicit-any-specific one) so a new suppression can't slip in
unnoticed. The previous commit's WrapperResponse suppression in
extensions/feishu/src/client.ts was real and intentional but wasn't on
either list yet. Added in the position `git grep` actually returns it
(extensions/ sorts before src/, and bitable.ts before client.ts).

Verified: test/scripts/lint-suppressions.test.ts passes (3/3) against
the real git-tracked suppression set.
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.

2 participants