본문으로 건너뛰기
Skillpedia
자동화31k · #9315

smoke-test

하는 일

이 스킬은 GBrain 설정의 상태 테스트를 실행합니다. 데이터베이스, 명령줄 도구, 백그라운드 워커를 점검합니다. 재시작 후 모든 것이 작동하는지 확인하고 싶은 사람을 위한 스킬입니다.

사용하는 경우

  • ✓컴퓨터나 컨테이너를 재시작하고 브레인이 작동하는지 확인하고 싶을 때.
  • ✓브레인에 무언가 고장 난 것 같아서 빠르게 점검하고 싶을 때.
  • ✓표준 테스트에 나만의 상태 점검을 추가하고 싶을 때.

스킬 링크

https://github.com/garrytan/gbrain/blob/master/plugin/skills/smoke-test/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/garrytan/gbrain/blob/master/plugin/skills/smoke-test/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“컴퓨터를 방금 재시작했어요. 내 브레인의 상태 테스트를 실행하고, 작지만 고장 난 것이 있으면 고쳐 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 여덟 개의 핵심 점검을 실행하고, 데이터베이스 인덱스 손상처럼 범위가 정해진 로컬 문제를 고칩니다. 고치지 못한 것은 보고합니다. 워커는 상태를 보고하지만 자동으로 시작하지 않습니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Smoke Test Skillpack

Run gbrain smoke-test after any machine or container restart, or whenever something seems broken.

Contract

This skill guarantees:

  • 8 core tests verify gbrain health after restart (plus OpenClaw services when present; skipped otherwise)
  • Bounded local failures are auto-fixed before reporting; worker repair is explicit because process topology and shell-job policy are operator choices
  • User-extensible via ~/.gbrain/smoke-tests.d/*.sh drop-in scripts
  • Results logged to /tmp/gbrain-smoke-test.log
  • Exit code = number of unfixed failures (0 = all pass)

Built-in Tests

# Test Auto-Fix
1 Bun runtime Install from bun.sh
2 GBrain CLI loads Reinstall deps
3 GBrain database (engine identity via gbrain engine status --json, then doctor --json's connection check) gbrain db-repair --yes, re-test
4 GBrain worker process — (native supervisor status + duplicate detection)
5 OpenClaw Codex plugin (Zod CJS); skips if OpenClaw absent npm install zod@4 --force
6 OpenClaw gateway; skips if OpenClaw absent — (may not be started yet)
7 Embedding API key — (check .env)
8 Brain repo exists —

Usage

CLI

gbrain smoke-test

This is the invocation for all installs; it resolves the test script from the installed package.

From any startup script or login hook

gbrain smoke-test >> /tmp/bootstrap.log 2>&1

From OpenClaw bootstrap (OpenClaw deployments only)

Add to your ensure-services.sh or equivalent:

bash /path/to/gbrain/scripts/smoke-test.sh >> /tmp/bootstrap.log 2>&1

From an agent

exec: gbrain smoke-test

Contributor note: inside a gbrain repo checkout you can also run the script directly with bash scripts/smoke-test.sh.

Adding Custom Tests

Create executable scripts in ~/.gbrain/smoke-tests.d/:

# ~/.gbrain/smoke-tests.d/check-redis.sh
#!/bin/bash
redis-cli ping | grep -q PONG

Rules:

  • Exit 0 = pass, non-zero = fail
  • Filename becomes the test name (e.g. check-redis from check-redis.sh)
  • Keep tests fast (< 10s each)
  • Tests run in alphabetical order

Adding Built-in Tests (gbrain contributors)

This section is for contributors working in the gbrain source repo. Plugin installs ship the script read-only and upgrades overwrite it; if you just want extra checks, use the ~/.gbrain/smoke-tests.d/ drop-in scripts above.

Edit scripts/smoke-test.sh. Follow this pattern:

# ── N. [Service Name] ──────────────────────────────────────
if [test condition]; then
  pass "[Service Name]"
else
  # Auto-fix attempt
  [fix command]
  if [re-test condition]; then
    fixed "[What was fixed]"
    pass "[Service Name] (after fix)"
  else
    fail "[Service Name] — [error detail]"
  fi
fi

Design rules:

  1. Test first — never fix without confirming broken
  2. Re-test after fix — verify the fix worked
  3. Timeout everything — timeout N on any command that could hang
  4. Use helpers — pass(), fail(), fixed(), skip()
  5. Idempotent fixes — safe to run repeatedly
  6. Skip gracefully — skip() when a prerequisite is missing, don't fail

Environment Variables

Var Default Description
GBRAIN_SMOKE_LOG /tmp/gbrain-smoke-test.log Log file path
GBRAIN_DIR_OVERRIDE (auto-detect) Force gbrain install path
GBRAIN_BUN_PATH (auto-detect) Force Bun binary path
GBRAIN_DATABASE_URL (from .env) Database connection URL
GBRAIN_SMOKE_WORKER_PID_FILE /tmp/gbrain-worker.pid Legacy bare-worker PID path
OPENCLAW_GATEWAY_PORT 18789 Gateway port to test
GBRAIN_BRAIN_PATH (deployment-specific) Brain repo path. Container deployments default to /data/brain; set it to your brain repo path otherwise. Test 8 skips (not fails) when unset.

Known Issues & Their Auto-Fixes

Codex Zod core.cjs Missing (discovered 2026-04-23)

(OpenClaw gateway deployments only: this concerns OpenClaw's Codex ACP plugin, not the OpenAI Codex CLI.)

  • Symptom: Cannot find module './core.cjs' → all Codex ACP sessions fail
  • Cause: Zod v4 npm package ships without core.cjs in some installs
  • Auto-fix: npm install zod@4 --force in the codex extension's zod dir
  • Persistence: Does NOT survive container restart (gateway reinstalls deps)
  • This is why smoke tests must run on every rest
자주 묻는 질문

백그라운드 서비스를 시작하나요?

아닙니다. 워커 상태는 보고하지만 스스로 데몬을 시작하지 않습니다.

내 점검을 추가할 수 있나요?

네. 추가 테스트 스크립트를 폴더에 넣으면 표준 테스트와 함께 실행됩니다.

결과는 어디에 기록되나요?

결과는 로그 파일에 기록되며, 종료 코드는 고치지 못한 문제가 몇 개 남았는지 보여 줍니다.

상세 정보

작성자의 원본 설명

Health smoke tests + auto-fix for gbrain installs (and OpenClaw services when present). Run after machine/container restarts or whenever something seems broken. Tests critical services, auto-fixes bounded local issues, and reports worker topology without starting daemons. Extensible via user-defined test scripts in ~/.gbrain/smoke-tests.d/*.sh.

repo: garrytan/gbrain

인기도

GitHub 스타
31k
순위
#9315
라이선스
MIT
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