Skip to content

tools(github): check-github-status.ts — pre-flight gatekeeper (Gemini v1 #2)#924

Merged
AceHack merged 2 commits intomainfrom
ops/check-github-status-tool-2026-04-30
Apr 30, 2026
Merged

tools(github): check-github-status.ts — pre-flight gatekeeper (Gemini v1 #2)#924
AceHack merged 2 commits intomainfrom
ops/check-github-status-tool-2026-04-30

Conversation

@AceHack
Copy link
Copy Markdown
Member

@AceHack AceHack commented Apr 30, 2026

Summary

Closes Gemini's v1-hardening recommendation #2: convert the GitHub-status check from behavioral habit into an operational tool. Companion to poll-pr-gate.ts:

  • poll-pr-gate.ts asks "is this PR ready to merge?"
  • check-github-status.ts asks "is GitHub itself healthy enough that the answer can be trusted?"

What's load-bearing

  • Queries https://www.githubstatus.com/api/v2/summary.json and emits a structured JSON report with overall, degradedComponents, factoryRelevant, decision, and description fields.
  • factoryRelevant allowlist matches the GitHub-status reference memory file (Pull Requests / Actions / API Requests / Webhooks / Git Operations / Issues).
  • Exit codes: 0=ok, 1=invocation, 2=fetch, 3=parse, 8=degraded (proceed-with-verify), 9=outage (halt). Mirrors poll-pr-gate.ts's exit-code semantics so consumers can set -e reliably.
  • Two fixtures: github-status-all-operational.json + github-status-pr-degraded.json. Both pass; live API currently returns exit 8 (PR-degradation still ongoing).
  • --component "Pull Requests" for narrow checks.
  • --quiet for exit-code-only mode (suitable for shell pre-flight gates).

Test plan

  • tsc clean (strict-mode exactOptionalPropertyTypes + noUncheckedIndexedAccess)
  • All-operational fixture → decision=proceed, exit 0
  • PR-degraded fixture → decision=proceed-with-verify, exit 8
  • Live API → exit 8 (PR-degradation correctly detected)
  • --component filter narrows correctly
  • CI green

Composes with

  • memory/reference_github_status_first_class_aaron_2026_04_30.md
  • memory/feedback_amara_poll_gate_not_ending_holding_is_not_status_2026_04_30.md (the proceed-but-verify rule whose exit-8 semantic mirrors)
  • docs/backlog/P0/B-0109-dependency-status-tracking-surface-2026-04-30.md
  • tools/github/poll-pr-gate.ts (companion Query + Gatekeeper pair)

Wiring into autonomous-loop pre-flight (deferred)

This commit ships the standalone tool. Auto-wiring into the loop's pre-flight sequence is a separate change — needs harness config, tracked under task #354 (harness-vendor resilience + upstream feedback).

🤖 Generated with Claude Code

…Hub-status

Closes Gemini's #2 v1-hardening recommendation: convert the
GitHub-status check from behavioral habit into operational tool.
Companion to poll-pr-gate.ts:

- poll-pr-gate.ts asks "is this PR ready to merge?"
- check-github-status.ts asks "is GitHub itself healthy enough that
  the answer can be trusted?"

## What it does

Queries `https://www.githubstatus.com/api/v2/summary.json` and
classifies into a structured report:

- `overall`: operational / degraded / outage / maintenance
- `degradedComponents`: array of non-operational components (name + status)
- `factoryRelevant`: per-component status restricted to the
  factory's load-bearing surfaces (Pull Requests / Actions /
  API Requests / Webhooks / Git Operations / Issues — per the
  GitHub-status reference memory file)
- `decision`: proceed / proceed-with-verify / halt
- `description`: human-readable status text

## Exit codes (consumable by autonomous-loop pre-flight)

- 0 — operational; safe to proceed
- 1 — invocation / dependency error
- 2 — fetch failed (network / DNS / cloudflare)
- 3 — JSON parse failed
- 8 — degraded; proceed-but-verify (per the rule from poll-the-gate
       memory file — proceed when gate surfaces aren't impacted,
       verify post-mutation)
- 9 — outage / major; halt mutating operations

## Fixture mode

`--fixture path/to/summary.json` — for offline testing + regression
fixtures. Two fixtures land with v0:

- `github-status-all-operational.json` — clean state (exit 0)
- `github-status-pr-degraded.json` — Pull Requests degraded (exit 8)

## Component filter

`--component "Pull Requests"` — narrows the report to a single
factory-relevant component. Exit code reflects that component
specifically (0 if operational, 8 otherwise).

## Verification

Tested against both fixtures + live API. The live API currently
returns degraded (Pull Requests still impacted from this session's
morning incident) — tool correctly classifies as
decision=proceed-with-verify, exit 8.

## Composes with

- `memory/reference_github_status_first_class_aaron_2026_04_30.md`
  — the canonical surface allowlist this tool reports against
- `memory/feedback_amara_poll_gate_not_ending_holding_is_not_status_2026_04_30.md`
  — the proceed-but-verify rule whose exit code 8 mirrors
- `docs/backlog/P0/B-0109-dependency-status-tracking-surface-2026-04-30.md`
  — the substrate-tracking row this tool operationalizes
- `tools/github/poll-pr-gate.ts` — the companion query tool;
  together they form a Query + Gatekeeper pair

## Wiring into the autonomous loop (deferred)

This commit ships the standalone tool. Wiring it into the
autonomous-loop pre-flight sequence (so it executes before any
state-mutating API call) is a separate change — needs harness
config, not just substrate. Tracked under Otto-354 (harness-vendor
resilience).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 30, 2026 16:57
@AceHack AceHack enabled auto-merge (squash) April 30, 2026 16:57
@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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new TS/Bun automation tool under tools/github/ to query GitHub’s public status endpoint and emit a structured “is GitHub healthy?” report intended for autonomous-loop pre-flight gating (companion to poll-pr-gate.ts).

Changes:

  • Introduces tools/github/check-github-status.ts to fetch/parse the GitHub Status API summary and emit a JSON report + exit code.
  • Adds two JSON fixtures to support deterministic local runs (all-operational and pr-degraded).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
tools/github/check-github-status.ts New CLI tool that fetches/loads GitHub status summary, classifies overall/component health, emits JSON + exit code.
tools/github/fixtures/github-status-all-operational.json Fixture representing fully operational GitHub status for testing.
tools/github/fixtures/github-status-pr-degraded.json Fixture representing degraded PR component status for testing.

Comment thread tools/github/check-github-status.ts Outdated
Comment thread tools/github/check-github-status.ts
Comment thread tools/github/check-github-status.ts
Comment thread tools/github/check-github-status.ts
Comment thread tools/github/check-github-status.ts
1. **Component mode incorporates overall status** (Copilot zqDN) —
   `--component` previously ignored `report.overall` so it could
   return exit 0 with a clean component even during a major outage.
   Now component decision = stricter of (component status,
   overall decision); halt overrides.

2. **Default exit 0 on successful fetch + opt-in `--strict`**
   (Copilot zqD8) — exit 8 was hostile to `set -e` shells (any
   non-zero aborts). Default now: exit 0 if fetch+parse succeeded;
   decision is in JSON. Add `--strict` to opt into non-zero exit
   for degraded/outage. Friendlier for shell pre-flights;
   enforcement-by-flag is the explicit choice.

3. **`requireValue` rejects single-dash flags too** (Copilot zqEF)
   — was `startsWith("--")`, now `startsWith("-")` — catches the
   `--component -q` case where `-q` was being silently accepted as
   a component name.

4. **`fetchedAt` semantics fixed** (Copilot zqER) — was set to
   `summary.page.updated_at` (status-page update time, not local
   fetch time). Now `fetchedAt` is `new Date().toISOString()`
   (local observation time); added `statusUpdatedAt` field for
   the page-side update time. Two clearly-named fields.

Decision-classifier semantics (Copilot zqDv) — KEPT as-is:
proceed-with-verify for factory-relevant degradation, NOT halt.
This matches Aaron's explicit proceed-but-verify rule
(memory/feedback_amara_poll_gate_not_ending_holding_is_not_status_2026_04_30.md)
which has been operationally validated across 13+ PRs this session
merging during the live GitHub PR-degradation incident. Halting
on factory-relevant degradation would have prevented those merges.
The reference memory + this session's track record vs Copilot's
stricter reading: maintainer rule wins. Resolving thread with
explanation, not the suggested edit.

Verified:
- Default mode: exit 0 on all fixtures (fetch worked).
- `--strict` mode: exit 0/8/9 by decision.
- Component mode: incorporates overall (Issues operational +
  overall degraded → proceed-with-verify).
- `--component -q` rejected with "--component requires a value".
- `fetchedAt` and `statusUpdatedAt` distinct; tsc clean.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
AceHack added a commit that referenced this pull request Apr 30, 2026
…(Copilot)

Same in-flight-xref pattern caught earlier this session — code-span
path implied existence-on-main, but the file is on PR #924's branch.
Reworded to make the in-flight status explicit.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@AceHack AceHack merged commit 613f6d8 into main Apr 30, 2026
24 checks passed
@AceHack AceHack deleted the ops/check-github-status-tool-2026-04-30 branch April 30, 2026 17:09
AceHack added a commit that referenced this pull request Apr 30, 2026
Final feedback packet from Deepseek post-PR #924 merge. Most
findings already shipped:

- submit-nuget transient → PR #923 (v1 hardening, required-vs-
  non-required classification)
- MEMORY.md merge-conflict tax → PR #920 (merge=union driver)
- Stale project-file internals cleanup → B-0112 P2 row filed

New finding: 30+ dot threshold for deferred-task re-audit (not
new lanes, just already-scoped tiny fixes). Composes with Ani's
strict-enforcement framing.

Per Otto-363 substrate-or-it-didn't-happen.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
AceHack added a commit that referenced this pull request Apr 30, 2026
* research: preserve Ani + Alexia v1 feedback packets verbatim

Both peer-AI reviewers responded after PR #921 (poll-pr-gate v0)
+ PR #922 (memory-points-at-script) merged. Per Otto-363
substrate-or-it-didn't-happen, preserving both packets verbatim
at `docs/research/2026-04-30-amara-poll-pr-gate-v1-hardening.md`.

Both packets predominantly "what's working" with smaller actionable
findings. Substantive items overlap with PR #923 (v1 hardening,
already on main) or queued under existing tasks:

- "submit-nuget non-required classification" (both reviewers) —
  shipped in PR #923.
- "Dot-tick discipline still leaky" (Ani #1) — accepted as
  behavior change going forward (no code, no substrate; commitment).
- "Pre-merge mechanical guards" (Ani #3) — persona-name scanner +
  fixture-name validator composed with task #350 (Otto-357
  mechanized auditor) and task #355 (poll-the-gate matrix
  coverage). Defer per substrate-rate.
