Fix: Keep Entire pre-push alive after Lefthook reinstalls hooks#1386
Open
stale2000 wants to merge 2 commits into
Open
Fix: Keep Entire pre-push alive after Lefthook reinstalls hooks#1386stale2000 wants to merge 2 commits into
stale2000 wants to merge 2 commits into
Conversation
Lefthook can rewrite .git/hooks/pre-push after Entire wraps it, removing the session-push hook even though Entire remains enabled. Keep the existing hook ownership behavior unchanged and add a Lefthook-local fallback command that only runs when the Entire marker is absent from the active pre-push hook. The fallback lives in lefthook-local.yml, is added to .git/info/exclude, and is removed by entire disable without disturbing unrelated local Lefthook commands. Closes entireio#1349 Constraint: Preserve current Entire .git/hooks/pre-push wrapper behavior. Constraint: Use Lefthook local config instead of modifying team-owned lefthook.yml. Rejected: Surrender .git/hooks/pre-push ownership to Lefthook | would significantly change existing hook behavior. Rejected: Require users to rerun entire enable after every Lefthook reinstall | leaves the silent session-push loss unfixed. Confidence: high Scope-risk: narrow Directive: Do not remove the marker check unless another path guarantees Entire pre-push cannot run twice. Tested: gofmt; golangci-lint run ./cmd/entire/cli/strategy/...; go test ./cmd/entire/cli/strategy; go test -tags=integration ./cmd/entire/cli/integration_test -run 'Test(UserPromptSubmit_ReinstallsOverwrittenHooks|HookOverwrite_MidTurnWipe_NextPromptRecovers)'; real Lefthook v1.13.6 local-config smoke test. Not-tested: mise run check, blocked by GitHub 504s while downloading shellcheck and tmux via mise/aqua. Entire-Checkpoint: 965634231c03
Create an intentionally empty commit so the Entire/Codex git hooks can run without changing repository contents. Constraint: User requested a test commit for hook validation Confidence: high Scope-risk: narrow Reversibility: clean Directive: This commit is intentionally empty and may be reverted after hook validation Tested: git commit --allow-empty completed Not-tested: Full CI was not run because this commit is hook-only Entire-Checkpoint: bb640c95beb8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
https://entire.io/gh/stale2000/cli/session/019ea5bb-9549-7083-b95f-7ecb498cbc24
Closes #1349.
This keeps Entire's existing Git hook ownership behavior unchanged while adding a Lefthook-local safety net for the failure mode reported in the issue.
When a repository has a YAML Lefthook config,
entire enablestill installs the normal Entire.git/hooks/pre-pushwrapper. It now also ensureslefthook-local.ymlcontains anentire-push-sessionspre-push command that only runs if Lefthook has reclaimed.git/hooks/pre-pushand removed theEntire CLI hooksmarker.Normal state:
pre-pushwrapper.Recovered state:
.git/hooks/pre-push.entire hooks git pre-push {1} || true.Details
lefthook-local.yml, not team-ownedlefthook.yml..git/info/exclude.entire disable..config/lefthook.ymldetection in addition to the existing Lefthook config names.Verification
Passed:
gofmt -w cmd/entire/cli/strategy/hook_managers.go cmd/entire/cli/strategy/hook_managers_test.go cmd/entire/cli/strategy/hooks.go cmd/entire/cli/strategy/hooks_test.go/Users/stale2000/.local/share/mise/installs/golangci-lint/2.11.3/golangci-lint-2.11.3-darwin-arm64/golangci-lint run ./cmd/entire/cli/strategy/...go test ./cmd/entire/cli/strategygo test -tags=integration ./cmd/entire/cli/integration_test -run 'Test(UserPromptSubmit_ReinstallsOverwrittenHooks|HookOverwrite_MidTurnWipe_NextPromptRecovers)'git diff --checkManual real-Lefthook checks:
v1.13.6thatlefthook-local.ymlis merged intopre-pushruns.{1}expands to the Git pre-push remote name (origin).entire hooks git pre-push originwhen.git/hooks/pre-pushlacks the Entire marker..git/hooks/pre-pushcontainsEntire CLI hooks.Known verification gaps:
mise run checkandmise run fmtdid not reach the repo tasks because mise/aqua hit GitHub 504s while downloading ShellCheck and tmux.go test ./cmd/entire/clistill has an unrelated date-sensitive failure inTestRunAuthStatus_RendersSessionsTablewhere the rendered local date is2025-12-31but the test expects2026-01-01.Entire Integration
This PR commit was attached to the active Codex transcript with Entire:
019ea5bb-9549-7083-b95f-7ecb498cbc24965634231c03Entire-Checkpoint: 965634231c03entire session currentresolves the attached Codex session.entire checkpoint listshows checkpoint965634231c03on this branch.git pushran the Entirepre-pushhook and pushedentire/checkpoints/v1to the fork.