harness-evolver 3.1.0 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "harness-evolver",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "description": "LangSmith-native autonomous agent optimization for Claude Code",
5
5
  "author": "Raphael Valdetaro",
6
6
  "license": "MIT",
@@ -75,13 +75,15 @@ python3 -c "import json; c=json.load(open('.evolver.json')); print(f'v{c[\"itera
75
75
 
76
76
  ### 1.5. Gather Trace Insights
77
77
 
78
- Run trace insights from the best experiment:
78
+ Read the best experiment from config. If null (no baseline was run), skip trace insights for this iteration — proposers will work blind on the first pass:
79
79
 
80
80
  ```bash
81
- BEST=$(python3 -c "import json; print(json.load(open('.evolver.json'))['best_experiment'])")
82
- $EVOLVER_PY $TOOLS/trace_insights.py \
83
- --from-experiment "$BEST" \
84
- --output trace_insights.json 2>/dev/null
81
+ BEST=$(python3 -c "import json; b=json.load(open('.evolver.json')).get('best_experiment'); print(b if b else '')")
82
+ if [ -n "$BEST" ]; then
83
+ $EVOLVER_PY $TOOLS/trace_insights.py \
84
+ --from-experiment "$BEST" \
85
+ --output trace_insights.json 2>/dev/null
86
+ fi
85
87
  ```
86
88
 
87
89
  If a production project is configured, also gather production insights:
@@ -99,17 +101,20 @@ fi
99
101
 
100
102
  ### 1.8. Analyze Per-Task Failures
101
103
 
102
- Read the best experiment results and cluster failures:
104
+ If `$BEST` is set (not the first iteration without baseline), read results and cluster failures:
103
105
 
104
106
  ```bash
105
- $EVOLVER_PY $TOOLS/read_results.py \
106
- --experiment "$BEST" \
107
- --config .evolver.json \
108
- --output best_results.json 2>/dev/null
107
+ if [ -n "$BEST" ]; then
108
+ $EVOLVER_PY $TOOLS/read_results.py \
109
+ --experiment "$BEST" \
110
+ --config .evolver.json \
111
+ --output best_results.json 2>/dev/null
112
+ fi
109
113
  ```
110
114
 
111
- Parse `best_results.json` to find failing examples (score < 0.7). Group by metadata or error pattern.
115
+ If `best_results.json` exists, parse it to find failing examples (score < 0.7). Group by metadata or error pattern.
112
116
  Generate adaptive briefings for Candidates D and E (same logic as v2).
117
+ If no best_results.json (first iteration without baseline), all proposers work from code analysis only — no failure data available.
113
118
 
114
119
  ### 2. Spawn 5 Proposers in Parallel
115
120
 
package/tools/setup.py CHANGED
@@ -87,6 +87,29 @@ def check_dependencies():
87
87
  return missing
88
88
 
89
89
 
90
+ def resolve_dataset_name(client, base_name):
91
+ """Find an available dataset name by auto-incrementing the version suffix.
92
+
93
+ Tries base_name-eval-v1, v2, v3... until an unused name is found.
94
+ Returns (resolved_name, version_number).
95
+ """
96
+ existing = set()
97
+ try:
98
+ for ds in client.list_datasets():
99
+ existing.add(ds.name)
100
+ except Exception:
101
+ pass
102
+
103
+ for v in range(1, 100):
104
+ candidate = f"{base_name}-eval-v{v}"
105
+ if candidate not in existing:
106
+ return candidate, v
107
+
108
+ # Fallback: timestamp-based
109
+ ts = datetime.now(timezone.utc).strftime("%Y%m%d%H%M%S")
110
+ return f"{base_name}-eval-{ts}", 0
111
+
112
+
90
113
  def create_dataset_from_file(client, dataset_name, file_path):
91
114
  """Create a LangSmith dataset from a JSON file of inputs."""
92
115
  with open(file_path) as f:
@@ -320,6 +343,7 @@ def main():
320
343
  parser.add_argument("--dataset-from-file", default=None, help="Create dataset from JSON file")
321
344
  parser.add_argument("--dataset-from-langsmith", default=None, help="Create dataset from LangSmith project")
322
345
  parser.add_argument("--production-project", default=None, help="Production LangSmith project")
346
+ parser.add_argument("--dataset-name", default=None, help="Explicit dataset name (skip auto-versioning)")
323
347
  parser.add_argument("--evaluators", default=None, help="Comma-separated evaluator names")
324
348
  parser.add_argument("--skip-baseline", action="store_true", help="Skip baseline evaluation")
325
349
  parser.add_argument("--output", default=".evolver.json", help="Output config path")
@@ -351,9 +375,19 @@ def main():
351
375
  sys.exit(1)
352
376
 
353
377
  project_name = f"evolver-{args.project_name}"
354
- dataset_name = f"{args.project_name}-eval-v1"
355
378
  goals = [g.strip() for g in args.goals.split(",")]
356
379
 
380
+ # Resolve dataset name (explicit or auto-versioned)
381
+ if args.dataset_name:
382
+ dataset_name = args.dataset_name
383
+ print(f"Using explicit dataset name: '{dataset_name}'")
384
+ else:
385
+ dataset_name, version = resolve_dataset_name(client, args.project_name)
386
+ if version > 1:
387
+ print(f"Dataset name auto-versioned to '{dataset_name}' (v1-v{version-1} already exist)")
388
+ else:
389
+ print(f"Dataset: '{dataset_name}'")
390
+
357
391
  # Create dataset
358
392
  print(f"Creating dataset '{dataset_name}'...")
359
393
  if args.dataset_from_file: