Skip to content

feat(review): add offline local-range review - #408

Merged
steipete merged 1 commit into
mainfrom
fix/pr-369-local-range-review
Jul 4, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/pr-369-local-range-review

Conversation

@steipete

@steipete steipete commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Supersedes #369 after the contributor fork rejected the maintainer rewrite. This keeps Cameron's implementation and co-author credit, rebased and hardened against current main.

What changed

  • Adds review --local-range for a full proof-aware review of merge-base(<base>, HEAD)..HEAD before a PR exists.
  • Defaults to the checkout where the command is invoked; --target-dir remains available.
  • Requires a clean committed range and rejects incompatible item-number flags.
  • Withholds GitHub credentials, isolates cached gh auth, disables web search, and skips host URL/media preprocessing. The Codex model call is still networked, so this is not described as air-gapped.
  • Stores default run artifacts under .git/clawsweeper/reviews/local-range-<time>-<pid>/, keeping the target worktree clean.
  • Documents --body-file, --additional-policy, and the local-range workflow.

Proof

Exact head: 314f66448ece66d86f9ebea5f8185fdc7912c8db

  • pnpm run check: 614 unit tests and 617 repair tests passed.
  • Changed coverage: 100% lines, 89.17% branches, 100% functions.
  • Overall coverage: 76.84% lines, 70.82% branches, 84.13% functions.
  • Focused local-range suite: 10/10 passed, including current-checkout default, git-private artifacts, empty gh config, and clean worktree preservation.
  • Real run: node dist/clawsweeper.js review --local-range --base origin/main --target-repo openclaw/clawsweeper --codex-reasoning-effort low
    • selected and reviewed one synthetic local item
    • completed with high-confidence keep_open
    • report: .git/clawsweeper/reviews/local-range-1783175454520-11161/0.md
    • checkout remained clean
  • AutoReview: no actionable findings on the maintainer delta (0.79) or full branch (0.84).
  • Formatting and skill frontmatter validation passed.

Original implementation by @anagnorisis2peripeteia.

Rewritten onto current main with safe current-checkout defaults, git-private artifacts, and focused regression coverage.

Co-authored-by: Cameron Beeley <[email protected]>

steipete commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Please review exact head 314f66448ece66d86f9ebea5f8185fdc7912c8db. The PR body now includes the full local and real-run proof.

@clawsweeper

clawsweeper Bot commented Jul 4, 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 Jul 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 4, 2026, 10:43 AM ET / 14:43 UTC.

Summary
The branch adds review --local-range plus supporting local review flags, shared offline-review guardrails, documentation, skill guidance, and focused regression tests.

Reproducibility: not applicable. this is a feature PR, not a bug report. The relevant verification is the PR body's local CLI proof and the added regression tests rather than a current-main failure reproduction.

Review metrics: 3 noteworthy metrics.

  • Changed Surface: 6 files changed, +697/-31. The PR touches the main review command, shared Commit Sweeper helpers, docs/skill guidance, and a new focused test file.
  • Local-Range Tests: 10 new test cases. The tests cover the highest-risk behaviors for this feature: synthetic context, dirty-tree refusal, rename handling, flag conflicts, artifact isolation, and skipped media downloads.
  • Sensitive Boundaries: 3 merge-risk areas. Automation behavior, security boundary, and auth/provider handling all change in ways that green unit tests do not fully settle.

Root-cause cluster
Relationship: canonical
Canonical: #408
Summary: This PR is the writable replacement and canonical landing candidate for the full proof-aware local-range review work that began in the now-closed predecessor PR.

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] The no-GitHub-input boundary is security-sensitive: the implementation relies on token scrubbing, isolated GH_CONFIG_DIR, disabled web search, skipped host media preprocessing, read-only sandboxing, and prompt compliance while still invoking the networked Codex service.
  • [P1] The PR changes core review-command selection, synthetic PR context generation, artifact layout, and Codex invocation config, so review automation behavior should get maintainer signoff before landing.
  • [P1] The branch intentionally changes local Codex auth preservation while hiding GitHub credentials from spawned review engines; that auth boundary is correct-looking but still merge-sensitive.

