Skip to content

refactor: deepen review comment ownership - #1906

Merged
obviyus merged 1 commit into
mainfrom
cleanup/row3-review-comments
Oct 10, 2026
Merged

obviyus merged 1 commit into
mainfrom
cleanup/row3-review-comments

Conversation

@obviyus

@obviyus obviyus commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Current main-based head

Current head: 0fec6ab9a02dff84efc3be4bdcde8b1802ff8a5b. Rebased directly onto origin/main at 0fc6d572bc (the squash merge of #1905), using git rebase --onto origin/main 271e40eec00ed12dc45ee5e91a3ac3a45b84de74. The rebase applied cleanly, carries only this slice's one commit, and adds no adapters.

Current-head validation and real behavior proof

Pueue 1723, bash handoffs/clawsweeper-row3/rebase-main-1906-1907.sh, completed successfully; full output inspected with pueue log 1723 --full:

  • Fresh pnpm run build:all for the immutable baseline and this exact candidate head.
  • 132/132 focused tests passed.
  • pnpm run lint and pnpm run format:check passed.
  • The shipped-CLI comparison driver in slice5-proof/ passed 10/10 identical before/after cases, unchanged fixtures and assertions, against immutable baseline 75d3a7d2a2339171d31ec1f158e9399f673091b7.

Current build manifests, raw outputs, request traces and comparison summary: handoffs/clawsweeper-row3/rebase-main-1906-proof/. The claim, exercised CLI scenarios, normalization and limits are the same as the original proof below; this replay supersedes its candidate SHA. Native macOS arm64 / Node 24.21.0, controlled executable gh / filesystem fixtures (plus loopback HTTP for the comment proof), no live GitHub/Worker mutation. No merge or deployment.

What Problem This Solves

Row 3, slice 5: review-comment ownership currently depends on copies of policy, formatting, state, publication, and lease functions passed through several factories.

Based directly on main; predecessor #1905 is already squash-merged.

User Impact

No intended CLI, comment-byte, schema, or stored-format change. Fresh revision checks, lease election/cleanup, trusted publication receipts, and the existing apply label-batch owner remain intact.

Why This Change Was Made

  • Remove createReviewCommentState, createReviewCommentPublication, createReviewCommentLeases, and the comment dependency contract. Their production operations use ordinary imports.
  • Keep one real I/O seam on the deep comment owner: readLiveReviewRevision: (item: Item) => string. Lease confirmation still performs the fresh read; it does not substitute the caller's snapshot. Slice 7 removes this adapter after context ownership moves.
  • Remove the lease ForTest wrappers and replace submodule/policy substitution with executable-gh, real payload-file, and real lease-exchange behavior tests.
  • Preserve the existing runtime-owned label mutation batch rather than creating another state owner.

Diff against the stack base: 2,246 added / 2,582 removed = 336 net lines removed. git diff -w --stat: 727 added / 1,063 removed, 1,790 changed lines across 12 files. This keeps the complete comment cutover and its behavior-fixture migration together.

OpenClaw Bay Impact

None. This changes internal composition, not Bay data, publication schema, status, or display behavior.

Documentation Impact

Reviewed docs/pr-review-comments.md: its durable receipt, fresh revision, and lease-election contract is unchanged. Added the changelog fragment and updated the Row-3 handoff plan. No docs/proof/** edits. The only forced executable proof migration is scripts/e2e/headless-command-lease.mjs: import the production lease selector directly instead of constructing a fake lease module; its assertions are unchanged.

Original Behavior Proof (historical; current-head replay above)

Claim: the shipped CLI performs the same lease exchange and durable comment publication before and after the ownership cutover.

Environment: native macOS arm64, Node 24.21.0; freshly built CLI copied into isolated roots, executable gh fixture, real payload files, fixed clock/run identity, and a loopback HTTP queue-authority endpoint. No live GitHub/Worker mutation.

Before: 75d3a7d2a2339171d31ec1f158e9399f673091b7 (the same runtime as the repaired stack base; the later base change migrates only test/context.test.ts). After: 99a7697ad9c904323fc141d8114c5e705354573e.

Pueue 1694 passed 10/10 identical before/after comparisons:

Shipped command Scenarios Repositories
reserve-review-lease fresh lease; held lease; lower-server-ID contender and owned loser cleanup; post-publication revision drift and owned cleanup OpenClaw and ClawHub
live-proof-comment --detach durable comment POST followed by PATCH OpenClaw and ClawHub

Compared exit status, CLI output, ordered gh/HTTP calls, raw payload bytes and final comment state. Only random payload filenames are normalized. The drift case requires the fresh revision reread before supersession cleanup. Receipts, raw outputs, build manifests and fixtures are retained in handoffs/clawsweeper-row3/slice5-proof/comparison-3/.

Limits: controlled process/filesystem/HTTP proof, not production permissions, Codex generation, issue hydration, apply/close behavior or real distributed races. Report loading/retention is untouched; the corpus-memory gate is not triggered.

Original Evidence (historical)

  • Pueue 1682: all 144 focused comment/publication/rendering/apply/lease tests passed. Its later lint finding was the now-removed unused runtime link binding.
  • Pueue 1690: final build:all, 8 directly affected post-fix behavior tests, lint, and format:check passed.
  • Pueue 1692: committed-head build:all and 35 context tests passed, including the predecessor's repaired factory caller.
  • Pueue 1693: fresh codex review --base origin/main on the committed head found no actionable regressions. Model-catalog refresh warnings did not prevent completion.
  • No merge, deployment, production mutation, or first-open re-review request.

@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 10, 2026
@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR replaces review-comment state, publication, and lease factories with direct imports while preserving existing comment and CLI behavior.

Example: Two workers contend for review leases with GitHub comment IDs 100 and 200.

  • Before: The factory-composed lease owner elects comment 100 and removes the losing worker's owned lease.
  • After: The directly imported lease owner preserves the same election and cleanup.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is coherent and preserves verified source contracts; supplied CLI comparison results support it, but retained execution traces were unavailable for direct inspection.
Proof confidence 🦐 gold shrimp (3/6) The supplied current-head body reports ten matching executions of reserve-review-lease and live-proof-comment on macOS arm64 with Node 24.21.0, executable GitHub fixtures, real payload files, and loopback queue HTTP; raw artifacts were unavailable for inspection, and the maintainer-authored ordinary contributor proof gate does not apply.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes
Reason: The maintainer-directed cleanup reduces factory wiring without changing documented behavior, persisted formats, or Bay's observer contract.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it completes a useful ownership cleanup absent from current main, and inspection found no actionable regression.

Priority: P3
Reviewed head: 0fec6ab9a02dff84efc3be4bdcde8b1802ff8a5b

Before merge

None.

Findings

None.

Agent review details

How this fits together

Review and apply commands feed item revisions and comment bodies into the comment subsystem, which coordinates leases, verifies GitHub write receipts, and returns publication metadata.

flowchart TD
  A[Review and apply commands] --> B[Comment workflow]
  B --> C[Lease owner]
  B --> D[Publication owner]
  C --> E[Comment state and trust checks]
  D --> E
  C --> F[GitHub execution]
  D --> F
Loading

Technical review

Best possible solution:

Complete the direct-import cutover while retaining fresh revision reads, exact trusted receipts, and the existing label mutation owner.

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

This is a refactor with no reported behavioral defect to reproduce; source inspection verifies the existing factory composition on main.

Is this the best way to solve the issue?

Direct imports remove duplicate composition while preserving the necessary live-read seam and shared mutation owner.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 0fc6d572bc2a.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 6e7ed03 adds src/clawsweeper-review-comment-leases.ts:351 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 6e7ed035183f; files: src/clawsweeper-review-comment-leases.ts)
  • Vincent Koc: Raw commit 35e637e adds src/clawsweeper-review-comment-publication.ts:308 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 35e637efc9ea; files: src/clawsweeper-review-comment-publication.ts)

Review metrics

Metric Value Why it matters
Net reduction 336 lines removed across 12 files Factory wiring and test substitution are removed together; most production churn comes from moving functions out of factory scope.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: Internal ownership cleanup preserves intended runtime behavior and addresses no demonstrated urgent user regression.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-10T15:42:47.576Z sha 99a7697 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-10T15:53:40.447Z sha b41e576 :: needs maintainer review before merge. :: none

Reviewed October 10, 2026, 12:03 PM ET / 16:03 UTC (Revision 3).

@obviyus

obviyus commented Oct 10, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@obviyus
obviyus force-pushed the cleanup/row3-review-comments branch from 99a7697 to b41e576 Compare October 10, 2026 15:50
@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

Base automatically changed from cleanup/row3-github-imports to main October 10, 2026 15:56
@obviyus
obviyus force-pushed the cleanup/row3-review-comments branch from b41e576 to 0fec6ab Compare October 10, 2026 16:00
@obviyus

obviyus commented Oct 10, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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.

1 participant