with one click
debug
Debug issues using E2E tests, log analysis, and dev server management
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Debug issues using E2E tests, log analysis, and dev server management
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
Query ClickHouse observability logs over HTTP API
Iterate on bug hypotheses using Playwright repro scripts, structured logs, and source code analysis
Address unresolved inline diff comments and mark them resolved
Run a long task across multiple agent contexts using breadcrumb progress files
Recursively decompose a task into sub-plans with dependency ordering, then execute in topological waves
Orchestrate multiple agents programmatically using anvil-repl
| name | Debug |
| description | Debug issues using E2E tests, log analysis, and dev server management |
| user-invocable | true |
This skill provides guidance and helpers for debugging issues in the Anvil codebase.
# Start the dev server (full stack: agents, sdk, migrations, tauri)
pnpm dev
# Start headless (no main window)
pnpm dev:headless
# Start without HMR (for debugging hot-reload issues)
pnpm dev:no-hmr
# Kill the dev server (find and terminate all related processes)
pkill -f "tauri dev" && pkill -f "vite" && pkill -f "cargo-watch"
# Run all tests
pnpm test
# Run UI isolation tests (React components with mocked Tauri)
pnpm test:ui
pnpm test:ui:watch # watch mode
# Run agent tests (Node environment, includes integration tests)
pnpm test:agents
# Run agent harness tests (spawns real agent subprocesses)
pnpm test:harness
Local dev logs:
# View live dev logs
tail -f logs/dev.log
# Search logs for errors
grep -i "error" logs/dev.log | tail -50
# Search structured JSON logs (LLM-friendly format)
cat ~/.anvil/logs/structured.jsonl | jq 'select(.level == "ERROR")'
# View recent log entries with context
tail -100 logs/dev.log | grep -A5 -B5 "pattern"
# Filter by component
grep "agent_hub" logs/dev.log | tail -20
grep "hub::client" logs/dev.log | tail -20
Production/staging logs: Use /query-clickhouse to query ClickHouse observability logs over HTTP API (errors, sessions, performance, etc.).
| Test Type | Location | Config | Command |
|---|---|---|---|
| UI Components | src/**/*.test.{ts,tsx} | vitest.config.ts | pnpm test |
| UI Isolation | src/**/*.ui.test.{ts,tsx} | vitest.config.ui.ts | pnpm test:ui |
| Agent Core | agents/src/**/*.test.ts | agents/vitest.config.ts | pnpm test:agents |
| Integration | agents/src/**/*.integration.test.ts | agents/vitest.config.ts | pnpm test:agents |
| Harness | agents/src/testing/__tests__/ | agents/vitest.config.ts | pnpm test:harness |
agents/src/runners/message-handler.test.tsagents/src/runners/thread-history.test.ts, thread-history-live.test.tsagents/src/output.test.tsagents/src/runners/shared.integration.test.tsThe agent harness (agents/src/testing/agent-harness.ts) provides sophisticated E2E testing by:
TestAnvilDirectory - Temp anvil configTestRepository - Git repo fixturesMockHubServer - Agent communication mockExample harness test pattern:
import { AgentHarness } from '../testing/agent-harness';
const harness = new AgentHarness();
await harness.setup();
const result = await harness.runAgent({ prompt: 'test prompt' });
expect(result.events).toContainEqual(expect.objectContaining({ type: 'complete' }));
await harness.cleanup();
UI tests use comprehensive Tauri API mocks defined in src/test/setup-ui.ts:
@tauri-apps/api/core - invoke, transformCallback@tauri-apps/api/event - listen, emitThe Rust backend (src-tauri/src/logging/mod.rs) has 4 output layers:
logs/structured.jsonl for LLM analysisLOG_SERVER_URL)| Source | Location | Output |
|---|---|---|
| Rust/Tauri | src-tauri/src/**/*.rs | Console + files |
| Frontend | src/lib/logger-client.ts | Via Tauri invoke |
| Agent Core | agents/src/lib/logger.ts | Via hub socket |
| Core Lib | core/lib/logger.ts | Console |
Use throttle macros to prevent log spam:
throttle_debug!("frequent operation");
throttle_info!("periodic update");
throttle_warn!("repeated warning");
grep "hub" logs/dev.log | tail -20grep -i "socket\|connection\|disconnect" logs/dev.logpnpm test:agentsgrep "emit\|listen" logs/dev.logpnpm test:uipnpm typecheckcd src-tauri && cargo checkpnpm clean && pnpm buildpnpm vitest run path/to/test.tspnpm vitest watch path/to/test.tssrc/test/setup.ts, src/test/setup-ui.tsThe dev server runs 4 concurrent processes:
┌─────────────────────────────────────────────────────┐
│ pnpm dev │
├─────────────────────────────────────────────────────┤
│ agents │ cd agents && pnpm build --watch │
│ sdk │ cd core/sdk && pnpm build:watch │
│ migrations │ cd migrations && pnpm build:watch │
│ tauri │ tauri dev $TAURI_ARGS │
└─────────────────────────────────────────────────────┘
│
▼
logs/dev.log (combined output)
Environment presets are in scripts/env-presets/:
dev.sh - Development config (port 1421, dev suffix)prod.sh - Production-like config