Repository navigation
feat: add local-review command for offline branch review - #253
anagnorisis2peripeteia wants to merge 1 commit into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 4, 2026, 7:22 AM ET / 11:22 UTC. Summary Reproducibility: not applicable. as a bug reproduction; this is a feature PR. The PR body provides terminal proof for the new local-review happy path, and source inspection covers the patched launcher paths. Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the local-review command if maintainers accept the new CLI/env surface, preserving the Windows-safe launcher handling and stale-output cleanup with focused tests. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction; this is a feature PR. The PR body provides terminal proof for the new local-review happy path, and source inspection covers the patched launcher paths. Is this the best way to solve the issue? Yes, pending maintainer acceptance of the feature surface. Reusing the existing review prompt/schema engine is the narrowest maintainable path for local branch review, with the remaining concern being merge-order and platform validation rather than a code defect. AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 74f63a090af7. Label changesLabel changes:
Label justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
e29b2dc to
a3a121d
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
a3a121d to
75613c8
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Adds a 'local-review' CLI command that reviews the current branch diff against a base branch using Codex, without requiring a GitHub PR. Includes all prerequisites for local runs: - CODEX_BIN env var support (Windows .cmd wrapper compatibility) - shell: true on win32 for all Codex spawn sites - CLAWSWEEPER_CODEX_LOGIN_METHOD for ChatGPT Pro OAuth login - Applied to all 4 Codex subprocess launchers - Clears stale output before each review run Merge order: this PR subsumes openclaw#250 (Windows spawn) and openclaw#251 (OAuth login). If this lands first, close those as superseded. If either lands first, this PR needs a trivial rebase (identical changes).
|
@clawsweeper re-review |
75613c8 to
3569490
Compare
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Review note from local harness testing: I tested this locally on Linux against a real OpenClaw branch using an authenticated Codex binary: CODEX_BIN=<bundled codex path> \
CLAWSWEEPER_CODEX_LOGIN_METHOD=chatgpt \
node dist/clawsweeper.js local-review \
--target-dir /home/rev/projects/openclaw \
--repo openclaw/openclaw \
--base upstream/mainThe command successfully built local PR context from This is a major workflow unlock: it lets contributors run ClawSweeper-style review before opening or updating a GitHub PR. I would merge this first and treat #250/#251 as superseded if maintainers prefer one integrated PR. |
|
Closing this branch because the current implementation cannot safely provide the advertised local review workflow. The command rejects staged/untracked changes while describing its committed A replacement should be a narrow committed-range review built on Commit Sweeper or a shared range-review helper, require a clean checkout, use a unique temporary directory, pass no GitHub token, and either reject unsupported repositories or define an explicit neutral local profile. Thanks @anagnorisis2peripeteia for exploring the workflow. |
…weeper (#298) * feat: add local-review command for offline branch review Reviews the committed range merge-base(base,HEAD)..HEAD as one unit via the Commit Sweeper engine (runCodexProcess). Conforms to the #253 replacement spec: clean checkout required, unique per-run output dir, withholds all GitHub tokens, rejects unsupported repos (no foreign-profile fallback). Built fresh off main on the current codex infrastructure. * fix(local-review): skip gh-api metadata in offline mode commitMetadata takes an offline flag that skips the gh api author/committer lookups; local-review passes it. gh ignores token env vars, so not running gh at all is the only way to honor the no-GitHub-access contract. Found by local-review self-reviewing this branch. * fix(local-review): isolate gh config in offline mode Point GH_CONFIG_DIR at an empty dir so the spawned reviewer cannot use cached gh auth even if the review prompt invokes gh for issue refs. Enforces the no-GitHub-access contract at the env level rather than relying on Codex's sandbox. Second finding from local-review self-review. * test(local-review): cover offline metadata contract; export commitMetadata Hermetic test proves commitMetadata(..., offline=true) reads only local git and never calls gh (uses an unsupported repo slug, so a gh call would fail). Exports commitMetadata for the test. * test(local-review): add CLI guard-path coverage Covers localReviewCommand's exit paths without invoking codex: dirty-tree refusal, unsupported-repo rejection, and no-commits-beyond-base. Closes the coverage gap noted in the PR. * docs(commit-sweeper): document the local-review offline branch lane Replaces the 'branch review out of scope' note with a section describing the local-review subcommand and its no-GitHub-access credential boundary. Addresses the P3 review finding on #298. * fix(local-review): add runnable local-review entrypoint Adds a 'local-review' package script (node dist/commit-sweeper.js local-review) and updates the docs to invoke it via pnpm, so the documented command is backed by a real entrypoint. Addresses the P1 doc/entrypoint mismatch on #298. * fix(local-review): scrub GITHUB_ENTERPRISE_TOKEN alias gh honors both GH_ENTERPRISE_TOKEN and GITHUB_ENTERPRISE_TOKEN; the offline scrub list omitted the latter, so an Enterprise credential could reach the spawned reviewer. Extracts the scrub list to an exported const, adds the alias, and adds a regression test. Addresses the P1 finding on #298. * fix(local-review): disable network lookups * fix(local-review): require configured profiles --------- Co-authored-by: Peter Steinberger <[email protected]>
…weeper (openclaw#298) * feat: add local-review command for offline branch review Reviews the committed range merge-base(base,HEAD)..HEAD as one unit via the Commit Sweeper engine (runCodexProcess). Conforms to the openclaw#253 replacement spec: clean checkout required, unique per-run output dir, withholds all GitHub tokens, rejects unsupported repos (no foreign-profile fallback). Built fresh off main on the current codex infrastructure. * fix(local-review): skip gh-api metadata in offline mode commitMetadata takes an offline flag that skips the gh api author/committer lookups; local-review passes it. gh ignores token env vars, so not running gh at all is the only way to honor the no-GitHub-access contract. Found by local-review self-reviewing this branch. * fix(local-review): isolate gh config in offline mode Point GH_CONFIG_DIR at an empty dir so the spawned reviewer cannot use cached gh auth even if the review prompt invokes gh for issue refs. Enforces the no-GitHub-access contract at the env level rather than relying on Codex's sandbox. Second finding from local-review self-review. * test(local-review): cover offline metadata contract; export commitMetadata Hermetic test proves commitMetadata(..., offline=true) reads only local git and never calls gh (uses an unsupported repo slug, so a gh call would fail). Exports commitMetadata for the test. * test(local-review): add CLI guard-path coverage Covers localReviewCommand's exit paths without invoking codex: dirty-tree refusal, unsupported-repo rejection, and no-commits-beyond-base. Closes the coverage gap noted in the PR. * docs(commit-sweeper): document the local-review offline branch lane Replaces the 'branch review out of scope' note with a section describing the local-review subcommand and its no-GitHub-access credential boundary. Addresses the P3 review finding on openclaw#298. * fix(local-review): add runnable local-review entrypoint Adds a 'local-review' package script (node dist/commit-sweeper.js local-review) and updates the docs to invoke it via pnpm, so the documented command is backed by a real entrypoint. Addresses the P1 doc/entrypoint mismatch on openclaw#298. * fix(local-review): scrub GITHUB_ENTERPRISE_TOKEN alias gh honors both GH_ENTERPRISE_TOKEN and GITHUB_ENTERPRISE_TOKEN; the offline scrub list omitted the latter, so an Enterprise credential could reach the spawned reviewer. Extracts the scrub list to an exported const, adds the alias, and adds a regression test. Addresses the P1 finding on openclaw#298. * fix(local-review): disable network lookups * fix(local-review): require configured profiles --------- Co-authored-by: Peter Steinberger <[email protected]>
Summary
Adds a
local-reviewcommand that reviews a local git branch without needing a GitHub PR. This enables pre-push code review: stage changes on a branch, runlocal-review, fix findings, then push and create the PR.Self-contained: includes all prerequisites for local runs (CODEX_BIN, shell: win32, CLAWSWEEPER_CODEX_LOGIN_METHOD) applied to all 4 Codex subprocess launchers.
How it works
The existing
reviewcommand fetches PR metadata from GitHub (fetchItem,collectItemContext) and runs Codex against the checkout.local-reviewconstructs the sameItemandItemContextfrom local git state:git remote, title from commit message, author fromgit configgit diff <base>...HEAD, changed files fromgit diff --name-only, commits fromgit log--pr-body-fileflag or commit message bodyrunCodex()call with the same prompt, schema, and decision outputNo GitHub API calls are made. The decision is written to
~/.clawsweeper-local-reviews/local-review.jsonand printed to stdout.Prerequisites included
This PR subsumes the changes from #250 (Windows spawn fix) and #251 (OAuth login method):
CODEX_BINenv var for Windows.cmdwrapper compatibilityshell: trueon win32 for all CodexspawnSynccallsCLAWSWEEPER_CODEX_LOGIN_METHODenv var for ChatGPT Pro OAuth login (centralized incodex-env.tswith validation)clawsweeper.ts(review + assist),commit-sweeper.ts,pr-close-coverage-proof.tsMerge order: if this lands first, close #250 and #251 as superseded. If either lands first, this PR needs a trivial rebase (identical changes on the same lines).
Usage
After-fix proof
Successfully reviewed the crabbox bootstrap-mount fix (openclaw/crabbox#204) locally before the GitHub PR existed:
Then self-reviewed this PR's own diff (meta!), which found and fixed a
--pr-body-filesilent-fallback bug.Changes
src/clawsweeper.ts: ~100 lines -localReviewCommand()function + command dispatch entrysrc/codex-env.ts:resolveCodexLoginMethod()+codexLoginMethodConfig()with validationsrc/commit-sweeper.ts: CODEX_BIN + shell + login methodsrc/pr-close-coverage-proof.ts: CODEX_BIN + shell + login method--target-dir,--repo,--base,--pr-body-file,--output-dir, plus all existing--codex-*flagsTest plan
pnpm buildcompiles cleanresolveCodexLoginMethodtests: default api, chatgpt override, invalid rejectioncodexLoginMethodConfigtest: valid TOML config stringrunCodexForTest