Skip to content

fix(github): tolerate null check suites on a PR's first tick - #758

Merged
jonathanong merged 1 commit into
mainfrom
fix/poll-null-id-crash
Nov 17, 2026
Merged

jonathanong merged 1 commit into
mainfrom
fix/poll-null-id-crash

Conversation

@jonathanong

Copy link
Copy Markdown
Owner

Problem

pr-shepherd 757 --until-terminal crashed on its first tick (seconds after PR creation) with Cannot read properties of null (reading 'id') (exit 70). The saved BatchPrData response had commits.nodes[0].commit.checkSuites.nodes ending in two null entries (no GraphQL errors), alongside statusCheckRollup: null.

Root cause

suiteFingerprint in src/github/fingerprint-fields.mts:28 read node.id on a null suite, called from fingerprintFromRaw (src/github/fingerprint.mts:76) in fetchGraphqlPrBatch (src/github/batch.mts:78). Replaying the saved response through main() with a local wire server reproduced the exact stack. Other checkSuites consumers (parseHeadWorkflowSuites, poll-summary unreported/startup checks, stack handoff) would dereference the same null.

Fix

  • New dropUnreadableSuites (src/github/check-suite-nodes.mts): a null suite is unknown data, so it is dropped (no values invented) and the suite page is marked hasNextPage: true. Existing consumers already treat an unread suite page as unverified (checkSuitesComplete false, summary incomplete), so readiness fails closed instead of crashing.
  • Applied at ingestion: requireRawPr (batch) and hydratePollSummaryChecks (poll summary). Stack handoff declines a layer whose suites contain a null and falls back to BatchPr.
  • Top-level error handler (src/index.mts) now also appends the stack (and cause chain) to the per-worktree debug log. Terminal output is unchanged; no-op when the log is disabled.

Tests

  • src/github/check-suite-nodes.test.mts: unit tests plus a batch-path regression (requireRawPr + fingerprintFromRaw) that throws the original TypeError without the fix.
  • Poll-summary hydration, stack-handoff gate, and index stack-logging cases.
  • Full vitest run: only the known local-only load.cascade/load.merge failures. Lint, typecheck, and format:check clean.

docs: n/a (no output shape change).

🤖 Generated with Claude Code

https://claude.ai/code/session_01MaU9nzcPYZ2vfLt8UozvDS

GitHub can return null entries in commit.checkSuites.nodes in a PR's first
seconds (no GraphQL error). fingerprintFromRaw read node.id and crashed the
first poll tick with "Cannot read properties of null (reading 'id')".

Drop unreadable suites at the batch and poll-summary ingestion points and mark
the suite page as not fully read, so readiness stays unverified instead of
crashing; stack handoff declines pages containing one. The top-level error
handler now also appends the stack to the per-worktree debug log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MaU9nzcPYZ2vfLt8UozvDS
@coderabbitai

This comment has been minimized.

@chatgpt-codex-connector

This comment has been minimized.

@github-actions github-actions Bot added the src label Nov 17, 2026
@jonathanong
jonathanong merged commit a36b6c8 into main Nov 17, 2026
8 checks passed
@jonathanong
jonathanong deleted the fix/poll-null-id-crash branch November 17, 2026 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant