Files
ghbot/.specify/specs/001-production-hardening/plan.md
T
wdawdwaandClaude Opus 4.8 039acabd96 fix: production hardening for merge races, timeouts, and webhook ops
Pin merge SHA, lock conflict repair, bound subprocess/proxy output,
fail-fast incomplete R2/webhook config, redact validation/stderr
secrets, and document that webhook 202 is best-effort after ACK.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-08-23 15:44:08 +08:00

Implementation Plan: 001-production-hardening

Current architecture

ghbot is a GitHub Actions + optional webhook Node service. Review, triage, conflict repair, and @bot chat are orchestrated from src/actions/runReview.ts. Config is a single zod schema in src/config.ts. Persistence is optional R2 plus local scratch directories.

Impacted modules

  • src/review/processor.ts — merge SHA pinning, stale-head discard, approval lookup errors
  • src/review/conflictResolver.ts — per-PR lock, git timeouts, worktree reset
  • src/ai/apiProxy.ts / src/ai/gooseCli.ts — proxy/process timeouts and bounded output
  • src/webhook/server.ts — body deadline, request catch, metrics
  • src/config.ts / workflows / .env.example — GHBOT_RUNTIME_DIR, webhook/R2 cross-checks
  • docs — webhook secret, docker run, goose aliases

Implementation strategy

Fix production failure modes first. Keep AUTO_MERGE default false. Prefer additive guards over architecture rewrites. Do not extract the 1700-line processor router in this pass because there is no isolated event-loop test harness; that refactor is deferred with an explicit risk note.

Verification

  • npm run typecheck / lint / format:check / test
  • production-build webhook HTTP smoke (healthz, HMAC, duplicate, metrics)
  • npm audit --omit=dev against registry.npmjs.org
  • independent six-dimension review after gates

Rollback

Revert the production-hardening commit on the fork. Defaults remain conservative (AUTO_MERGE=false, WEBHOOK_ENABLED=false).