Skip to content

ci: add manual gate-close workflow for missed PRs - #1283

Merged
ryoppippi merged 1 commit into
mainfrom
ci/manual-gate-close
Jun 11, 2026
Merged

ryoppippi merged 1 commit into
mainfrom
ci/manual-gate-close

Conversation

@ryoppippi

@ryoppippi ryoppippi commented Jun 11, 2026 •

Copy link
Copy Markdown
Member

What

Add a workflow_dispatch workflow that closes a given PR number with the same message the PR Gate posts, attributed to github-actions[bot].

Why

The PR Gate only fires on pull_request_target opened. PRs opened while the gate was misconfigured (e.g. #1281) cannot be retroactively auto-closed, and closing them from a local gh would be attributed to a maintainer rather than the bot. This workflow lets a maintainer dispatch a bot-attributed close for any PR the gate missed.

Safety

Same posture as the PR Gate: no actions/checkout, only GitHub API calls via github-script, scoped token permissions (issues: write, pull-requests: write). The PR number comes from a trusted workflow_dispatch input.


View with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is enabled.


Summary by cubic

Adds a manual workflow to close PRs the gate missed, attributed to github-actions[bot]. Lets maintainers retro-close PRs opened while the gate was misconfigured.

  • New Features
    • Adds .github/workflows/gate-close-pr.yaml; runs on workflow_dispatch with input pr_number.
    • Posts the same contribution-gate message as the PR Gate, then closes the PR via API.
    • Uses actions/github-script@v9; no checkout; scoped permissions (issues: write, pull-requests: write).

Written for commit 5bbe8b5. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Chores
    • Added a new GitHub Actions workflow for automated pull request management.

The PR Gate only fires on `pull_request_target` `opened`, so PRs that
were opened while the gate was misconfigured (e.g. #1281) cannot be
retroactively auto-closed. Add a `workflow_dispatch` workflow that
closes a given PR number with the same contribution-gate message,
attributed to github-actions[bot] like the gate itself.
@pullfrog

pullfrog Bot commented Jun 11, 2026 •

Copy link
Copy Markdown
Contributor

This run was cancelled 🛑

The workflow was cancelled before completion. Please check the link below for details.

Pullfrog  | View workflow run | via Pullfrog | 𝕏

@coderabbitai

coderabbitai Bot commented Jun 11, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 08bbe68a-d68f-47b3-b92e-55ab1fcd4adc

📥 Commits

Reviewing files that changed from the base of the PR and between 4254918 and 5bbe8b5.

📒 Files selected for processing (1)
  • .github/workflows/gate-close-pr.yaml

📝 Walkthrough

Walkthrough

This pull request introduces a new GitHub Actions workflow that enables manual closure of pull requests with an automated gating message. The workflow accepts a PR number as input, posts a contribution-gate comment referencing the repository's default branch, and closes the PR through the GitHub REST API.

Changes

Gate Close PR Workflow

Layer / File(s) Summary
Manual PR closure workflow
.github/workflows/gate-close-pr.yaml
New workflow is manually triggered with a required pr_number input. Configured with write permissions for issues and pull requests. Uses actions/github-script to compose a multi-part contribution-gate message with default branch links, post it as a comment to the target PR, and close the PR state via the GitHub REST API.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A workflow so neat, with a purpose so clear,
Posts a gate-message, then closes things here,
With dispatch at the helm and permissions in place,
We close PRs with grace, at a steady pace! ✨

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/manual-gate-close

Comment @coderabbitai help to get the list of available commands and usage tips.

@ryoppippi
ryoppippi merged commit b38f4f8 into main Jun 11, 2026
14 of 15 checks passed
@ryoppippi
ryoppippi deleted the ci/manual-gate-close branch June 11, 2026 18:59
@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 5bbe8b5e1542
Base SHA: 42549187ca02

This compares the PR package against the configured base package on the same CI runner.

Package runner startup

Execution setup measures any pre-benchmark package materialization used by the execution benchmark. Bunx temp cache measures one bunx -p <url> ccusage --version run with an empty Bun install cache. Warm reuses that cache and reports the median of repeated runs.

Package SHA Execution setup Bunx temp cache Bunx warm median Warm samples
Base pkg.pr.new 42549187ca02 1.017s 1.016s 79.6ms 3
PR pkg.pr.new 5bbe8b5 1.109s 1.112s 66.4ms 3

Cached bunx execution performance

Runs the same large fixture through bunx -p <pkg.pr.new URL> ccusage after the Bun install cache has already been populated by the startup measurement. This separates cached package-runner execution from first-fetch package materialization.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2,597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2,597 files)
Base package: 42549187ca02; PR package: 5bbe8b5. Both run through bunx -p <pkg.pr.new URL> ccusage using the warmed Bun install cache from package runner startup, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
bunx -p <pkg> ccusage claude --offline --json 1.01 GiB 950.3ms 955.3ms 0.99x 736.25 MiB 733.00 MiB 1.00x 1.06 GiB/s 1.05 GiB/s
bunx -p <pkg> ccusage codex --offline --json 1.01 GiB 216.7ms 221.7ms 0.98x 92.50 MiB 92.50 MiB 1.00x 4.65 GiB/s 4.54 GiB/s

Package runtime diagnostics

Compares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2,597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2,597 files)
All rows run --offline --json, measured by hyperfine with 0 warmups and 1 runs. This isolates wrapper overhead from the installed native optional dependency and the workspace release binary built on the runner.