- "MEMORY.md duplicate-link timing" (Ani #4) — audit candidate;
  the check fired on PR #922 but missed PR #916. Defer.
- "Task list at 58 open" (Ani #5) — pending-task audit overdue;
  composes with task #321 recovery lane.
- "Thread categorization" + "intelligent compaction" (Alexia) —
  research-grade, not yet operational.

No Insight-block commentary added per the discipline accepted in
the prior Claude.ai packet absorption: produce the work, let the
diff carry the evidence.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* fix(research): mark check-github-status path as in-flight at PR #924 (Copilot)

Same in-flight-xref pattern caught earlier this session — code-span
path implied existence-on-main, but the file is on PR #924's branch.
Reworded to make the in-flight status explicit.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* research: preserve Deepseek session-arc retrospective packet

Final feedback packet from Deepseek post-PR #924 merge. Most
findings already shipped:

- submit-nuget transient → PR #923 (v1 hardening, required-vs-
  non-required classification)
- MEMORY.md merge-conflict tax → PR #920 (merge=union driver)
- Stale project-file internals cleanup → B-0112 P2 row filed

New finding: 30+ dot threshold for deferred-task re-audit (not
new lanes, just already-scoped tiny fixes). Composes with Ani's
strict-enforcement framing.

Per Otto-363 substrate-or-it-didn't-happen.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
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