chore(autoreview): align canonical skill (#104701)

This commit is contained in:
Vincent Koc
2026-07-12 05:00:26 +08:00
committed by GitHub
parent a21a08c504
commit fd9f84ffdc
4 changed files with 2139 additions and 63 deletions

View File

@@ -91,11 +91,17 @@ Set the skill script paths once, then use `"$AUTOREVIEW"` and `"$AUTOREVIEW_HARN
Choose one:
```bash
# Project-local skill in the current repo:
# Project-local skill in the current repo for Codex and other agents:
export AUTOREVIEW=".agents/skills/autoreview/scripts/autoreview"
export AUTOREVIEW_HARNESS=".agents/skills/autoreview/scripts/test-review-harness"
```
```bash
# Claude Code project-local skill in the current repo:
export AUTOREVIEW=".claude/skills/autoreview/scripts/autoreview"
export AUTOREVIEW_HARNESS=".claude/skills/autoreview/scripts/test-review-harness"
```
```bash
# Source checkout of openclaw/agent-skills:
export AUTOREVIEW="skills/autoreview/scripts/autoreview"
@@ -109,16 +115,22 @@ export AUTOREVIEW="$AGENTS_HOME/skills/autoreview/scripts/autoreview"
export AUTOREVIEW_HARNESS="$AGENTS_HOME/skills/autoreview/scripts/test-review-harness"
```
When using Claude Code, set `AGENTS_HOME="$HOME/.claude"` for global skills. Project-local skills live under `.claude/skills/` in the current repo.
When using Claude Code, set `AGENTS_HOME="$HOME/.claude"` for global skills.
On native Windows, choose the matching pair:
```powershell
# Project-local skill in the current repo:
# Project-local skill in the current repo for Codex and other agents:
$AUTOREVIEW = ".agents\skills\autoreview\scripts\autoreview"
$AUTOREVIEW_HARNESS = ".agents\skills\autoreview\scripts\test-review-harness.ps1"
```
```powershell
# Claude Code project-local skill in the current repo:
$AUTOREVIEW = ".claude\skills\autoreview\scripts\autoreview"
$AUTOREVIEW_HARNESS = ".claude\skills\autoreview\scripts\test-review-harness.ps1"
```
```powershell
# Source checkout of openclaw/agent-skills:
$AUTOREVIEW = "skills\autoreview\scripts\autoreview"
@@ -188,6 +200,12 @@ Format first if formatting can change line locations. Then it is OK to run tests
On Windows, the default `--parallel-tests` shell preserves the platform `cmd.exe`
semantics used by Python `shell=True`. Use `--parallel-tests-shell powershell`
or `--parallel-tests-shell pwsh` when the focused test command is PowerShell-specific.
Parallel tests inherit only a small allowlist of ordinary OS, CI, and toolchain
variables. Put additional non-secret project controls directly in the test command.
Home and standard config directories point to a temporary isolated root that is
removed after the command exits. Do not put secrets in the command because it is
printed before execution. Run secret-bearing or credentialed tests separately in an
appropriately isolated remote runner.
Tradeoff: tests may force code changes that stale the review. If tests or review lead to code edits, rerun the affected tests and rerun review until no accepted/actionable findings remain. Once that rerun exits cleanly, stop; do not spend another long review cycle on redundant confirmation.
@@ -295,6 +313,7 @@ loader such as an untracked `.envrc`; the helper does not write a config file.
| `AUTOREVIEW_CODEX_CONFIG` | Safe Codex model/response tuning overrides, semicolon-separated, e.g. `service_tier="fast"`; capability-bearing keys fail closed |
| `AUTOREVIEW_CODEX_SPEED` | Codex service tier override: `fast` (priority), `flex`, or `default`; silently standard when the model does not list the tier |
| `AUTOREVIEW_CLAUDE_FALLBACK_MODEL` | Claude-only fallback chain |
| `AUTOREVIEW_PROVIDER_ENV_ALLOW` | Comma-separated custom Pi/OpenCode credential variable names; names must end in a recognized credential suffix |
Codex maps thinking to `model_reasoning_effort`. Claude maps thinking to `--effort`. Pi maps thinking to `--thinking`. Only Claude accepts `--fallback-model`; global CLI/env fallback requires at least one Claude reviewer, and engine-specific fallback overrides require that reviewer to be selected. Non-Claude fallback overrides, including `AUTOREVIEW_<NONCLAUDE>_FALLBACK_MODEL`, fail closed instead of being silently ignored.

File diff suppressed because it is too large Load Diff

View File

@@ -200,6 +200,10 @@ class AutoreviewCompatibilityTests(unittest.TestCase):
"resolve_command",
return_value="/usr/bin/codex",
), mock.patch.object(AUTOREVIEW, "codex_auth_config_flags", return_value=[]), mock.patch.object(
AUTOREVIEW,
"prepare_codex_runtime_auth",
return_value=None,
), mock.patch.object(
AUTOREVIEW,
"run_with_heartbeat",
side_effect=fake_run,
@@ -227,11 +231,13 @@ class AutoreviewCompatibilityTests(unittest.TestCase):
command: list[str],
cwd: Path,
*_args: object,
**_kwargs: object,
**kwargs: object,
) -> subprocess.CompletedProcess[str]:
observed["cwd"] = cwd
observed["command"] = command
observed["command_cwd"] = Path(command[command.index("-C") + 1])
observed["workspace_entries"] = list(cwd.iterdir())
observed["env"] = kwargs["env"]
output_path = Path(command[command.index("--output-last-message") + 1])
output_path.write_text(json.dumps(FINAL_REPORT))
return subprocess.CompletedProcess(command, 0, "", "")
@@ -239,7 +245,11 @@ class AutoreviewCompatibilityTests(unittest.TestCase):
with tempfile.TemporaryDirectory(prefix="autoreview-codex-workspace-test.") as tmpdir:
repo = Path(tmpdir)
(repo / ".env").write_text("OPENAI_API_KEY=ignored-secret\n")
with mock.patch.object(
with mock.patch.dict(
os.environ,
{"CODEX_HOME": ""},
clear=False,
), mock.patch.object(
AUTOREVIEW,
"resolve_command",
return_value="/usr/bin/codex",
@@ -247,6 +257,14 @@ class AutoreviewCompatibilityTests(unittest.TestCase):
AUTOREVIEW,
"codex_auth_config_flags",
return_value=[],
), mock.patch.object(
AUTOREVIEW,
"prepare_codex_runtime_auth",
return_value=None,
), mock.patch.object(
AUTOREVIEW,
"codex_source_home",
return_value=None,
), mock.patch.object(
AUTOREVIEW,
"run_with_heartbeat",
@@ -264,6 +282,18 @@ class AutoreviewCompatibilityTests(unittest.TestCase):
self.assertNotEqual(observed_cwd.resolve(), repo.resolve())
self.assertEqual(observed_cwd, command_cwd)
self.assertEqual(observed["workspace_entries"], [])
env = observed["env"]
self.assertIsInstance(env, dict)
assert isinstance(env, dict)
self.assertNotEqual(env["HOME"], os.environ.get("HOME"))
self.assertEqual(env["USERPROFILE"], env["HOME"])
self.assertNotEqual(env.get("CODEX_HOME"), str(repo.resolve()))
self.assertEqual(Path(env["CODEX_HOME"]).name, "codex-home")
self.assertNotEqual(env["CODEX_HOME"], str((Path.home() / ".codex").resolve()))
self.assertIn("features.shell_snapshot=false", observed["command"])
self.assertIn("features.hooks=false", observed["command"])
self.assertIn("features.plugins=false", observed["command"])
self.assertIn("skills.include_instructions=false", observed["command"])
def test_codex_does_not_fallback_after_unrelated_failure(self) -> None:
args = argparse.Namespace(
@@ -288,6 +318,10 @@ class AutoreviewCompatibilityTests(unittest.TestCase):
"resolve_command",
return_value="/usr/bin/codex",
), mock.patch.object(AUTOREVIEW, "codex_auth_config_flags", return_value=[]), mock.patch.object(
AUTOREVIEW,
"prepare_codex_runtime_auth",
return_value=None,
), mock.patch.object(
AUTOREVIEW,
"run_with_heartbeat",
side_effect=fake_run,
@@ -325,6 +359,10 @@ class AutoreviewCompatibilityTests(unittest.TestCase):
"resolve_command",
return_value="/usr/bin/codex",
), mock.patch.object(AUTOREVIEW, "codex_auth_config_flags", return_value=[]), mock.patch.object(
AUTOREVIEW,
"prepare_codex_runtime_auth",
return_value=None,
), mock.patch.object(
AUTOREVIEW,
"run_with_heartbeat",
side_effect=fake_run,

File diff suppressed because it is too large Load Diff