Maintainer options:

  1. Accept The Documented Local Boundary (recommended)
    Maintainers can land the PR after owning that --local-range is a no-GitHub-input path, not a fully air-gapped model execution path.
  2. Ask For More Boundary Proof
    If maintainers want extra assurance, request one additional redacted run that captures Codex config, token absence, isolated GH_CONFIG_DIR, and no host media preprocessing on the final merge head.
  3. Defer The Core CLI Surface
    If full proof-aware pre-submission review is not wanted in core yet, close or pause this and keep the existing Commit Sweeper local-review path as the supported pre-PR lane.

Next step before merge

  • [P2] No narrow automated repair is indicated; maintainers should decide whether to accept the new local review CLI/auth boundary before merge.

Security
Cleared: No concrete security or supply-chain defect was found in the diff; the credential/offline boundary remains a maintainer merge-risk decision.

Review details

Best possible solution:

Land this maintained replacement if maintainers accept the documented local review/auth boundary, keeping the shared Commit Sweeper guardrails and focused regression coverage intact.

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

Not applicable: this is a feature PR, not a bug report. The relevant verification is the PR body's local CLI proof and the added regression tests rather than a current-main failure reproduction.

Is this the best way to solve the issue?

Yes for the implementation shape: it extends the existing full review path and reuses the Commit Sweeper offline guardrails instead of creating a separate reviewer. Product acceptance of the new CLI/auth surface still belongs to maintainers.

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add P2: This is a normal-priority feature for local review ergonomics with bounded but meaningful review-automation impact.
  • add merge-risk: 🚨 auth-provider: The PR intentionally changes when local Codex auth is preserved and when GitHub credentials are scrubbed from spawned review engines.
  • add merge-risk: 🚨 security-boundary: The PR defines the local no-GitHub-input boundary around credentials, cached gh auth, web search, and URL/media preprocessing.
  • add merge-risk: 🚨 automation: The PR changes review command selection, synthetic item/context generation, artifact paths, media preprocessing, and Codex invocation config.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix terminal proof for the final head showing a real local-range review run, token absence, isolated GH_CONFIG_DIR, disabled web search, and a clean checkout afterward.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add feature: ✨ showcase: ClawSweeper spotlight: unusually compelling feature idea for maintainer attention. Full proof-aware pre-submission review is a notable contributor workflow unlock because it lets branch authors exercise the same PR review policy before opening a PR.

Label justifications:

  • P2: This is a normal-priority feature for local review ergonomics with bounded but meaningful review-automation impact.
  • merge-risk: 🚨 automation: The PR changes review command selection, synthetic item/context generation, artifact paths, media preprocessing, and Codex invocation config.
  • merge-risk: 🚨 security-boundary: The PR defines the local no-GitHub-input boundary around credentials, cached gh auth, web search, and URL/media preprocessing.
  • merge-risk: 🚨 auth-provider: The PR intentionally changes when local Codex auth is preserved and when GitHub credentials are scrubbed 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 is a notable contributor workflow unlock because it lets branch authors exercise the same PR review policy before opening a PR.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix terminal proof for the final head showing a real local-range review run, token absence, isolated GH_CONFIG_DIR, disabled web search, and a clean checkout afterward.
Evidence reviewed

