Skip to content

fix(ci): merge gh api --paginate pages into a single array in required-verifier-integrity gate - #795

Merged
nish3451 merged 1 commit into
mainfrom
fix/required-verifier-integrity-pagination
Aug 20, 2026
Merged

nish3451 merged 1 commit into
mainfrom
fix/required-verifier-integrity-pagination

Conversation

@nish3451

@nish3451 nish3451 commented Aug 20, 2026 •

Copy link
Copy Markdown
Member

What

De-flakes the required-verifier-integrity gate for any PR with more than one API page of changed files, reviews, or issue comments.

Root cause. gh api --paginate ... --jq '[.[] | …]' applies the --jq expression per page and concatenates the per-page results. When a PR exceeds one page (>100 items) the captured value becomes N back-to-back arrays — not a single valid JSON document. The final jq -n --argjson that assembles the context bundle then fails with invalid JSON text passed to --argjson (exit 2), before the gate ever evaluates the PR.

Repro. PR #626 has 104 issue comments (2 pages); its required-verifier-integrity check fails only because of this assembly crash. It changes no protected verifier definitions, so once the bundle builds correctly the gate returns PASS: no protected verifier definition changed.

Change

  • .github/workflows/required-verifier-integrity.yml: every paginated fetch (files, reviews, comments) now emits one object per line (--jq '.[] | …') and then slurps the whole stream into a single array (jq -s .). Result is always one valid array regardless of page count.
  • tests/required-verifier-context-pagination.test.ts (new): regression for the class — a structural guard that the workflow no longer uses array-wrapping --jq '[.[] | …]', plus a functional check that two concatenated pages collapse into one valid array.

Verification


Note

Low Risk
CI-only context assembly fix; verifier decision logic is unchanged and tests lock in the pagination shape.

Overview
Fixes required-verifier-integrity failing on PRs with more than 100 changed files, reviews, or issue comments before verifier logic runs.

gh api --paginate with --jq '[.[] | …]' runs that filter per page and concatenates results, so multi-page responses become adjacent JSON arrays and break the context step’s jq -n --argjson bundle assembly. The workflow now streams one object per line (--jq '.[] | …') and jq -s . into a single array for files, reviews, and comments, with inline comments documenting why.

Adds tests/required-verifier-context-pagination.test.ts: a structural check that every paginated fetch uses the slurp pattern (not array-wrapping --jq), plus a functional jq test that two concatenated pages merge into one valid array.

Reviewed by Cursor Bugbot for commit 33fed33. Bugbot is set up for automated code reviews on this repo. Configure here.

…d-verifier-integrity gate

`gh api --paginate --jq '[.[] | …]'` applies --jq per page and concatenates
the per-page results, so any PR with >100 files/reviews/issue-comments yields
N back-to-back arrays — invalid input to the final `jq -n --argjson` that
builds the context bundle ('invalid JSON text passed to --argjson', exit 2).
PR #626 hit this with 104 issue comments, failing the gate before it could
evaluate (it changes no protected files and would otherwise PASS).

Emit one object per line (`--jq '.[] | …'`) and slurp the whole stream into
one array (`jq -s .`) for every paginated fetch (files, reviews, comments).
Adds tests/required-verifier-context-pagination.test.ts as a regression for
the class: a structural guard on the workflow plus a functional check that two
concatenated pages collapse into one valid array.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 3f6ddfb1-a255-4bba-acb1-5ed97ed3d8d7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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

@cursor

cursor Bot commented Aug 20, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_7de20f15-a89d-47f9-a3f3-a2439b8eff51)

@nish3451

Copy link
Copy Markdown
Member Author

verifier-attest: 33fed33

