* feat(evals): restructure OpenAgent tests + fix SDK mode session creation
## Test Restructure
Reorganize OpenAgent tests into 6 priority-based categories for better
maintainability, scalability, and CI/CD integration.
New structure:
- 01-critical-rules/ (15 tests) - MUST PASS safety requirements
- 02-workflow-stages/ (2 tests) - Workflow validation
- 03-delegation/ (0 tests) - Delegation scenarios (ready for new tests)
- 04-execution-paths/ (2 tests) - Conversational vs task paths
- 05-edge-cases/ (1 test) - Edge cases and boundaries
- 06-integration/ (2 tests) - Complex multi-turn scenarios
Changes:
- Migrate 22 existing tests to new structure (verified identical)
- Add comprehensive documentation (5 markdown files)
- Add migration and verification scripts
- Preserve original test locations for backward compatibility
## Bug Fix: SDK Mode Session Creation
Fix session creation failure introduced in commit
|
||
|---|---|---|
| .. | ||
| README.md | ||
Delegation Tests
Priority: MEDIUM (Best practices)
Timeout: 90-180s
Must Pass: SHOULD (not absolute, but important)
Purpose
Tests for delegation rules from openagent.md (lines 252-295):
- scale - 4+ files → delegate
- expertise - Specialized knowledge → delegate
- complexity - Multi-step dependencies → delegate
- review - Multi-component review → delegate
- perspective - Fresh eyes/alternatives → delegate
- context-bundles - Context bundle creation and passing
Subfolders
scale/
Tests the 4+ files delegation rule.
Positive tests:
- 1-3 files → Execute directly
- 4+ files → Delegate to task-manager
- Exactly 4 files → Delegate (boundary test)
Negative tests:
- 4+ files → Execute directly without delegation (violation)
Override tests:
- User says "don't delegate" → Execute directly (allowed)
Timeout: 90s (delegation involves subagent coordination)
Example test:
id: delegation-scale-4-files
prompt: |
Create a new feature that adds user authentication.
This will require changes to:
- src/auth/login.ts
- src/auth/register.ts
- src/auth/middleware.ts
- src/models/user.ts
behavior:
mustUseTools: [task] # Should delegate
requiresApproval: true
expectedViolations:
- rule: delegation
shouldViolate: false # Should delegate, not violate
expertise/
Tests delegation for specialized knowledge tasks.
Examples of specialized knowledge:
- Security audits
- Performance optimization
- Algorithm design
- Architecture patterns
- Database optimization
Positive tests:
- Security task → Delegates to security specialist
- Performance task → Delegates to performance specialist
Timeout: 90s
complexity/
Tests delegation for multi-step dependencies.
Positive tests:
- Task with dependencies → Delegates to task-manager
- Sequential steps required → Delegates
Timeout: 90s
review/
Tests delegation for multi-component review tasks.
Positive tests:
- Review multiple components → Delegates to reviewer
- Code review request → Delegates
Timeout: 90s
context-bundles/
Tests context bundle creation and passing to subagents.
What to verify:
- Context bundle created at
.tmp/context/{session-id}/bundle.md - Bundle contains:
- Task description and objectives
- All loaded context files
- Constraints and requirements
- Expected output format
- Subagent receives bundle path in delegation prompt
Positive tests:
- Delegation → Creates bundle → Passes to subagent
- Bundle contains all required context
Timeout: 120s (needs time for bundle creation + delegation)
Example test:
id: delegation-context-bundle-creation
prompt: |
Create a new feature with 5 files (triggers delegation).
Verify context bundle is created.
behavior:
mustUseTools: [read, task] # Read context, then delegate
requiresApproval: true
# After test, verify bundle exists
postConditions:
- fileExists: ".tmp/context/*/bundle.md"
- fileContains:
path: ".tmp/context/*/bundle.md"
text: "Task description"
File Creation Rules
Tests should verify agent creates files in correct locations:
# Agent should create context bundles here:
.tmp/context/{session-id}/bundle.md
# Test files should go here:
evals/test_tmp/
Running These Tests
# Run all delegation tests
npm run eval:sdk -- --agent=openagent --pattern="03-delegation/**/*.yaml"
# Run specific category
npm run eval:sdk -- --agent=openagent --pattern="03-delegation/scale/*.yaml"
npm run eval:sdk -- --agent=openagent --pattern="03-delegation/context-bundles/*.yaml"
Success Criteria
These tests validate best practices, not absolute requirements:
- SHOULD delegate when criteria met
- MAY execute directly if user overrides
- MUST create context bundles when delegating
Failures here indicate suboptimal behavior, not critical errors.