What I checked:

  • AGENTS policy read: The repository AGENTS.md was read in full and its read-only, conservative-review guidance was applied to this review. (AGENTS.md:1, b81ec9657604)
  • Current main lacks local-range review: A source search on current main found no local-range implementation or docs in the review command path; only unrelated repair plumbing mentions --body-file. (src/clawsweeper.ts:16631, b81ec9657604)
  • Current local-only baseline: Current main documents review --local-only for existing GitHub items and a separate Commit Sweeper local-review code-only lane, so the full proof-aware pre-PR range review remains a distinct feature. (README.md:586, b81ec9657604)
  • PR implementation evidence: The PR patch synthesizes an item/context from merge-base(<base>, HEAD)..HEAD, defaults the target checkout for --local-range, rejects incompatible item-number flags, skips media preprocessing, and passes disabled web-search config to Codex. (src/clawsweeper.ts:16660, 314f66448ece)
  • Shared offline guardrails: The PR extracts dirty-tree checking, GitHub credential scrubbing, GH_CONFIG_DIR isolation, and the disabled web-search config from Commit Sweeper for reuse by local-range review. (src/commit-sweeper.ts:414, 314f66448ece)
  • Focused regression coverage: The new test file covers synthetic local item/context generation, base fallback, dirty-tree refusal, empty-range handling, rename parsing, flag conflicts, default git-private artifacts, and skipped host media downloads. (test/local-range-review.test.ts:1, 314f66448ece)

Likely related people:

  • brokemac79: Introduced the current review --local-only issue/PR review workflow that this PR extends into a pre-submission local range mode. (role: feature-history owner; confidence: high; commits: 79e768844291; files: src/clawsweeper.ts, README.md, .agents/skills/local-clawsweeper-review/SKILL.md)
  • Vincent Koc: Current blame on the Commit Sweeper local-review credential guardrail constants and prompt traces to the imported baseline commit, and this PR extracts that surface for reuse. (role: adjacent offline-review contributor; confidence: medium; commits: babd6a435afb; files: src/commit-sweeper.ts, docs/commit-sweeper.md)
  • Peter Steinberger: Recent current-main commits touch ClawSweeper automation and review/apply behavior in adjacent code paths, making this person a likely routing candidate beyond only authoring this PR. (role: recent area contributor; confidence: medium; commits: a52b852c3fc2, b81ec9657604; 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 314f66448e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/clawsweeper.ts
stringArg(args.target_dir, stringArg(args.openclaw_dir, `../${profile.checkoutDir}`)),
stringArg(
args.target_dir,
stringArg(args.openclaw_dir, localRange ? process.cwd() : `../${profile.checkoutDir}`),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Normalize local-range cwd to the repo root

When --local-range is launched from a subdirectory and no --target-dir is supplied, this makes the Codex checkout that subdirectory. Git still reports range paths relative to the repository root from a subdir (for example other/file), so those paths are nonexistent relative to -C <subdir> and the reviewer cannot reliably inspect files outside the current folder. Please resolve the default local-range target to git rev-parse --show-toplevel before building the review.

Useful? React with 👍 / 👎.

Comment thread src/clawsweeper.ts
cwd: targetDir,
}).trim();
const pullFiles = nameStatus
? nameStatus.split("\n").map((line) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Bound local-range pull-file hydration

This maps every file in the local range and embeds up to 8 KB of patch per file with no cap or pullFilesTruncated marker. On branches with hundreds of changed files, generated outputs, or lockfile/vendor churn, the synthesized context can become multi-MB before Codex starts and fail on prompt size or timeout instead of producing an advisory report. Please hydrate a bounded window like the live PR path and record truncation in counts.

Useful? React with 👍 / 👎.

steipete commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

Maintainer decision: accept the documented local boundary. --local-range is a no-GitHub-input review path, not an air-gapped model execution path. The exact-head proof, credential/config isolation, clean-worktree behavior, and review coverage are sufficient to land once CI is green.

@steipete
steipete merged commit 5565262 into main Jul 4, 2026
9 checks passed
@steipete
steipete deleted the fix/pr-369-local-range-review branch July 4, 2026 14:49
@anagnorisis2peripeteia

Copy link
Copy Markdown
Contributor

Thanks, apologies about the maintainer edit being blocked on that PR. Blame the clanker!

azaj01 pushed a commit to azaj01/clawsweeper that referenced this pull request Sep 21, 2026
Add full proof-aware review for a clean committed range before a pull request exists. Reuse the local review credential and network guardrails, default to the invoking checkout, keep artifacts inside git metadata, and document/test the boundary.

Co-authored-by: Cameron Beeley <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants