Arbor Merge And Eval
Use this whenever scores, metadata, merge decisions, or final validation are
involved.
Dataset Discipline
- B_dev is for routine iteration, executor experiments, score tracking, and
idea selection.
- B_test is for milestone checks only: before merging a branch and at final
report time.
- If B_test diverges from B_dev, do not hand-wave it. Investigate overfitting,
noise, data split mismatch, or eval contamination.
Tree Metadata
Persist evaluation metadata early and update it after merges:
baseline_score: unmodified B_dev score.
trunk_score: current trunk B_dev score.
test_baseline_score: unmodified B_test score.
test_trunk_score: current trunk B_test score.
eval_cmd: B_dev command.
eval_cmd_test: B_test command.
eval_timeout, eval_retries, eval_retry_base_delay,
eval_retry_max_delay.
dataset_info: paths and split descriptions.
metric_direction: maximize or minimize.
trunk_branch: non-protected branch that receives verified merges.
submission_path, sample_submission_path.
Use {cwd} and {node_id} placeholders. Example:
cd {cwd} && uv run python run_eval.py --split dev --run-name {node_id}
Score Semantics
- Tree node
score is an absolute B_dev metric value.
- Merge verification uses B_test.
metric_direction controls improvement:
- maximize: higher is better.
- minimize: lower is better.
- Do not compare deltas with absolutes.
- If output has JSON with
score, prefer it. Otherwise extract the primary
metric from text (primary_score, score, accuracy, acc, etc.).
Merge Procedure
Native GitMergeBranch:
- Refuses target
main or master.
- Resolves target to configured
trunk_branch. main/master are base
branches, not merge targets.
- Creates an isolated worktree at
source_branch.
- Runs
eval_cmd_test with {cwd} and {node_id} substituted.
- Retries transient failures if configured.
- Extracts verified B_test score.
- Rejects the merge if B_test does not improve over
test_trunk_score or
test_baseline_score.
- Checks plugin protected paths and required outputs.
- Merges source into trunk with
--no-ff.
- Reports the verified test score and instructs the coordinator to update
tree metadata and node status.
After success:
TreeSetMeta(test_trunk_score=<verified score>).
- If needed, re-run B_dev on trunk and
TreeSetMeta(trunk_score=<dev score>).
TreeUpdateNode(node_id=<id>, status="merged").
Protected Paths And Required Outputs
For plugins such as MLE/Kaggle:
- Reject branches modifying protected globs such as
data/**, private/**,
or evaluation/**.
- Reject merge if required outputs such as
submission.csv do not exist on
the branch.
- Snapshot outputs in the workspace so finalization can recover the best one.
Merge Threshold
merge_threshold is a soft coordinator guideline, not a substitute for B_test.
A small improvement can merge when performance-first mode says every gain
counts and B_test verifies it. A large B_dev improvement must still be rejected
if B_test fails.
Final Stop
Before stopping:
- Ensure the best available branch is either merged or explicitly rejected.
- Run final B_test on trunk only if it is available, contract-authorized, and
the run is not smoke-only.
- Record
test_trunk_score.
- If
test_baseline_score is missing and a baseline test run is feasible,
record it.
- Hand off to
arbor-agent-resume-report.
For smoke/forward tests, do not run B_test or merge verification unless the
user explicitly requested a real run. Record test_trunk_score as unavailable,
state that no separate B_test was used, run arbor_state.py check, and hand
off to report generation.
Manual Emulation
If native GitMergeBranch is unavailable, use arbor-agent-tools:
python <tools>/arbor_state.py eval --cwd <project> --run-name <run> \
--split dev --cmd "<eval_cmd>" --set-meta baseline
python <tools>/arbor_state.py meta --cwd <project> --run-name <run> \
--set "trunk_branch=<trunk_branch>"
python <tools>/arbor_state.py merge --cwd <project> --run-name <run> \
--source-branch <branch> --node-id <id>
Pass --target-branch <trunk_branch> explicitly only when metadata is not set.
If a manual merge would touch live work, prefer --dry-run first.
1---2name: arbor-agent-merge-eval3description: Merge and evaluation discipline for Arbor. Use for TreeSetMeta metadata, B_dev/B_test separation, eval command templates, score parsing, GitMergeBranch behavior, protected paths, required outputs, metric_direction, trunk/test score updates, medal detection, and final evaluation before stopping.4---56# Arbor Merge And Eval78Use this whenever scores, metadata, merge decisions, or final validation are9involved.1011## Dataset Discipline1213- B_dev is for routine iteration, executor experiments, score tracking, and14 idea selection.15- B_test is for milestone checks only: before merging a branch and at final16 report time.17- If B_test diverges from B_dev, do not hand-wave it. Investigate overfitting,18 noise, data split mismatch, or eval contamination.1920## Tree Metadata2122Persist evaluation metadata early and update it after merges:2324- `baseline_score`: unmodified B_dev score.25- `trunk_score`: current trunk B_dev score.26- `test_baseline_score`: unmodified B_test score.27- `test_trunk_score`: current trunk B_test score.28- `eval_cmd`: B_dev command.29- `eval_cmd_test`: B_test command.30- `eval_timeout`, `eval_retries`, `eval_retry_base_delay`,31 `eval_retry_max_delay`.32- `dataset_info`: paths and split descriptions.33- `metric_direction`: `maximize` or `minimize`.34- `trunk_branch`: non-protected branch that receives verified merges.35- `submission_path`, `sample_submission_path`.3637Use `{cwd}` and `{node_id}` placeholders. Example:3839```text40cd {cwd} && uv run python run_eval.py --split dev --run-name {node_id}41```4243## Score Semantics4445- Tree node `score` is an absolute B_dev metric value.46- Merge verification uses B_test.47- `metric_direction` controls improvement:48 - maximize: higher is better.49 - minimize: lower is better.50- Do not compare deltas with absolutes.51- If output has JSON with `score`, prefer it. Otherwise extract the primary52 metric from text (`primary_score`, `score`, `accuracy`, `acc`, etc.).5354## Merge Procedure5556Native `GitMergeBranch`:57581. Refuses target `main` or `master`.592. Resolves target to configured `trunk_branch`. `main`/`master` are base60 branches, not merge targets.613. Creates an isolated worktree at `source_branch`.624. Runs `eval_cmd_test` with `{cwd}` and `{node_id}` substituted.635. Retries transient failures if configured.646. Extracts verified B_test score.657. Rejects the merge if B_test does not improve over `test_trunk_score` or66 `test_baseline_score`.678. Checks plugin protected paths and required outputs.689. Merges source into trunk with `--no-ff`.6910. Reports the verified test score and instructs the coordinator to update70 tree metadata and node status.7172After success:7374- `TreeSetMeta(test_trunk_score=<verified score>)`.75- If needed, re-run B_dev on trunk and `TreeSetMeta(trunk_score=<dev score>)`.76- `TreeUpdateNode(node_id=<id>, status="merged")`.7778## Protected Paths And Required Outputs7980For plugins such as MLE/Kaggle:8182- Reject branches modifying protected globs such as `data/**`, `private/**`,83 or `evaluation/**`.84- Reject merge if required outputs such as `submission.csv` do not exist on85 the branch.86- Snapshot outputs in the workspace so finalization can recover the best one.8788## Merge Threshold8990`merge_threshold` is a soft coordinator guideline, not a substitute for B_test.91A small improvement can merge when performance-first mode says every gain92counts and B_test verifies it. A large B_dev improvement must still be rejected93if B_test fails.9495## Final Stop9697Before stopping:98991. Ensure the best available branch is either merged or explicitly rejected.1002. Run final B_test on trunk only if it is available, contract-authorized, and101 the run is not smoke-only.1023. Record `test_trunk_score`.1034. If `test_baseline_score` is missing and a baseline test run is feasible,104 record it.1055. Hand off to `arbor-agent-resume-report`.106107For smoke/forward tests, do not run B_test or merge verification unless the108user explicitly requested a real run. Record `test_trunk_score` as unavailable,109state that no separate B_test was used, run `arbor_state.py check`, and hand110off to report generation.111112## Manual Emulation113114If native `GitMergeBranch` is unavailable, use `arbor-agent-tools`:115116```bash117python <tools>/arbor_state.py eval --cwd <project> --run-name <run> \118 --split dev --cmd "<eval_cmd>" --set-meta baseline119120python <tools>/arbor_state.py meta --cwd <project> --run-name <run> \121 --set "trunk_branch=<trunk_branch>"122123python <tools>/arbor_state.py merge --cwd <project> --run-name <run> \124 --source-branch <branch> --node-id <id>125```126127Pass `--target-branch <trunk_branch>` explicitly only when metadata is not set.128If a manual merge would touch live work, prefer `--dry-run` first.