Skip to content

fix(gateway): Land PR works with configured repository hooks - #129576

Merged
steipete merged 1 commit into
mainfrom
steipete/pr-merge-blocker-c6b593
Aug 26, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/pr-merge-blocker-c6b593

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Fixes #129573

AI-assisted; reviewed and verified by the submitting maintainer.

What Problem This Solves

Fixes an issue where users requesting "Land PR" would get workspace_changed and no pull request when their approved repository or linked worktree configured the normal Git core.hooksPath setting.

Why This Change Was Made

The GitHub publication owner incorrectly classified ordinary repository-local and worktree-scoped hook paths as unsafe before it could push or create a missing pull request. Permit core.hooksPath during workspace validation, explicitly disable hooks and filesystem monitoring for every hook-capable managed Git mutation, including push and interrupted-recovery write-tree, and continue rejecting every other unsafe Git configuration.

User Impact

"Land PR" can safely publish an approved branch and create a pull request when none exists, including in normal OpenClaw checkouts and linked worktrees that configure repository hooks. Repository-controlled Git hooks and filesystem monitors remain unable to execute during managed publication, and unrelated unsafe Git configuration remains rejected.

Evidence

  • Production LOC: +9/-11 (net -2); tests: +91/-1 (net +90).
  • node scripts/run-vitest.mjs src/gateway/github-publication-git-index.test.ts src/gateway/github-publication-boundaries.test.ts src/gateway/github-publication.test.ts — 3 files passed, 61 tests passed.
  • node scripts/check-changed.mjs -- src/gateway/github-publication-base.ts src/gateway/github-publication-executor.ts src/gateway/github-publication-git-index.ts src/gateway/github-publication-git-transport.ts src/gateway/github-publication-git-index.test.ts src/gateway/github-publication.test.ts — all applicable changed-file gates passed.
  • git diff --check origin/main...HEAD — passed.
  • Fresh mandatory autoreview of the final repair — clean, with no accepted/actionable findings.
  • Real-Git regression coverage exercises repository-local and worktree-scoped pre-push, post-index-change, and reference-transaction hooks, along with interrupted publication recovery; these tests verify the hooks never execute.
  • Security invariant: configured hook paths may exist, but hook-capable managed mutations explicitly disable hooks and filesystem monitoring, and all other unsafe Git configuration continues to fail closed.
  • Live proof gap: a live deployed Team gateway reproduction cannot be run pre-merge because the fixed publisher is not deployed yet. The real-Git integration tests are owner-boundary proof, not live Gateway proof.

@clawsweeper

clawsweeper Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review August 25, 2026 19:36
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S maintainer Maintainer-authored PR labels Aug 25, 2026
@steipete
steipete force-pushed the steipete/pr-merge-blocker-c6b593 branch 2 times, most recently from d512bb1 to 4fc77db Compare August 25, 2026 21:21
@steipete

Copy link
Copy Markdown
Contributor Author

Refreshed this PR onto main with single focused head 4fc77db5a584c0351507e3d39ab7fe5588fa1c8a, preserving the original author and commit message.

Verified locally:

  • node scripts/run-vitest.mjs src/gateway/github-publication-git-index.test.ts src/gateway/github-publication-boundaries.test.ts src/gateway/github-publication.test.ts: 61/61 passing. Real repository-local and worktree-scoped executable pre-push, post-index-change, and reference-transaction hooks prove publication and interrupted recovery succeed without executing any hook.
  • node scripts/check-changed.mjs -- src/gateway/github-publication-base.ts src/gateway/github-publication-executor.ts src/gateway/github-publication-git-index.ts src/gateway/github-publication-git-transport.ts src/gateway/github-publication-git-index.test.ts src/gateway/github-publication.test.ts: passed formatting, core/core-test typechecks, lint, dead-code, and architecture/security guards.
  • git diff --check origin/main...HEAD: passed. Fresh independent Codex autoreview: clean, with no actionable findings.
  • The previously missing Codex retry-test registration is already on main through fix(ui): usage filters hide sessions when multiple providers are selected #129482. Fresh verification passed the full-suite ownership audit 23/23 and the real child-process startup-retry coverage 4/4.

The new exact-head CI run https://github.com/openclaw/openclaw/actions/runs/32900590726 is currently blocked by an unrelated deterministic main regression in src/agents/embedded-agent-runner/model-resolution-consistency.test.ts: its full-module mock removes the withPluginMetadataSnapshotScope export imported by that same file. Failed job: https://github.com/openclaw/openclaw/actions/runs/32900590726/job/97973571021.

The canonical owner fix is already in flight in #129607; it removes the incomplete metadata mock and isolates only provider normalization. Do not duplicate that separately owned repair in this focused gateway PR or rerun this deterministic merge ref. Once #129607 lands, refresh this PR onto the repaired main and rerun exact-head CI before native prepare/merge.

Live deployed Gateway publication cannot be verified before deployment; the real-Git owner-boundary integration tests above are not live deployed proof.

@clawsweeper

clawsweeper Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 5:27 PM ET / 21:27 UTC.

ClawSweeper review

What this changes

The PR permits normal repository-local and worktree-scoped Git hook paths during Gateway publication while disabling hooks for managed branch, index, and push operations.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep open: this focused maintainer PR remains necessary and has no blocking correctness findings. It removes the current managed-publication failure path while preserving explicit suppression of repository hooks during side effects.

Priority: P1
Reviewed head: 4fc77db5a584c0351507e3d39ab7fe5588fa1c8a

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-boundary repair with credible real-Git coverage and no blocking review finding.
Proof confidence 🌊 off-meta tidepool Not applicable: This member-authored PR is exempt from the external-contributor proof gate; its real-Git integration coverage is nevertheless meaningful supporting evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This member-authored PR is exempt from the external-contributor proof gate; its real-Git integration coverage is nevertheless meaningful supporting evidence.
Evidence reviewed 6 items Current-main behavior: Current main no longer rejects core.hooksPath in its unsafe-config pattern, but its push argument builder lacks a hook-path override; a configured pre-push hook can therefore still affect publication.
Owner-boundary repair: The publication executor obtains push arguments from the shared transport builder, and the PR head adds core.hooksPath=/dev/null immediately before git push there.
Real-Git regression coverage: The new parameterized test configures local and worktree hook paths, installs pre-push, post-index-change, and reference-transaction hooks, runs recovery and push, and verifies that the marker was never created.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs src/gateway/github-publication-git-index.test.ts

Result: FAIL (failed) — step 1 run node scripts/run-vitest.mjs src/gateway/github-publication-git-index.test.ts: previous terminal command was still running after 30 seconds: "node scripts/run-vitest.mjs src/gateway/github-publication-git-index.test.ts"

[test] starting test/vitest/vitest.gateway.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-129576-vuCCVc/target

 ✓  gateway-core  ../../src/gateway/github-publication-git-index.test.ts (11 tests) 1402ms

 Test Files  1 passed (1)
      Tests  11 passed (11)
   Start at  21:28:21
   Duration  10.05s (transform 6.78s, setup 883ms, import 7.43s, tests 1.40s, environment 0ms)

[test] passed 1 Vitest shard in 16.07s

Assertions:

  • FAIL expect_output: github-publication-git-index.test.ts

How this fits together

Gateway publication validates an approved worktree, creates a publication commit, updates the local branch/index, pushes it to GitHub, then creates or finds a pull request. Git configuration enters at workspace validation and managed Git commands are the side-effect boundary.

flowchart LR
  A[Approved worktree] --> B[Git configuration validation]
  B --> C[Publication commit]
  C --> D[Branch and index update]
  D --> E[Hardened branch push]
  E --> F[GitHub pull request]
Loading

Before merge

  • Complete next step (P2) - No repair job is warranted: this maintainer-labelled PR already contains the focused repair and needs ordinary exact-head CI and maintainer merge handling.
Agent review details

Security

None.

PR surface

Source -2, Tests +90. Total +88 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 4 9 11 -2
Tests 2 91 1 +90
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 100 12 +88

Review metrics

Metric Value Why it matters
Production versus test LOC production +9/-11 (net -2); tests +91/-1 (net +90) The production repair is net-negative and the added test lines exercise real Git hook behavior across both supported configuration scopes.

Stored data model

Persistent data-model change detected: serialized state: src/gateway/github-publication-git-index.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #129573
Summary: This PR explicitly implements the concrete configured-hook publication failure described by the canonical issue.

Members:

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

Technical review

Best possible solution:

Retain a single transport-level hook override and the shared hardened index-command policy so ordinary hook configuration works without permitting repository-controlled hook execution.

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

Yes—source-reproducible: the pre-repair validation rejects core.hooksPath, and the added real-Git test configures both supported scopes and exercises publication recovery plus push. No deployed Gateway run was performed.

Is this the best way to solve the issue?

Yes—the shared Git argument builders are the owner boundary, avoiding an executor-only exception and preserving rejection of unrelated unsafe configuration.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P1: Without this repair, Land PR can fail to publish an approved branch or create its pull request when ordinary repository hooks are configured.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.

Label justifications:

  • P1: Without this repair, Land PR can fail to publish an approved branch or create its pull request when ordinary repository hooks are configured.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.

Evidence

