Skip to content

feat(review): offline --local-range mode for pre-submission review (#357 follow-on) - #369

Closed
anagnorisis2peripeteia wants to merge 8 commits into
openclaw:mainfrom
anagnorisis2peripeteia:feat/offline-local-review
Closed

anagnorisis2peripeteia wants to merge 8 commits into
openclaw:mainfrom
anagnorisis2peripeteia:feat/offline-local-review

Conversation

@anagnorisis2peripeteia

@anagnorisis2peripeteia anagnorisis2peripeteia commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

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. So
you 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 + ItemContext are
synthesized from git (diff from git 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 gitInfo path 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:

  • the clean-checkout contract (dirtyWorktree — rejects a dirty tree; the committed-range
    review can't see staged/untracked work);
  • token scrubbing (scrubGitHubCredentialEnv) + an empty GH_CONFIG_DIR
    (isolateGitHubConfigDir) so gh's own cached auth is unreachable — token deletion alone
    can'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-range implies --local-only, so it takes the local Codex-auth / Windows-launcher
    path even when run standalone.

dirtyWorktree, scrubGitHubCredentialEnv, and isolateGitHubConfigDir are 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 / Mantis
    decision 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>, default origin/main): buildLocalRangeReview()
    builds a synthetic Item + ItemContext (pullFiles from git diff, body from the commit
    message) and reviewCommand branches the offline gitInfo ({ 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.
  • feat(local-review): offline committed-range branch review on Commit Sweeper #298 reuse (full offline envelope): clean-checkout guard (dirtyWorktree),
    scrubGitHubCredentialEnv, empty GH_CONFIG_DIR (isolateGitHubConfigDir), the no-GitHub-access
    prompt, web_search="disabled", and commitMetadata(offline=true) — helpers extracted into
    commit-sweeper.ts and shared. --local-range implies --local-only (local Codex-auth path).
  • rename/copy diffs: the --name-status parser takes the last tab-field as the path, so
    renamed/copied files review the new path instead of an empty patch.
  • synthetic item is authorAssociation: "CONTRIBUTOR" (pre-submission contributor PR, not OWNER).
  • --allow-closed: relaxes the open-only selection gate in selectCandidates.
  • --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 check passed on final-head 8bc4e93425 after refreshing dependencies from current origin/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's local-review tests unaffected by the shared-helper extraction.
  • test/local-range-review.test.ts (9 cases): the synthesized item/context/diff, the
    title + origin/main-base fallbacks, the empty-diff case, rename/copy parsing, the
    dirty-tree refusal, the empty-range throw, the --item-number/--item-numbers conflict,
    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).
  • Offline envelope verified by live runs: --local-range with bogus GH_TOKEN/GITHUB_TOKEN
    set built the review from git diff (no GitHub API call), scrubbed the tokens, and pointed
    GH_CONFIG_DIR at an empty dir before spawning the engine — i.e. no GitHub read path. The
    latest 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

  • Advisory/offline only: --local-range implies no GitHub writes (no start comment, no posted
    review) and no GitHub reads (credentials scrubbed, web search off).
  • --local-range reviews committed work — it requires a clean checkout (commit or stash first).
  • Engine selection is intentionally out of scope for this PR.

Evidence — final-head real-behavior proof: no GitHub PR/API path

--local-range reviews the local git range before a PR exists: the item/diff/body are synthesized from local git, GitHub credentials are withheld, gh is 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 on ae63b16d6c7483773359acebfa114792a84ed5a4, with bogus GitHub tokens in the parent shell and a wrapper around the real Codex binary:

$ GH_TOKEN=ghp_REDACTED GITHUB_TOKEN=ghp_REDACTED \
    CLAWSWEEPER_CODEX_REVIEW_ATTEMPTS=1 \
    CLAWSWEEPER_PROOF_WRAPPER_DIR=/private/tmp/oflr-proof-proof/wrapper-8bc4e93425 \
    CLAWSWEEPER_REAL_CODEX=/opt/homebrew/bin/codex \
    CODEX_BIN=/private/tmp/oflr-proof-proof/codex-wrapper.cjs \
    node dist/clawsweeper.js review \
      --local-only --local-range \
      --base origin/main \
      --target-repo openclaw/clawsweeper \
      --target-dir . \
      --artifact-dir /private/tmp/oflr-proof-proof/artifacts-8bc4e93425 \
      --codex-reasoning-effort low \
      --codex-timeout-ms 600000
[review] 2026-06-28T09:33:04.388Z shard=0/1 selected=1 scanned_pages=0
[review] 2026-06-28T09:33:04.392Z shard=0/1 start #0 (1/1)
[review] 2026-06-28T09:33:04.393Z shard=0/1 start-comment=skipped #0
[review] 2026-06-28T09:34:29.488Z shard=0/1 done #0 (1/1) decision=keep_open confidence=medium action=kept_open
[review] 2026-06-28T09:34:29.488Z shard=0/1 complete reviewed=1

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:

  • Wrapper exit status 0, signal null, stderr bytes 0; ClawSweeper produced decision=keep_open / confidence=medium for synthetic item #0.
  • Engine config included approval_policy="never" and web_search="disabled"; sandbox was read-only.
  • The wrapper saw all GitHub token env vars absent inside Codex, including GH_TOKEN, GITHUB_TOKEN, enterprise tokens, COMMIT_SWEEPER_TARGET_GH_TOKEN, and CLAWSWEEPER_PROOF_INSPECTION_TOKEN.
  • GH_CONFIG_DIR was an isolated empty cs-gh-empty-* directory, so cached gh auth was not reachable.
  • Captured Codex JSONL had only read-only local inspection commands (pwd/rg, git status/git diff/git diff --name-only, sed AGENTS.md, file-specific git diff). The parsed command stream matched no gh, curl, wget, ffprobe, ffmpeg, or http(s):// command pattern, and there were no web-search/fetch/browser events.
  • Host-side media preprocessing is also bypassed for --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 (0 bytes)

Also guards --item-number/--item-numbers against --local-range (a GitHub-item number is meaningless when the item is synthesized from local git).

@anagnorisis2peripeteia

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper

clawsweeper Bot commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 1, 2026, 7:09 PM ET / 23:09 UTC.

Summary
The PR adds review --local-range, --allow-closed, --body-file, --additional-policy, shared offline-review credential guardrails, and focused local-range regression tests.

Reproducibility: not applicable. this is a feature PR, not a bug report. The PR body provides terminal/log proof for the new CLI path rather than a current-main failure reproduction.

Review metrics: 3 noteworthy metrics.

  • Changed Surface: 3 files; 551 additions, 21 deletions. The implementation is concentrated in the review command, shared local-review helpers, and one new regression test file.
  • Local-Range Coverage: 9 test cases added. The tests cover the highest-risk local-range behaviors: synthetic context, rename parsing, dirty-tree refusal, flag conflicts, and skipped media downloads.
  • Mergeability: GitHub reports CONFLICTING/DIRTY. The branch needs a rebase or conflict resolution before maintainers can land it.

Root-cause cluster
Relationship: canonical
Canonical: #369
Summary: This PR is the canonical open item for the full proof-aware local-range review feature; the related merged PRs are foundations or partial overlaps, not replacements.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🦞 diamond lobster
Proof: 🦞 diamond lobster
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Risk before merge

  • [P1] GitHub reports the branch as CONFLICTING/DIRTY against current main, so maintainers need a rebase or conflict resolution before merge.
  • [P1] The no-GitHub-access boundary is not total network isolation: it relies on token scrubbing, an empty GH_CONFIG_DIR, disabled web search, skipped host media preprocessing, read-only sandboxing, and prompt compliance while still invoking Codex.
  • [P1] The PR adds local operator-supplied review inputs through --body-file and --additional-policy, so maintainers need to accept that support and policy surface before landing it.

Maintainer options:

  1. Rebase Before Acceptance (recommended)
    Resolve the current conflicts against main, then have a maintainer review the CLI/auth boundary on the rebased head before merge.
  2. Accept The Local Boundary
    Maintainers can intentionally accept that this is a no-GitHub-input path rather than a fully air-gapped review engine.
  3. Defer Core CLI Surface
    If full proof-aware pre-submission review is not wanted in core yet, pause or close this PR and keep the existing Commit Sweeper/local-only paths as the supported options.

Next step before merge

  • [P2] Human review is needed for the new CLI/auth boundary and current merge conflict; no narrow automated repair should decide the product surface.

Security
Cleared: No concrete security or supply-chain defect was found in the diff, though the auth and offline boundary remains a maintainer merge-risk decision.

Review details

Best possible solution:

Rebase the branch, then land it only if maintainers explicitly want full proof-aware pre-submission review in core with the documented offline boundary and shared Commit Sweeper guardrails preserved.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this is a feature PR, not a bug report. The PR body provides terminal/log proof for the new CLI path rather than a current-main failure reproduction.

Is this the best way to solve the issue?

Unclear: the implementation shape is narrow and reuses the existing offline-review guardrails, but the core CLI surface and auth boundary still need maintainer product approval.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 0c85aae0ecbc.

Label changes

Label justifications:

  • P2: This is a normal-priority feature to improve local review ergonomics with meaningful but bounded review-automation impact.
  • merge-risk: 🚨 automation: The PR changes the core review command, item/context synthesis, artifact paths, media proof preprocessing, and Codex invocation config.
  • merge-risk: 🚨 security-boundary: The PR defines a no-GitHub-access local review boundary around credentials, cached gh auth, web search, and URL preprocessing.
  • merge-risk: 🚨 auth-provider: The PR intentionally changes when local Codex auth is preserved and when GitHub credentials are scrubbed or hidden from spawned review engines.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • feature: ✨ showcase: ClawSweeper spotlight: unusually compelling feature idea for maintainer attention. Full proof-aware pre-submission review would let contributors exercise ClawSweeper's real PR review policy before opening a PR, which is a notable workflow unlock.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes final-head terminal and wrapper-captured proof showing the local-range review path with GitHub tokens absent, isolated GH_CONFIG_DIR, disabled web search, and skipped host media preprocessing.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes final-head terminal and wrapper-captured proof showing the local-range review path with GitHub tokens absent, isolated GH_CONFIG_DIR, disabled web search, and skipped host media preprocessing.
Evidence reviewed

What I checked:

  • Current main lacks local-range: Current main documents and implements review --local-only, but a focused search found no local-range implementation or docs, so the central feature is not already implemented on main. (README.md:577, 0c85aae0ecbc)
  • Local-only review baseline: The existing review command on main only derives localOnly from --local-only and still selects GitHub items through the normal exact-item path. (src/clawsweeper.ts:16369, 0c85aae0ecbc)
  • PR local-range implementation: The PR synthesizes a local PR item/context from git merge-base and git diff, rejects dirty worktrees, handles rename/copy name-status rows by using the final tab field, and marks the synthetic author association as CONTRIBUTOR. (src/clawsweeper.ts:16340, 8bc4e934256c)
  • Offline guardrail reuse: The PR extracts and reuses shared helpers for dirty-tree checks, GitHub token scrubbing, GH_CONFIG_DIR isolation, and disabled web search across local review paths. (src/commit-sweeper.ts:417, 8bc4e934256c)
  • Regression coverage: The new test file covers synthetic item/context generation, rename handling, dirty-tree refusal, empty ranges, flag conflicts, and skipping host-side media URL downloads for local-range reviews. (test/local-range-review.test.ts:27, 8bc4e934256c)
  • Real behavior proof: The PR body includes final-head terminal output and wrapper-captured invocation details showing tokens absent, isolated GH_CONFIG_DIR, disabled web search, read-only sandbox, and no host media preprocessing requests. (8bc4e934256c)

Likely related people:

  • brokemac79: Merged Add local-only issue and PR review mode #357, which added the current review --local-only workflow that this PR extends. (role: introduced local-only review surface; confidence: high; commits: 79e768844291; files: src/clawsweeper.ts, README.md, .agents/skills/local-clawsweeper-review/SKILL.md)
  • anagnorisis2peripeteia: Merged feat(local-review): offline committed-range branch review on Commit Sweeper #298, which introduced the Commit Sweeper offline committed-range review path and guardrails reused by this PR. (role: prior offline review contributor; confidence: high; commits: d877d4e7e095; files: src/commit-sweeper.ts, test/local-review.test.ts, docs/commit-sweeper.md)
  • Vincent Koc: Current blame around the core review command and exact admission flow traces to the durable exact queue work, making this a plausible routing point for review-lane changes. (role: adjacent review-lane contributor; confidence: medium; commits: ac8f2c5e61c2; files: src/clawsweeper.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 auth-provider 🚨 Merging this PR could break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. labels Jun 25, 2026
@anagnorisis2peripeteia
anagnorisis2peripeteia marked this pull request as draft June 25, 2026 02:50
@anagnorisis2peripeteia

Copy link
Copy Markdown
Contributor Author

Reworked to address the review — pushed 3eae0ed.

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 (review-item.md + decision schema, real-behavior-proof + Mantis), which the code-only path doesn't cover.

It no longer parallels #298's offline path — it now reuses it:

dirtyWorktree and scrubGitHubCredentialEnv are extracted from #298's localReviewCommand (behavior there unchanged) and shared between the two offline paths, so this builds on #298 rather than paralleling it.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

anagnorisis2peripeteia added a commit to anagnorisis2peripeteia/clawsweeper that referenced this pull request Jun 25, 2026
…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.
@anagnorisis2peripeteia

Copy link
Copy Markdown
Contributor Author

Addressed all four findings — pushed 0ccce350.

  • [P1 security] gh config isolation: --local-range now reuses feat(local-review): offline committed-range branch review on Commit Sweeper #298's full offline envelope — an empty GH_CONFIG_DIR (isolateGitHubConfigDir, extracted from localReviewCommand) so gh's cached auth is unreachable, plus the no-network local-review prompt — not just token scrubbing.
  • [P1] local Codex auth: --local-range now implies --local-only, so a standalone run takes the local Codex-auth / Windows-launcher path.
  • [P2] rename/copy diffs: the name-status parser takes the last tab-field as the path, so R100<tab>old<tab>new rows review the new path instead of an empty patch (new test covers it).
  • [P2] author association: the synthetic item is CONTRIBUTOR, not OWNER, so the proof gate exercises the real pre-submission path.

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 git diff with bogus GH_TOKEN/GITHUB_TOKEN scrubbed and GH_CONFIG_DIR isolated — no GitHub API call) and by the test suite.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@anagnorisis2peripeteia

Copy link
Copy Markdown
Contributor Author

Addressed the P2 (unique output paths) — pushed 514c25eb.

--local-range reviews are synthesized as item #0, so their item-numbered artifacts (0.md, codex/0.json, proof-scratch/0, logs) could overwrite each other across repeated/concurrent pre-PR runs under one default dir. The default artifact dir is now per-run (local-range-<ts>-<pid>, mirroring #298's run-<id> identity); an explicit --artifact-dir is still honored as-is.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@anagnorisis2peripeteia

Copy link
Copy Markdown
Contributor Author

@brokemac79

@anagnorisis2peripeteia

Copy link
Copy Markdown
Contributor Author

Added the real-behavior proof for offline --local-range to the PR body (final-head 514c25eb): ran the review with bogus GH_TOKEN/GITHUB_TOKEN and the normal gh login present — it produced a valid Decision with tokens scrubbed, an empty GH_CONFIG_DIR (no cached gh auth), web search disabled, the diff read from git (synthetic-local item, no pulls/<n> fetch), and zero network actions by the engine.

@clawsweeper re-review

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jun 26, 2026
@anagnorisis2peripeteia

Copy link
Copy Markdown
Contributor Author

Addressed the findings — pushed 331628dd.

On the "offline boundary / no network" P1s: the framing was the issue, and I've narrowed it in the body. --local-range is about reviewing before a PR exists — it synthesizes the item/diff from local git with GitHub credentials/access withheld (the #298 envelope), so it never reaches the real PR/repo. It is not air-gapped — codex itself is a network call. So "the offline boundary is incomplete because media-proof can curl a URL" rests on a zero-network claim the PR never actually makes; the Evidence section now states the real guarantee (no GitHub PR fetch + creds withheld), not "no network." Running the review model locally too — true total-offline — is a deliberate follow-up on the local-inference path.

The genuine flag-conflict is fixed: --item-number / --item-numbers are now rejected with --local-range (a GitHub-item number is meaningless when the item is synthesized from local git, and could otherwise route into a managed checkout) — with a CLI test.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@anagnorisis2peripeteia

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jun 27, 2026
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.
@anagnorisis2peripeteia

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. feature: ✨ showcase ClawSweeper spotlight: unusually compelling feature idea for maintainer attention. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jun 28, 2026
@anagnorisis2peripeteia
anagnorisis2peripeteia marked this pull request as ready for review June 28, 2026 11:42
@steipete steipete self-assigned this Jul 4, 2026

steipete commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Thank you, @anagnorisis2peripeteia — the local-range design is valuable and your implementation is the basis of the landed candidate.

I rebased and hardened it against current main, but GitHub rejected the maintainer update to this fork branch because the OAuth path cannot update workflow-bearing history. The identical reviewed final tree is now in #408 at 314f66448ece66d86f9ebea5f8185fdc7912c8db, with your authorship preserved via Co-authored-by.

Closing this proposal in favor of #408 so CI and landing can continue on the writable branch.

@steipete steipete closed this Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: ✨ showcase ClawSweeper spotlight: unusually compelling feature idea for maintainer attention. merge-risk: 🚨 auth-provider 🚨 Merging this PR could break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants