* chore: update package-lock.json after npm install * chore: remove unused ajv-cli, keep vitest at stable 1.6.1 - Removed ajv-cli (unused dev dependency, had high severity vulnerability) - Kept vitest at 1.6.1 (stable, upgrading to v4 requires extensive refactoring) - Reduced vulnerabilities from 6 to 4 (all moderate, dev-only) - All remaining vulnerabilities are in esbuild/vite (dev server only, no production impact) - Build and tests verified working * feat(evals): add execution-balance validation to 21 OpenAgent tests and enhance agent system Major improvements to evaluation framework and agent capabilities: ## Execution Balance Evaluator Integration - Added execution-balance rule to 21 OpenAgent tests (2.7% → 31.5% coverage) - Validates "read before execute" pattern across critical rules, workflows, and edge cases - Tests now check: read operations before execution tools, healthy read/exec ratio (≥1.0) - Coverage includes: approval-gate, context-loading, stop-on-failure, report-first tests ## Agent System Enhancements - Enhanced OpenCoder agent with critical rules enforcement (approval gates, context loading) - Added structured delegation rules and workflow phases - Improved error handling with REPORT→PROPOSE→REQUEST→FIX pattern ## New Agent Creation System - Added research-backed agent creation templates and guides - Includes 8 test templates covering planning, context, incremental execution, tools - Automated agent scaffolding with /create-agent command - Complete documentation in .opencode/command/openagents/new-agents/ ## OpenCoder Test Suite - Added 8 comprehensive test cases for OpenCoder agent - Tests cover: planning, context-loading, delegation, error-handling, implementation - Includes DEBUG_GUIDE.md and QUICK_TEST_GUIDE.md for developers ## Documentation & Tooling - Added DEVELOPMENT.md guide for contributors - Enhanced CONTRIBUTING.md with quick reference and common commands - Improved event-logger with DEBUG_VERBOSE mode for detailed output - Added debug scripts: show-test-conversation.sh, run-test-verbose.sh - Removed deprecated EXTERNAL_PR_GUIDE.md ## Version Bump - Bumped version to 0.0.3 (patch) Files changed: 60+ files (21 test updates, 16 new agent templates, 8 new tests, docs, tooling) * feat(ci): add PR title validation for semantic versioning Add automated PR title validation to ensure conventional commit format. This enables proper automatic version bumping when PRs are merged. Features: - Validates PR titles against conventional commit patterns - Shows expected version bump (major/minor/patch) - Posts helpful comment with examples if validation fails - Supports all conventional commit types (feat, fix, docs, etc.) - Supports breaking changes (feat!, fix!) - Supports pre-release tags ([alpha], [beta], [rc]) When PR titles follow the format, version bumping works correctly: - feat: → minor bump (0.3.0 → 0.4.0) - fix: → patch bump (0.3.0 → 0.3.1) - feat!: → major bump (0.3.0 → 1.0.0) * fix(ci): improve PR checks workflow with sequential execution Reorganize PR checks to run in logical sequence and skip unnecessary checks: Changes: - Run PR title validation first (fast, always required) - Detect changed files to determine which checks to run - Only run build checks if evals/ files changed - Add comprehensive summary job showing all check results - Prevent cache errors when evals files not changed Benefits: - Faster PR checks (skip unnecessary builds) - Clear sequential execution (title → changes → build) - Better error messages and summaries - Reduced CI/CD costs * fix(ci): resolve PR #42 issues and refactor prompt architecture ## Fixed PR #42 Issues 1. **Prompt Validation** - Refactored to new architecture where agent files are canonical defaults 2. **Package-lock.json** - Fixed workflow to use root package-lock (npm workspaces) 3. **Git Merge Base** - Added fetch-depth: 0 to PR checks workflow ## New Prompt Architecture **Before:** - Agent files had to match .opencode/prompts/<agent>/default.md - Caused validation failures when updating prompts - Redundant duplication **After:** - Agent files (.opencode/agent/*.md) = Canonical defaults (source of truth) - Prompt variants (.opencode/prompts/<agent>/<model>.md) = Model-specific optimizations - No more default.md files needed ## Changes ### Workflows - pr-checks.yml: Added fetch-depth: 0 for full git history - validate-test-suites.yml: Fixed package-lock path for npm workspaces - validate-registry.yml: Updated validation messaging ### Scripts - validate-pr.sh: Validates prompt library structure (rejects default.md files) - use-prompt.sh: Handles 'default' as agent file, variants as model-specific - test-prompt.sh: Tests default variant correctly, saves results to prompts/results/ ### Documentation - .opencode/prompts/README.md: Updated architecture explanation - docs/contributing/CONTRIBUTING.md: Updated prompt workflow - scripts/development/demo.sh: Updated structure display ## Results - 12 files changed, 231 insertions(+), 811 deletions(-) - Net reduction: 580 lines (cleaner codebase) - All validations passing - Results directory structure preserved - Backwards compatible with existing test results
8.1 KiB
8.1 KiB
OpenCoder Test Debugging Guide
Quick reference for debugging and validating opencoder tests.
🚀 Quick Start
Run Tests with Debug Mode
cd evals/framework
# Run single test with debug
npm run eval:sdk -- --agent=opencoder --pattern="planning/*.yaml" --debug
# Run all opencoder tests with debug
npm run eval:sdk -- --agent=opencoder --debug
# Run specific category
npm run eval:sdk -- --agent=opencoder --pattern="context-loading/*.yaml" --debug
View Full Conversation
# 1. Run test with --debug flag
# 2. Copy session ID from output (e.g., "Session created: ses_4ff9f7975ffeWYqM564A5ooo4y")
# 3. View conversation:
./scripts/debug/show-test-conversation.sh ses_4ff9f7975ffeWYqM564A5ooo4y
📁 Where Test Data Lives
Test Results
# Latest results (summary only)
cat evals/results/latest.json | jq '.'
# Historical results
ls -lt evals/results/history/2025-12/
# View specific result
cat evals/results/history/2025-12/08-235037-opencoder.json | jq '.'
Session Data (Full Conversations)
# Session messages
~/.local/share/opencode/storage/message/ses_XXXXX/*.json
# Message parts (tool calls, text, results)
~/.local/share/opencode/storage/part/msg_XXXXX/*.json
🔍 Inspecting Sessions
Find Recent Sessions
# List all sessions (most recent first)
ls -lt ~/.local/share/opencode/storage/message/ | head -20
# Find specific session
find ~/.local/share/opencode/storage/message -name "ses_*" -type d | grep "ses_4ff9f7975ffeWYqM564A5ooo4y"
View Session Messages
SESSION_ID="ses_4ff9f7975ffeWYqM564A5ooo4y"
# List all messages in session
ls -la ~/.local/share/opencode/storage/message/$SESSION_ID/
# View message content
cat ~/.local/share/opencode/storage/message/$SESSION_ID/msg_*.json | jq '.summary.body'
View Tool Calls
MESSAGE_ID="msg_b006086a5001CXI2Ks0mFkyPxU"
# List message parts
ls -la ~/.local/share/opencode/storage/part/$MESSAGE_ID/
# View all parts
for file in ~/.local/share/opencode/storage/part/$MESSAGE_ID/*.json; do
cat "$file" | jq '.'
done
🧪 Test Validation Checklist
✅ Planning & Approval Test
What to check:
- Agent starts with "DIGGING IN..."
- Creates implementation plan
- Explicitly asks for approval: "Approval needed before proceeding"
- Does NOT execute write/edit/bash without approval
How to verify:
npm run eval:sdk -- --agent=opencoder --pattern="planning/*.yaml" --debug
# Look for "Approval needed" in output
✅ Context Loading Test
What to check:
- Agent loads
.opencode/context/core/standards/code.md - Context loaded BEFORE write/edit operations
- Tool call sequence: read (context) → write (code)
How to verify:
npm run eval:sdk -- --agent=opencoder --pattern="context-loading/*.yaml" --debug
# Check test output for:
# "✓ Loaded: .opencode/context/core/standards/code.md"
# "✓ Timing: Context loaded XXXXms before execution"
✅ Delegation Test
What to check:
- Agent recognizes 4+ file features
- Mentions task-manager or creates detailed plan
- Breaks down complex features
How to verify:
npm run eval:sdk -- --agent=opencoder --pattern="delegation/*.yaml" --debug
# Look for "task-manager" or multi-step plan
📊 Understanding Test Output
Test Result Format
✅ test-name - Test Description
Duration: 23291ms
Events: 28
Approvals: 0
Context Loading:
✓ Loaded: /path/to/context/file.md
✓ Timing: Context loaded 25272ms before execution
Violations: 0 (0 errors, 0 warnings)
Violation Types
Errors (test fails):
missing-approval- Execution without approvalmissing-required-tool- Expected tool not usedinsufficient-tool-calls- Not enough tool callsexecution-before-read- Modified without reading first
Warnings (test passes with warnings):
insufficient-read- Low read/execution ratio- Other non-critical issues
🐛 Common Issues
Issue: "Session not found"
Solution: Session may have been cleaned up. Run test again with --debug flag.
Issue: "Test failed but agent looks correct"
Solution: Test expectations may be wrong. Check test YAML file:
cat evals/agents/opencoder/tests/planning/planning-approval-workflow.yaml
Issue: "Can't see tool calls"
Solution: Tool calls are in separate part files:
ls ~/.local/share/opencode/storage/part/msg_XXXXX/
Issue: "Agent didn't load context"
Solution: Check if context file exists:
ls -la .opencode/context/core/standards/code.md
🎯 Validating Specific Behaviors
1. Approval Gate
# Run test
npm run eval:sdk -- --agent=opencoder --pattern="planning/*.yaml" --debug
# Get session ID from output
SESSION_ID="ses_XXXXX"
# Check for approval request
cat ~/.local/share/opencode/storage/message/$SESSION_ID/*.json | \
jq -r '.summary.body' | \
grep -i "approval needed"
2. Context Loading
# Run test
npm run eval:sdk -- --agent=opencoder --pattern="context-loading/*.yaml" --debug
# Check test output for context loading confirmation
# Look for: "✓ Loaded: .opencode/context/core/standards/code.md"
3. Tool Call Sequence
# Get session ID from test output
SESSION_ID="ses_XXXXX"
# View all tool calls in order
for msg in ~/.local/share/opencode/storage/message/$SESSION_ID/*.json; do
MSG_ID=$(cat "$msg" | jq -r '.id')
if [ -d ~/.local/share/opencode/storage/part/$MSG_ID ]; then
echo "Message: $MSG_ID"
cat ~/.local/share/opencode/storage/part/$MSG_ID/*.json | \
jq -r 'select(.type == "tool") | " \(.tool): \(.input)"'
fi
done
📝 Creating New Tests
Test Template
id: my-test-name
name: Human Readable Test Name
description: |
What this test validates
category: developer # or business, creative, edge-case
agent: opencoder
model: anthropic/claude-sonnet-4-5
prompt: |
Your test prompt here
behavior:
mustContain:
- "Expected text in response"
mustNotUseTools: [write, edit] # Tools that should NOT be used
mustUseTools: [read] # Tools that MUST be used
expectedViolations:
- rule: approval-gate
shouldViolate: false # false = should NOT violate
severity: error
approvalStrategy:
type: auto-approve
timeout: 60000
tags:
- tag1
- tag2
Multi-Turn Test Template
prompts:
- text: "First prompt"
expectContext: false
- text: "approve"
delayMs: 2000
expectContext: true
contextFile: "code.md"
🚀 Advanced Debugging
Enable Verbose Logging
# Set debug environment variable
DEBUG=* npm run eval:sdk -- --agent=opencoder --pattern="planning/*.yaml" --debug
Compare Test Runs
# Run test twice and compare
npm run eval:sdk -- --agent=opencoder --pattern="planning/*.yaml" --debug > run1.log
npm run eval:sdk -- --agent=opencoder --pattern="planning/*.yaml" --debug > run2.log
diff run1.log run2.log
Extract All Tool Calls from Session
SESSION_ID="ses_XXXXX"
# Create tool call report
echo "Tool Calls in Session: $SESSION_ID"
echo "======================================"
for msg in ~/.local/share/opencode/storage/message/$SESSION_ID/*.json; do
MSG_ID=$(cat "$msg" | jq -r '.id')
ROLE=$(cat "$msg" | jq -r '.role')
if [ "$ROLE" = "assistant" ] && [ -d ~/.local/share/opencode/storage/part/$MSG_ID ]; then
cat ~/.local/share/opencode/storage/part/$MSG_ID/*.json | \
jq -r 'select(.type == "tool") | "\(.tool): \(.input | tostring)"'
fi
done
📚 Resources
- Test Validation Report:
TEST_VALIDATION_REPORT.md - Test Configuration:
config/config.yaml - Prompt File:
../../.opencode/agent/opencoder.md - Debug Scripts:
../../evals/framework/scripts/debug/
💡 Tips
- Always use
--debugflag when investigating test failures - Save session IDs from test output for later inspection
- Check both test output AND session files for complete picture
- Compare passing vs failing tests to identify patterns
- Verify context files exist before running context loading tests
Last Updated: 2025-12-08