Command Runtime Input Median Throughput Samples
claude --offline --json Package wrapper 1.01 GiB 915.3ms 1.10 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 1.025s 1005.50 MiB/s 1
codex --offline --json Package wrapper 1.01 GiB 218.7ms 4.60 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 136.0ms 7.40 GiB/s 1

Committed fixture performance

Committed small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage.

Fixtures: Claude apps/ccusage/test/fixtures/claude (0.00 MiB, 2 files), Codex apps/ccusage/test/fixtures/codex (0.00 MiB, 1 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published ccusage package from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 2 warmups and 7 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude daily --offline --json 0.00 MiB 44.4ms 45.1ms 0.99x 42.75 MiB 43.00 MiB 1.01x 0.03 MiB/s 0.03 MiB/s
claude session --offline --json 0.00 MiB 44.2ms 55.5ms 0.80x 43.00 MiB 43.25 MiB 1.01x 0.04 MiB/s 0.03 MiB/s
codex daily --offline --json 0.00 MiB 44.4ms 42.8ms 1.04x 43.00 MiB 43.00 MiB 1.00x 0.02 MiB/s 0.02 MiB/s
codex session --offline --json 0.00 MiB 44.7ms 44.2ms 1.01x 43.00 MiB 43.00 MiB 1.00x 0.02 MiB/s 0.02 MiB/s

Large real-world-shaped fixture performance

Generated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2,597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2,597 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published ccusage package from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude --offline --json 1.01 GiB 951.6ms 912.6ms 1.04x 726.25 MiB 745.75 MiB 1.03x 1.06 GiB/s 1.10 GiB/s
codex --offline --json 1.01 GiB 191.8ms 181.5ms 1.06x 89.75 MiB - - 5.25 GiB/s 5.55 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 17.33 KiB 17.33 KiB +0.00 KiB 1.00x
installed native package binary 3324.84 KiB 3324.84 KiB +0.00 KiB 1.00x

Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees.

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 5bbe8b5e1542
Base SHA: 42549187ca02

This compares the Rust PR release binary against the configured base package on the same CI runner.

Package runner startup

Execution setup measures any pre-benchmark package materialization used by the execution benchmark. Bunx temp cache measures one bunx -p <url> ccusage --version run with an empty Bun install cache. Warm reuses that cache and reports the median of repeated runs.

Package SHA Execution setup Bunx temp cache Bunx warm median Warm samples
Base pkg.pr.new 42549187ca02 1.262s 985.0ms 68.6ms 3
PR pkg.pr.new 5bbe8b5 1.241s 1.180s 67.8ms 3

Cached bunx execution performance

Runs the same large fixture through bunx -p <pkg.pr.new URL> ccusage after the Bun install cache has already been populated by the startup measurement. This separates cached package-runner execution from first-fetch package materialization.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2,597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2,597 files)
Base package: 42549187ca02; PR package: 5bbe8b5. Both run through bunx -p <pkg.pr.new URL> ccusage using the warmed Bun install cache from package runner startup, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
bunx -p <pkg> ccusage claude --offline --json 1.01 GiB 949.5ms 989.1ms 0.96x 729.75 MiB 724.50 MiB 0.99x 1.06 GiB/s 1.02 GiB/s
bunx -p <pkg> ccusage codex --offline --json 1.01 GiB 233.5ms 229.1ms 1.02x 93.75 MiB 94.75 MiB 1.01x 4.31 GiB/s 4.40 GiB/s

Package runtime diagnostics

Compares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2,597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2,597 files)
All rows run --offline --json, measured by hyperfine with 0 warmups and 1 runs. This isolates wrapper overhead from the installed native optional dependency and the workspace release binary built on the runner.

Command Runtime Input Median Throughput Samples
claude --offline --json Package wrapper 1.01 GiB 943.6ms 1.07 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 927.5ms 1.09 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 224.8ms 4.48 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 158.3ms 6.36 GiB/s 1

Committed fixture performance

Committed small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage.

Fixtures: Claude apps/ccusage/test/fixtures/claude (0.00 MiB, 2 files), Codex apps/ccusage/test/fixtures/codex (0.00 MiB, 1 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs rust/target/release/ccusage directly. Both run --offline --json, measured by hyperfine with 2 warmups and 7 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude daily --offline --json 0.00 MiB 50.8ms 6.5ms 7.79x 42.75 MiB 2.75 MiB 0.06x 0.03 MiB/s 0.24 MiB/s
claude session --offline --json 0.00 MiB 44.2ms 6.4ms 6.92x 43.25 MiB 2.75 MiB 0.06x 0.03 MiB/s 0.24 MiB/s
codex daily --offline --json 0.00 MiB 42.1ms 5.5ms 7.65x 42.75 MiB 2.75 MiB 0.06x 0.02 MiB/s 0.16 MiB/s
codex session --offline --json 0.00 MiB 44.2ms 6.5ms 6.81x 43.00 MiB 2.75 MiB 0.06x 0.02 MiB/s 0.13 MiB/s

Large real-world-shaped fixture performance

Generated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2,597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2,597 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs rust/target/release/ccusage directly. Both run --offline --json, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude --offline --json 1.01 GiB 700.3ms 854.3ms 0.82x 735.50 MiB 726.75 MiB 0.99x 1.44 GiB/s 1.18 GiB/s
codex --offline --json 1.01 GiB 199.3ms 146.4ms 1.36x 92.50 MiB 89.00 MiB 0.96x 5.05 GiB/s 6.88 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 17.33 KiB 17.33 KiB +0.00 KiB 1.00x
installed native package binary 3324.84 KiB 3324.84 KiB +0.00 KiB 1.00x

Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees.

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.

1 participant