Repository navigation
fix(rewrites): preserve async PR merge authority - #231
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed October 6, 2026, 8:27 AM ET / 12:27 UTC (Revision 3). ClawSweeper reviewWhat this changesOctopool’s GitHub CLI wrapper protects asynchronous merge control fields, pins omitted head commits, preserves local output formatting, and polls merge status using the caller’s credentials. Merge readiness✅ Ready for maintainer review The test correction is sound, production code is unchanged since the previous review, and no blocking defect remains. The async merge protection is still absent from the pinned main branch, so this PR remains useful. Priority: P2 Review scores
Verification
How this fits togetherOctopool pools GitHub reads while keeping writes on the caller’s local GitHub identity. Its CLI rewrite guard checks requests and snapshots publication content before invoking native GitHub CLI. flowchart TD
A[GitHub CLI request] --> B[Local rewrite policy]
B --> C{Supported merge request?}
C -->|No| D[Reject before dispatch]
C -->|Yes| E[Validate authority and pin head]
E --> F[Snapshot rewritten commit text]
F --> G[Native GitHub CLI with caller credentials]
G --> H[GitHub merge or status response]
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Keep merge authority in the existing typed snapshot guard, preserve response formatters literally, and retain the documented upgrade contract. Do we have a high-confidence way to reproduce the issue? Yes, from source: pinned main lacks an async merge schema, allowing those requests into generic rewriting. No runtime reproduction was executed during this review. Is this the best way to solve the issue? Yes. Extending the existing immutable merge snapshot owner avoids a parallel implementation, and the latest test correction matches native response-formatting semantics. AGENTS.md: not found in the target repository. Codex review notes: model internal, reasoning medium; reviewed against 005feef519da. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
@clawsweeper re-review Please review exact head |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Exact head |
|
🦞👀 Re-review progress:
|
What Problem This Solves
Async PR merges could enter generic JSON rewriting, allowing a policy to change the reviewed SHA, merge method, or action before GitHub received the request.
User Impact
Protected async merges preserve merge authority and rewrite only commit title/message text. Status polling keeps the local writer identity. Callers can require this behavior by putting
-H 'X-Octopool-Require: merge-async-v1'first aftergh api; older protected CLIs refuse it and require a CLI upgrade. No Worker deployment, policy change, credential change, or migration is needed.Why This Change Was Made
Extend the existing merge snapshot owner with the async fields and guarded missing-head lookup. Unsupported merge request syntax and rewritten merge endpoints cannot enter generic fallback. Local --template/-t formatting now uses the modeled snapshot path alongside --jq; formatter bytes stay unchanged. The marker prevents older wrappers from silently rewriting new callers' authority; response validation alone occurs too late.
Related: openclaw/openclaw#163579 (comment)
Evidence
ghshim preserve the allowed file request and native exit/output; an anchoredsquash -> rebaserule dispatches no child.go test ./cmd/octopool -run '^(TestStringRewrite.*|TestRewrite.*|TestProtectedPRRead.*|TestCLIHelpBootstrap/(explicit|shim)/operational)' -count=1(initial head: 92.957s; formatting correction: 88.509s).e2eae0a) reproduced the unsafe rewrite with a synthetic child: without marker, one child receivedrebase; marker-first exited 1 with zero child calls. No live merge was submitted by this fixture.gofmt, targeted Markdown formatting, andgit diff --checkpassed.Review compatibility decision
Resolved the formatting concern by preserving harmless
--template/-toutput options through the protected parser, including separate, attached, and equals spellings on synchronous/async PUT and UUID GET. Native GitHub CLI v2.98.0 source confirms these are local output options and rejects incompatible format flags before its API request.Request-affecting
--cache, pagination, and raw-bodyContent-Typeremain deliberately rejected for protected merges: they are not output formatting, and generic rewriting cannot preserve merge authority. Use the modeled JSON request directly and fresh status reads. This implements the review's recommended option without an unsafe fallback.Current head:
32fb0b8ed600156e2a17c80533717ed2e65d5557. Focused protection-read/API/built-wrapper tests passed (11.883s). The Windows CI failure on the preceding head was reproduced locally: an old test still expected--templateto take generic rewriting. The test-only correction moves that expectation into the preserved-formatting matrix and adds rulesets GET sibling coverage (24 cases total). Independent review found the correction sound. The prior runtime diff has scoped-clean autoreview and ClawSweeper approval; Current-head CI passed on Linux and Windows; ClawSweeper marked this exact head ready with no findings or remaining rank-up moves.