@nish3451
nish3451 merged commit 2deae9f into main Aug 20, 2026
6 of 7 checks passed
@nish3451
nish3451 deleted the fix/required-verifier-integrity-pagination branch August 20, 2026 08:05
nish3451 added a commit that referenced this pull request Aug 20, 2026
…timeout (#626)

* ci: retry codex-node-checks vitest step once on forks-worker startup timeout

Vitest 4.1.x hardcodes the forks-pool worker startup budget (90s ready /
60s handshake; raised from 5s/10s in vitest-dev/vitest#9027 but never made
configurable). The suite forks a fresh worker per test file, so a load
spike on the shared vps-verify runner can intermittently kill the Test
step with "[vitest-pool]: Timeout starting forks runner." — a transient
infra failure, not a verdict on the code.

ci-vitest-run.sh retries the suite exactly once, and only when the
failure matches that exact pool startup-timeout signature. Assertion
errors, build errors and worker crashes still fail the step immediately
with their original exit code, so the retry cannot mask a real
regression. The retry runs inside the deploy-window lane the step
already acquired, so it never re-enters the verification queue.

* ci: wire vitest startup-timeout retry into the test script, keep ci.yml stable

The codex-node-checks Test step was unstable for ~173h because Vitest 4.1.x
hardcodes the forks-pool worker startup budget (90s ready / 60s handshake;
raised from 5s/10s upstream but never configurable) and a load spike on the
shared vps-verify runner can intermittently kill the whole suite with
"[vitest-pool]: Timeout starting forks runner.".

Move the single, signature-gated retry from the protected .github/workflows/
ci.yml Test step into the repo's own package.json "test" script (via
scripts/ci-vitest-run.sh), so codex-node-checks, the deploy-production
verification step and launch:readiness all get the same retry without
changing any workflow file. The wrapper retries exactly once, and only on
that exact startup-timeout signature; assertion errors, build errors and
worker crashes still fail immediately with their original exit code.

Also harden the verification lane to reuse one long-lived fork worker
(vite.config.ts isolate: false) so the suite performs a single worker
startup instead of one per file, removing the per-file startup failure at
its root; the retry remains as the residual safety net.

This keeps .github/workflows/ci.yml identical to main, so the PR no longer
changes any protected verifier definition and the required-verifier-integrity
gate passes without needing a manual approval.

Co-authored-by: Nish

* ci: keep vitest per-file isolation; rely on signature-gated retry for the startup-timeout deflake

The prior head wired `isolate: !isVerificationLane` into vite.config.ts to
reuse one long-lived fork worker and remove per-file worker startups. Under
`isolate: false` vitest shares one module registry across all files, which
breaks `vi.mock` interception for modules already cached by an earlier file:
`tests/plan-proof-usage-failure.test.ts` stopped mocking evidence-usage.server
and failed with the real "D1 legacy top-up migration read failed" path. That
turned the codex-node-checks check red on a genuine regression, not the
transient startup timeout the PR targets.

Drop the isolation toggle so vite.config.ts stays identical to main. The
forks-worker startup-timeout flake is handled by the existing signature-gated
retry in scripts/ci-vitest-run.sh (wired into package.json "test"), which
retries exactly once and only on the pool startup-timeout signature.

- vite.config.ts: revert to main (per-file isolation preserved).
- scripts/ci-vitest-run.sh: refresh comment; it is now the deflake mechanism.
- tests/vitest-runner-budget.test.ts: regression-guard that the verification
  lane config never disables isolation, and that the retry is signature-gated.
- tests/deploy-window-lock.test.ts: assert the Test step command actually
  present in ci.yml (`npm run test`, which routes through the wrapper).

Merged origin/main so .github/workflows/ci.yml leaves the PR diff (identical
to main) and required-verifier-integrity no longer sees a protected change.

* ci: re-trigger required-verifier-integrity against fixed base workflow (PR #795)
nishfleet-worker Bot added a commit that referenced this pull request Sep 21, 2026
…mpt values last (#795)

head -c 8000 starved the ledger, and {{placeholders}} at the top of
researcher.md and blind-audit.md voided the cache prefix. Move Context
blocks to the end and emit the ledger in full so sr-token-efficiency stays
green on those three hits.

Co-authored-by: Nishfleet Agent <[email protected]>
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