Skip to content

Harden ClawHub stats sync (SOL-5)#9

Open
VisionaireLabs wants to merge 1 commit into
masterfrom
harden/clawhub-sync
Open

Harden ClawHub stats sync (SOL-5)#9
VisionaireLabs wants to merge 1 commit into
masterfrom
harden/clawhub-sync

Conversation

@VisionaireLabs

Copy link
Copy Markdown
Collaborator

What

Hardens the weekly lib/clawhub.ts stats refresh (scripts/refresh-clawhub-stats.mjs) so a flaky ClawHub source can't stall the job or corrupt the catalog.

Changes

  • Retries — bounded exponential backoff + jitter for network errors, timeouts, 429, and 5xx (was 429-only). Other 4xx stay non-retryable. Retry-After still honored.
  • Timeout — per-request 15s abort via AbortController so a hung connection can't stall CI.
  • Structured logging — one JSON object per line ({ ts, level, event, … }); info→stdout, warn/error→stderr. Grep by event.
  • Graceful last-good fallback — a single failing slug keeps its previous values and the run continues; but if the source looks unavailable (nothing updated, or >50% of slugs fail), lib/clawhub.ts is left untouched and the run exits non-zero so the weekly job goes red instead of committing half-stale numbers. CI's "Commit if changed" step is then skipped.
  • Docsdocs/clawhub-sync.md documents the weekly task, schedule, resilience behavior, manual run, and tuning constants.

Scope unchanged: stats-only, membership stays human-gated.

Test

  • node --check passes.
  • node scripts/refresh-clawhub-stats.mjs --dry — fetched all 40 slugs, emitted structured logs, wrote nothing, exit 0.

Resolves SOL-5.

🤖 Generated with Claude Code

Make the weekly lib/clawhub.ts stats refresh resilient to a flaky source:

- Retries: bounded exponential backoff + jitter for network errors,
  timeouts, 429, and 5xx (was 429-only). 4xx stays non-retryable.
- Per-request 15s timeout via AbortController so a hung connection
  cannot stall the job.
- Structured JSON-line logging (ts/level/event/fields) for CI
  observability.
- Graceful last-good fallback: if the source looks unavailable
  (nothing updated, or >50% of slugs fail), lib/clawhub.ts is left
  untouched and the run exits non-zero so the weekly job flags the
  outage instead of committing half-stale numbers.

Document the weekly sync task in docs/clawhub-sync.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>
@vercel

vercel Bot commented Jun 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
solidstate.cc Error Error Jun 3, 2026 10:26pm

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