Skip to content

Commit 55d5c55

Browse files
committed
fix(cli): repair installed preflight command
1 parent 7101912 commit 55d5c55

11 files changed

Lines changed: 76 additions & 18 deletions

File tree

CHANGELOG.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,22 @@ All notable changes to RewardHarness are recorded here. Versions follow [SemVer]
44

55
## [Unreleased]
66

7-
Future changes after v0.2.1.
7+
Future changes after v0.2.2.
8+
9+
## [0.2.2] — 2026-08-18
10+
11+
### Fixed
12+
13+
- Fixed the installed `rewardharness check` command reparsing the process-wide
14+
arguments after the main CLI had already consumed the `check` subcommand.
15+
The preflight now receives explicit arguments and works consistently through
16+
both `rewardharness check` and `python scripts/check_env.py`.
17+
18+
### Added
19+
20+
- Added `--endpoints` and `--timeout` to `rewardharness check`, with validation
21+
for non-positive timeouts and direct forwarding to endpoint probes.
22+
- Added regression coverage for CLI-to-diagnostics option forwarding.
823

924
## [0.2.1] — 2026-08-18
1025

@@ -162,6 +177,7 @@ deprecated `src` namespace remains as a compatibility layer for v0.2.
162177
- `make demo` and `make benchmark` default to `--library-dir examples/seed_library` for non-empty starting state.
163178
- `make help` is now a credentials matrix showing what each target actually needs.
164179

180+
[0.2.2]: https://github.com/TIGER-AI-Lab/RewardHarness/releases/tag/v0.2.2
165181
[0.2.1]: https://github.com/TIGER-AI-Lab/RewardHarness/releases/tag/v0.2.1
166182
[0.2.0]: https://github.com/TIGER-AI-Lab/RewardHarness/releases/tag/v0.2.0
167183
[0.1.2]: https://github.com/TIGER-AI-Lab/RewardHarness/releases/tag/v0.1.2

CITATION.cff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cff-version: 1.2.0
22
message: "If you use this software, please cite the paper."
33
title: "RewardHarness: Self-Evolving Agentic Post-Training"
4-
version: "0.2.1"
4+
version: "0.2.2"
55
date-released: "2026-08-17"
66
type: software
77
authors:

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ Read [`WALKTHROUGH.md`](WALKTHROUGH.md) for the 9-step path from `git clone` to
4343

4444
## Updates
4545

46+
- **2026-08-18**`v0.2.2`: fixed the installed `rewardharness check`
47+
command and added explicit endpoint path and timeout controls.
4648
- **2026-08-18**`v0.2.1`: deterministic wheel/sdist content auditing,
4749
stricter release metadata verification, and safer clean-build publishing.
4850
- **2026-08-17**`v0.2.0`: stable PyPI release with verified wheel/sdist,

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Only the current `main` branch and the most recent tagged release receive securi
2323
| Version | Supported |
2424
|---|---|
2525
| `main` ||
26-
| `v0.2.1` (latest) ||
26+
| `v0.2.2` (latest) ||
2727
| earlier ||
2828

2929
## Disclosure history

TROUBLESHOOTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export GEMINI_LOCATION="global" # or us-central1 / europe-west4
5151
Quick check:
5252

5353
```bash
54-
python -c "from src.gemini_client import get_client; get_client(); print('OK')"
54+
python -c "from rewardharness.clients.gemini import get_client; get_client(); print('OK')"
5555
```
5656

5757
**`PermissionDenied: 403 Vertex AI API has not been used in project ... or it is disabled`**

rewardharness/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Single source of truth for the RewardHarness package version."""
22

3-
__version__ = "0.2.1"
3+
__version__ = "0.2.2"

rewardharness/cli.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ def build_parser() -> argparse.ArgumentParser:
3838
parser.add_argument("--version", action="version", version=f"%(prog)s {__version__}")
3939
subparsers = parser.add_subparsers(dest="command", required=True)
4040

41-
subparsers.add_parser("check", help="validate local credentials and endpoints")
41+
check_parser = subparsers.add_parser("check", help="validate local credentials and endpoints")
42+
check_parser.add_argument("--endpoints", default=str(default_endpoints_path()))
43+
check_parser.add_argument("--timeout", type=float, default=3.0)
4244
subparsers.add_parser("release-status", help="show canonical package and release identifiers")
4345

4446
inspect_parser = subparsers.add_parser("inspect", help="inspect a Library registry")
@@ -137,7 +139,7 @@ def main(argv: Sequence[str] | None = None) -> int:
137139
if args.command == "check":
138140
from rewardharness.diagnostics import main as diagnostics_main
139141

140-
return diagnostics_main()
142+
return diagnostics_main(["--endpoints", args.endpoints, "--timeout", str(args.timeout)])
141143
if args.command == "release-status":
142144
print(json.dumps(ReleaseIdentity.current().to_dict(), indent=2, sort_keys=True))
143145
return 0

rewardharness/diagnostics.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import sys
2828
import urllib.error
2929
import urllib.request
30+
from collections.abc import Sequence
3031
from concurrent.futures import ThreadPoolExecutor
3132
from pathlib import Path
3233

@@ -131,7 +132,7 @@ def check_endpoints(endpoints_path: str, timeout: float = 3.0) -> bool:
131132
print(f" [{WARN}] no endpoints listed in {endpoints_path}")
132133
return True
133134
# Import the canonical constant so this script's "expected" stays in
134-
# lockstep with src.sub_agent.SUBAGENT_MODEL (already env-var-aware).
135+
# lockstep with rewardharness.evaluation.engine.SUBAGENT_MODEL.
135136
# Resolved lazily so check_env.py keeps working even if src/ isn't on
136137
# the path (e.g. running this from outside the repo root).
137138
try:
@@ -163,14 +164,22 @@ def check_endpoints(endpoints_path: str, timeout: float = 3.0) -> bool:
163164
return True # endpoint probe is informational only
164165

165166

166-
def main():
167+
def main(argv: Sequence[str] | None = None) -> int:
167168
parser = argparse.ArgumentParser(description=__doc__.split("\n")[0])
168169
parser.add_argument(
169170
"--endpoints",
170171
default="configs/endpoints.txt",
171172
help="Path to endpoints file (default: configs/endpoints.txt)",
172173
)
173-
args = parser.parse_args()
174+
parser.add_argument(
175+
"--timeout",
176+
type=float,
177+
default=3.0,
178+
help="Per-endpoint timeout in seconds (default: 3.0)",
179+
)
180+
args = parser.parse_args(argv)
181+
if args.timeout <= 0:
182+
parser.error("--timeout must be positive")
174183

175184
print("RewardHarness preflight check\n")
176185

@@ -183,7 +192,7 @@ def main():
183192
print("\n4. Service-account credentials")
184193
ok_creds = check_credentials_file() if ok_env else False
185194
print("\n5. vLLM endpoints (informational)")
186-
check_endpoints(args.endpoints)
195+
check_endpoints(args.endpoints, timeout=args.timeout)
187196

188197
print()
189198
all_required = ok_py and ok_imports and ok_env and ok_creds

tests/test_check_env.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from unittest.mock import patch
1010

1111
import rewardharness.diagnostics as diagnostics
12+
from rewardharness.cli import main as cli_main
1213

1314

1415
def _load_check_env():
@@ -62,3 +63,31 @@ def test_non_200_returns_status_line(self):
6263
_url, err, served = mod._probe_one("http://x/v1", timeout=1.0)
6364
assert "HTTP 500" in err
6465
assert served == ""
66+
67+
68+
def test_cli_forwards_check_options_without_reparsing_process_argv(monkeypatch):
69+
received = []
70+
71+
def fake_main(argv=None):
72+
received.append(argv)
73+
return 0
74+
75+
monkeypatch.setattr(diagnostics, "main", fake_main)
76+
assert cli_main(["check", "--endpoints", "custom.txt", "--timeout", "0.25"]) == 0
77+
assert received == [["--endpoints", "custom.txt", "--timeout", "0.25"]]
78+
79+
80+
def test_diagnostics_main_uses_explicit_options(monkeypatch):
81+
observed = []
82+
monkeypatch.setattr(diagnostics, "check_python_version", lambda: True)
83+
monkeypatch.setattr(diagnostics, "check_imports", lambda: True)
84+
monkeypatch.setattr(diagnostics, "check_env_vars", lambda: True)
85+
monkeypatch.setattr(diagnostics, "check_credentials_file", lambda: True)
86+
monkeypatch.setattr(
87+
diagnostics,
88+
"check_endpoints",
89+
lambda path, timeout: observed.append((path, timeout)) or True,
90+
)
91+
92+
assert diagnostics.main(["--endpoints", "custom.txt", "--timeout", "0.25"]) == 0
93+
assert observed == [("custom.txt", 0.25)]

tests/test_infrastructure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def test_cli_reports_package_version(capsys):
9797
with pytest.raises(SystemExit) as raised:
9898
build_parser().parse_args(["--version"])
9999
assert raised.value.code == 0
100-
assert capsys.readouterr().out.strip() == "rewardharness 0.2.1"
100+
assert capsys.readouterr().out.strip() == "rewardharness 0.2.2"
101101

102102

103103
def test_gemini_text_and_candidate_fallback(monkeypatch):

0 commit comments

Comments
 (0)