feat(review): offline --local-range mode for pre-submission review (#357 follow-on)#369
Conversation
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Codex review: needs maintainer review before merge. Reviewed June 28, 2026, 7:46 AM ET / 11:46 UTC. Summary Reproducibility: not applicable. this is a feature PR rather than a current-main bug report. The verification path is source inspection, the added local-range tests, and the final-head terminal proof in the PR body. Review metrics: 3 noteworthy metrics.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the local-range full-review mode after maintainers accept the new CLI surface and preserve the shared offline guardrails plus regression tests. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a feature PR rather than a current-main bug report. The verification path is source inspection, the added local-range tests, and the final-head terminal proof in the PR body. Is this the best way to solve the issue? Yes at the implementation level: reusing the existing full review path and shared Commit Sweeper offline guardrails is narrow and maintainable. The remaining question is maintainer acceptance of the new CLI and auth-boundary product surface. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ae63b16d6c74. Label changesLabel 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
|
|
Reworked to address the review — pushed To clarify the relationship: this is the #357 full proof-aware review made to run offline, not a duplicate of #298. #298 added offline committed-range review on Commit Sweeper — the code-only lane; this is its full-review counterpart ( It no longer parallels #298's offline path — it now reuses it:
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
…rename parsing Re-review of openclaw#369 found four issues; all fixed: - [P1 security] --local-range now reuses openclaw#298's FULL offline envelope, not just token scrubbing: an empty GH_CONFIG_DIR (isolateGitHubConfigDir) so gh's own cached auth is unreachable, plus the no-network localReviewAdditionalPrompt. - [P1] --local-range implies --local-only, so a standalone run takes the local Codex auth / Windows-launcher path (was gated on --local-only alone). - [P2] name-status parser takes the LAST tab-field as the path, so rename/copy rows (R100<tab>old<tab>new) review the new path instead of an empty patch. - [P2] synthetic item is authorAssociation CONTRIBUTOR, not OWNER, so the proof gate exercises the real pre-submission path. isolateGitHubConfigDir is extracted from openclaw#298's localReviewCommand (behavior unchanged there) and shared between the offline paths.
|
Addressed all four findings — pushed
On proof: codex is rate-limited right now, so a full final-head Decision capture is pending engine quota. The offline envelope is verified by a live run (built the review from @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Addressed the P2 (unique output paths) — pushed
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Added the real-behavior proof for offline @clawsweeper re-review |
|
Addressed the findings — pushed On the "offline boundary / no network" P1s: the framing was the issue, and I've narrowed it in the body. The genuine flag-conflict is fixed: @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
Add --allow-closed (review closed/merged items: fixtures, hypothetical re-review), --body-file (substitute a hypothetical PR body to exercise the proof/mantis decision, and to feed the body to engines that cannot fetch it live), and --additional-policy (layer a repo-specific policy file). All route through additionalPrompt + the one selection gate, so they apply to every engine uniformly.
Synthesize the Item + ItemContext from the local git range (merge-base(--base, HEAD)..HEAD) so the full review — real-behavior proof and mantis decision — runs BEFORE a PR exists and WITHOUT a GitHub fetch. The diff comes from `git diff`, the body from the commit message (or --body-file), so it works offline and on fork checkouts that the gh-fetch path rejects.
Add buildLocalRangeReviewForTest + a temp-git-repo test asserting the synthetic PR item, the commit-message body, and the git-diff pullFiles are built offline, and that an empty range throws.
Addresses review feedback that the offline --local-range full review paralleled the hardened local-review path (openclaw#298) instead of reusing it. Now --local-range: - enforces openclaw#298's clean-checkout contract (dirtyWorktree guard — rejects a dirty tree; the committed-range review can't see staged/untracked work); - scrubs every GitHub credential from the engine (scrubGitHubCredentialEnv) and disables web search (LOCAL_REVIEW_WEB_SEARCH_CONFIG) — the same offline guarantee; - reuses commitMetadata(offline=true) for author/subject/dates instead of its own git calls. dirtyWorktree + scrubGitHubCredentialEnv are extracted from commit-sweeper.ts's localReviewCommand (behavior unchanged there) and shared. This is the openclaw#357 full proof-aware review made offline — distinct from openclaw#298's commit-sweeper code-only lane, but built on its offline plumbing.
…rename parsing Re-review of openclaw#369 found four issues; all fixed: - [P1 security] --local-range now reuses openclaw#298's FULL offline envelope, not just token scrubbing: an empty GH_CONFIG_DIR (isolateGitHubConfigDir) so gh's own cached auth is unreachable, plus the no-network localReviewAdditionalPrompt. - [P1] --local-range implies --local-only, so a standalone run takes the local Codex auth / Windows-launcher path (was gated on --local-only alone). - [P2] name-status parser takes the LAST tab-field as the path, so rename/copy rows (R100<tab>old<tab>new) review the new path instead of an empty patch. - [P2] synthetic item is authorAssociation CONTRIBUTOR, not OWNER, so the proof gate exercises the real pre-submission path. isolateGitHubConfigDir is extracted from openclaw#298's localReviewCommand (behavior unchanged there) and shared between the offline paths.
…llision) Addresses @clawsweeper P2: every --local-range review is synthesized as item #0, so its item-numbered artifacts (0.md, codex/0.json, proof-scratch/0, logs) under one default dir collide across repeated/concurrent pre-PR runs. The default dir is now per-run (local-range-<ts>-<pid>, mirroring openclaw#298's run identity). An explicit --artifact-dir is still honored as-is.
--local-range synthesizes the review item from the local git range and never fetches a GitHub item, so an item number is meaningless there and could otherwise route into a managed GitHub checkout. Reject the combination with a clear error (+ a CLI test). Addresses the @clawsweeper P2 flag-conflict finding.
b1c45e5 to
8bc4e93
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
Summary
#357 added
review --local-only— the full proof-aware review (review-item.md+decision schema, real-behavior-proof + Mantis assessments) for advisory review before
submitting a PR. But it still requires the item to be open on GitHub: it fetches the
item, diff, body, and comments via the API (
--item-number) and rejects closed items. Soyou can't review your work before opening the PR — which is the stated goal.
This adds
--local-range: run that same full review on the local git range(
merge-base(--base, HEAD)..HEAD) with no GitHub fetch.Item+ItemContextaresynthesized from
git(diff fromgit diff, body from the commit message or--body-file),so the full review — including the real-behavior-proof and Mantis decision — runs offline,
before a PR exists, and on fork checkouts that the gh-fetch
gitInfopath rejects.Relationship to #298 (not a duplicate — its full-review counterpart)
#298 added offline committed-range review on Commit Sweeper — the code-only lane.
This is the full proof-aware counterpart: the same offline committed-range idea, but on
the #357 full-review path (proof + Mantis), which #298's code-only review does not cover. It
deliberately reuses #298's full offline envelope rather than paralleling it:
dirtyWorktree— rejects a dirty tree; the committed-rangereview can't see staged/untracked work);
scrubGitHubCredentialEnv) + an emptyGH_CONFIG_DIR(
isolateGitHubConfigDir) sogh's own cached auth is unreachable — token deletion alonecan't stop it — + the no-GitHub-access local-review prompt + web search disabled: the same
no-GitHub-access guarantee;
commitMetadata(offline=true)for author/subject/dates;--local-rangeimplies--local-only, so it takes the local Codex-auth / Windows-launcherpath even when run standalone.
dirtyWorktree,scrubGitHubCredentialEnv, andisolateGitHubConfigDirare extracted from#298's
localReviewCommand(behavior there unchanged) and shared between the two offline paths.Composing affordances
--allow-closed: review closed/merged items (regression fixtures, hypothetical re-review).--body-file <file>: substitute the PR body in the prompt — to test the proof / Mantisdecision against a hypothetical body, or supply the body when reviewing a local range.
--additional-policy <file>: layer a repo-specific policy file onto the review prompt.Changes
--local-range(with--base <ref>, defaultorigin/main):buildLocalRangeReview()builds a synthetic
Item+ItemContext(pullFilesfromgit diff, body from the commitmessage) and
reviewCommandbranches the offlinegitInfo({ mainSha, latestRelease: null },no fetch), the synthetic candidate, and the synthetic context, suppresses the start comment,
and bypasses host-side media proof preprocessing for the synthetic local item.
dirtyWorktree),scrubGitHubCredentialEnv, emptyGH_CONFIG_DIR(isolateGitHubConfigDir), the no-GitHub-accessprompt,
web_search="disabled", andcommitMetadata(offline=true)— helpers extracted intocommit-sweeper.tsand shared.--local-rangeimplies--local-only(local Codex-auth path).--name-statusparser takes the last tab-field as the path, sorenamed/copied files review the new path instead of an empty patch.
authorAssociation: "CONTRIBUTOR"(pre-submission contributor PR, not OWNER).--allow-closed: relaxes the open-only selection gate inselectCandidates.--body-file: injects an authoritative PR-body section into the review prompt.--additional-policy: reads a policy file and layers it onto the review prompt.Validation
TMPDIR=/private/tmp/oflr-proof-check-tmp pnpm run checkpassed on final-head8bc4e93425after refreshing dependencies from currentorigin/main: unit tests 556 passed, repair tests 569 passed, changed coverage passed, full coverage 1125 passed, and format checked 290 files clean. feat(local-review): offline committed-range branch review on Commit Sweeper #298'slocal-reviewtests unaffected by the shared-helper extraction.test/local-range-review.test.ts(9 cases): the synthesized item/context/diff, thetitle +
origin/main-base fallbacks, the empty-diff case, rename/copy parsing, thedirty-tree refusal, the empty-range throw, the
--item-number/--item-numbersconflict,and the new guard that a body URL is not host-downloaded before the local-range engine run.
Mutation 91.76% on
buildLocalRangeReview(residual survivors equivalent).--local-rangewith bogusGH_TOKEN/GITHUB_TOKENset built the review from
git diff(no GitHub API call), scrubbed the tokens, and pointedGH_CONFIG_DIRat an empty dir before spawning the engine — i.e. no GitHub read path. Thelatest regression also drives the review CLI with a local HTTP video URL in the synthetic body;
fake Codex is reached, and the HTTP server observes zero requests, proving local-range skips
host-side media proof downloads by default.
Scope / notes
--local-rangeimplies no GitHub writes (no start comment, no postedreview) and no GitHub reads (credentials scrubbed, web search off).
--local-rangereviews committed work — it requires a clean checkout (commit or stash first).Evidence — final-head real-behavior proof: no GitHub PR/API path
--local-rangereviews the local git range before a PR exists: the item/diff/body are synthesized from localgit, GitHub credentials are withheld,ghis pointed at an empty config dir, and Codex web search is disabled. This is not air-gapped model inference — the Codex engine call itself is still a network service — but the PR/repository review input path is local/offline.Captured on final-head
8bc4e93425(8bc4e934256c853a3be330979233f2a64b1ad6c7), rebased onae63b16d6c7483773359acebfa114792a84ed5a4, with bogus GitHub tokens in the parent shell and a wrapper around the real Codex binary:Wrapper-captured Codex invocation details:
{ "cwd": "/private/tmp/oflr-proof", "sandbox": "read-only", "configArgs": [ "model_reasoning_effort=\"low\"", "service_tier=\"fast\"", "approval_policy=\"never\"", "web_search=\"disabled\"" ], "env": { "GH_TOKEN": "[ABSENT]", "GITHUB_TOKEN": "[ABSENT]", "GH_ENTERPRISE_TOKEN": "[ABSENT]", "GITHUB_ENTERPRISE_TOKEN": "[ABSENT]", "COMMIT_SWEEPER_TARGET_GH_TOKEN": "[ABSENT]", "CLAWSWEEPER_PROOF_INSPECTION_TOKEN": "[ABSENT]", "GH_CONFIG_DIR": "/var/folders/.../T/cs-gh-empty-Y7iQh8", "OPENAI_API_KEY": "[ABSENT]", "CODEX_API_KEY": "[ABSENT]", "CODEX_ACCESS_TOKEN": "[ABSENT]" } }Codex result/proof artifact checks:
0, signalnull, stderr bytes0; ClawSweeper produceddecision=keep_open/confidence=mediumfor synthetic item#0.approval_policy="never"andweb_search="disabled"; sandbox wasread-only.GH_TOKEN,GITHUB_TOKEN, enterprise tokens,COMMIT_SWEEPER_TARGET_GH_TOKEN, andCLAWSWEEPER_PROOF_INSPECTION_TOKEN.GH_CONFIG_DIRwas an isolated emptycs-gh-empty-*directory, so cachedghauth was not reachable.pwd/rg,git status/git diff/git diff --name-only,sed AGENTS.md, file-specificgit diff). The parsed command stream matched nogh,curl,wget,ffprobe,ffmpeg, orhttp(s)://command pattern, and there were no web-search/fetch/browser events.--local-range: the regression test drives a synthetic body containing a local HTTP video URL, reaches fake Codex, and the HTTP server observes zero requests.The local proof files retained for audit were:
/private/tmp/oflr-proof-proof/terminal-8bc4e93425.log/private/tmp/oflr-proof-proof/wrapper-8bc4e93425/wrapper-invocation.json/private/tmp/oflr-proof-proof/wrapper-8bc4e93425/wrapper-result.json/private/tmp/oflr-proof-proof/artifacts-8bc4e93425/codex/0.json/private/tmp/oflr-proof-proof/artifacts-8bc4e93425/codex/0.1.codex.stdout.log/private/tmp/oflr-proof-proof/artifacts-8bc4e93425/codex/0.1.codex.stderr.log(0bytes)Also guards
--item-number/--item-numbersagainst--local-range(a GitHub-item number is meaningless when the item is synthesized from local git).