What I checked:

  • Current-main behavior: Current main no longer rejects core.hooksPath in its unsafe-config pattern, but its push argument builder lacks a hook-path override; a configured pre-push hook can therefore still affect publication. (src/gateway/github-publication-git-transport.ts:169, 46e4520bd5db)
  • Owner-boundary repair: The publication executor obtains push arguments from the shared transport builder, and the PR head adds core.hooksPath=/dev/null immediately before git push there. (src/gateway/github-publication-git-transport.ts:174, 4fc77db5a584)
  • Real-Git regression coverage: The new parameterized test configures local and worktree hook paths, installs pre-push, post-index-change, and reference-transaction hooks, runs recovery and push, and verifies that the marker was never created. (src/gateway/github-publication-git-index.test.ts:120, 4fc77db5a584)
  • Git contract: Installed Git documentation states that pre-push is invoked by git-push and that reference-transaction runs on reference updates; core.fsmonitor is used by commands that refresh the index, so its existing suppression on index operations is correctly scoped. (4fc77db5a584)
  • Feature provenance: The managed GitHub publication feature appears to originate with the merged feature commit; the current PR is authored by the same feature owner. (src/gateway/github-publication-git-transport.ts:169, 0606e31d0e62)
  • Release/main-only check: The PR head is not contained by any local release tag; it remains an open, unmerged repair rather than an implemented release fix. (4fc77db5a584)

Likely related people:

  • steipete: Authored the original managed GitHub publication feature commit and this focused repair. (role: feature owner and recent repair author; confidence: high; commits: 0606e31d0e62, 4fc77db5a584; files: src/gateway/github-publication-executor.ts, src/gateway/github-publication-git-transport.ts, src/gateway/github-publication-git-index.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

@steipete
steipete force-pushed the steipete/pr-merge-blocker-c6b593 branch from 4fc77db to 16cc679 Compare August 25, 2026 22:59
@steipete

steipete commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor Author

Maintainer verification for exact head 2a2568d0661601f8cdf3088b9b49162d366ef3fe:

  • Root cause: repository preparation legitimately configures core.hooksPath, but managed GitHub publication rejected that same normal local/worktree setting before creating the pull request.
  • Owner-boundary repair: accept configured hooks while passing command-local core.hooksPath=/dev/null to publication push, index creation, reference updates, and interrupted-publication recovery. Executable pre-push, post-index-change, and reference-transaction fixtures prove repository hooks never execute; all other unsafe transport configuration and live-worker authority checks still fail closed.
  • node scripts/run-vitest.mjs src/gateway/github-publication-git-index.test.ts src/gateway/github-publication-boundaries.test.ts src/gateway/github-publication.test.ts: 3 files, 61 tests passed.
  • Previous exact-head CI exposed an unrelated preexisting Gateway shared-module isolation defect. Its canonical fix had already landed in fix(gateway): settle live fixtures before Codex reconnects #128965, so this single focused publication commit was rebased onto that repaired main. node scripts/run-vitest.mjs src/gateway/github-publication-git-index.test.ts src/gateway/github-publication-boundaries.test.ts src/gateway/github-publication.test.ts src/gateway/server-methods/agent.test.ts test/vitest-projects-config.test.ts now passes 368 tests: 61 publication cases, 284 isolated Gateway-agent cases, and 23 Vitest project-ownership checks.
  • node scripts/check-changed.mjs -- src/gateway/github-publication-base.ts src/gateway/github-publication-executor.ts src/gateway/github-publication-git-index.ts src/gateway/github-publication-git-transport.ts src/gateway/github-publication-git-index.test.ts src/gateway/github-publication.test.ts: all changed formatting, production/test typecheck, lint, dead-code, architecture, database, and security guards passed.
  • git diff --check origin/main...HEAD: passed. Fresh Codex-backed autoreview: clean, no actionable findings.
  • Fresh exact-head CI: https://github.com/openclaw/openclaw/actions/runs/32912210864 . The refreshed merge history includes the canonical main qualification and Gateway test-isolation repairs; no poisoned older merge ref was reused.
  • ClawSweeper disposition: the latest completed review has no actionable findings and no Rank-up moves: list. Its requested next step is exact-head CI plus normal maintainer landing. The reported persistence warning is a test-file classification false positive—there is no schema/migration change—and the proof warning is a reviewer timeout despite captured passing focused output.
  • Production LOC: +9/-11 (net -2); tests: +91/-1.

Remaining proof gap: live deployed Gateway publication cannot be exercised before deployment; the real-Git integration tests above are not deployed live proof.

@steipete
steipete force-pushed the steipete/pr-merge-blocker-c6b593 branch from 16cc679 to 2a2568d Compare August 25, 2026 23:45
@steipete
steipete merged commit c28d11f into main Aug 26, 2026
196 checks passed
@steipete
steipete deleted the steipete/pr-merge-blocker-c6b593 branch August 26, 2026 00:05
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

gateway Gateway runtime maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Land PR fails to create a pull request when repository hooks are configured

1 participant