Add V1 harness type aliases#1425
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 063a28f. Configure here.
ApprovabilityVerdict: Needs human review This PR introduces new runtime configuration resolution logic for harness type aliases, which affects how TOML configs are parsed and instantiated. While the changes are well-tested and the review comments' concerns appear addressed in code, the new config coercion logic and alias registration system warrant human review to verify the behavior matches expectations. You can customize Macroscope's approvability policy. Learn more. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 063a28f5f3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
063a28f to
b0256d7
Compare
b0256d7 to
163d2de
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 163d2de10f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| key = "".join(char for char in alias.lower() if char.isalnum()) | ||
| _CONFIG_TYPE_ALIASES[(base_cls, key)] = config_cls |
There was a problem hiding this comment.
Reject alias collisions instead of overwriting registrations
register_config_owner now writes every normalized alias directly into the process-global _CONFIG_TYPE_ALIASES map, so a later class with the same alias silently replaces the earlier mapping. In practice, if any custom harness normalizes to an existing packaged name (for example, another pi-like alias), harness = "pi" will instantiate whichever class was imported last, making config resolution import-order dependent across environments.
Useful? React with 👍 / 👎.
| return config_type_alias( | ||
| cast(str, data.pop("type")), HarnessConfig |
There was a problem hiding this comment.
Validate
harness.type is a string before alias lookup
The type field is cast to str and passed to config_type_alias without a runtime check. If TOML supplies a non-string value (e.g. type = 123), alias normalization calls .lower() on a non-string and raises an internal exception instead of a clear config validation error, which makes malformed eval configs fail with an opaque traceback.
Useful? React with 👍 / 👎.
163d2de to
b3f0633
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b3f0633ea7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| _CONFIG_OWNERS[key] = owner_cls | ||
| for alias in (owner_cls.__name__, config_cls.__name__.removesuffix("Config")): | ||
| key = "".join(char for char in alias.lower() if char.isalnum()) | ||
| _CONFIG_TYPE_ALIASES.setdefault((base_cls, key), config_cls) |
There was a problem hiding this comment.
Defer registry writes until alias validation succeeds
register_config_owner mutates global registries before collision checks complete: it stores _CONFIG_OWNERS and default type aliases first, then may raise on an explicit alias conflict. In a class definition like _config_aliases = ("pi",), __init_subclass__ raises, but the earlier entries remain, so the rejected harness can still be resolved by its class-name alias and even instantiated later via Env(config=...). This leaves process-wide config resolution in a partially committed state after a failed registration and makes subsequent harness lookup behavior inconsistent.
Useful? React with 👍 / 👎.

Summary
harness: vf.HarnessConfigfields can resolve TOML aliases likeharness = "pi"and[eval.harness] type = "terminus2"Testing
uv run pytest tests/test_v1_config_extension.py tests/test_v1_harbor_cli.py tests/test_eval_cli.py -quv run pre-commit run --all-filesgit diff --checkharness = "pi"withprime eval runcompleted with reward1.0[eval.harness] type = "pi"withprime eval runcompleted with reward1.0Note
Medium Risk
Adds new alias-based coercion paths for v1 harness config parsing from TOML/CLI, which can affect environment loading and validation behavior for existing configs. Also tweaks generated shell snippets for packaged harnesses, with low runtime risk but potential for regressions in command execution if misquoted.
Overview
Enables selecting packaged v1 harness configs by name when an environment keeps
EnvConfig.harness: vf.HarnessConfiggeneric, supporting bothharness = "pi"and[eval.harness] type = "terminus2"style TOML.Implements a first-class config type-alias registry (
config_type_alias) and extendsEnvConfigvalidation to resolve these aliases (including collision checks and type validation). Updates eval TOML normalization to pass string harness selections through, adds regression tests for alias selection, and adjusts OpenCode/Pi harness shell guards to be POSIX-compatible ([ -z ... ]).Reviewed by Cursor Bugbot for commit b3f0633. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add V1 harness type alias resolution to
EnvConfigEnvConfig.validate_child_confignow resolvesharnessfrom a bare alias string (e.g.,"pi") or a mapping with atypekey (e.g.,{type = "terminus2"}) whenharnessis annotated as the baseHarnessConfig._config_aliases, a per-class alias registry, and a newconfig_type_alias()lookup function; alias collisions raiseTypeErrorat registration time.harnessvalue through toenv_args.config.harnesswithout table normalization, supporting TOML shorthand likeharness = "pi".[ -z ]instead of[[ -z ]].Macroscope summarized b3f0633.