Repository navigation
Conversation
…e-push chain #10401 fixed the Makefile and the installed hook dispatcher, but the scripts the dispatcher hands off to (scripts/pre-push, scripts/pre-push-singleflight, scripts/pr-preflight) and the Python entrypoints they exec (.github/scripts/preflight_runner.py, .github/scripts/pr_preflight.py) still resolved the repo root with an unguarded `git rev-parse --show-toplevel`. In a linked worktree whose git context resolves to a git dir rather than a work tree, show-toplevel exits 128 ("this operation must be run in a work tree"), so the gate aborted after the dispatcher — forcing a `--no-verify` push that silently bypasses local checks, exactly as reported. Fall back to the invoking work tree (git runs hooks at the work-tree top and the dispatcher/gate cd into the resolved root first), matching the fallback #10401 established for the dispatcher. Adds scripts/test-pre-push-worktree-fallback.sh (wired into the check manifest, local+ci): a bare GIT_DIR reproduces the 128 condition and asserts every call site in the chain resolves the root instead of aborting. Verified it fails against the pre-fix scripts and passes after. Failure-Class: none fixes #10293
|
Hey @kodjima33 👋 Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request. After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:
Before your next PR, please skim:
If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing. Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out. Thank you for being part of the Omi community! |
Carry the complete BasedHardware#10293 root-resolution fix from BasedHardware#10491 into the portable pre-push chain, adapting its regression to the explicit Windows Python launcher contract and running it in the native Windows lane. Tests: native Windows manifest checks pre-push-worktree-fallback, preflight-runner-portability, and check-manifest-contract; Python preflight and manifest unit suites; actionlint. Failure-Class: none Co-authored-by: Nik Shevchenko <[email protected]>
Carry the complete BasedHardware#10293 root-resolution fix from BasedHardware#10491 into the portable pre-push chain, adapting its regression to the explicit Windows Python launcher contract and running it in the native Windows lane. Tests: native Windows manifest checks pre-push-worktree-fallback, preflight-runner-portability, and check-manifest-contract; Python preflight and manifest unit suites; actionlint. Failure-Class: none Co-authored-by: Nik Shevchenko <[email protected]>
Fixes #9724. Fixes #10293. ## Summary - make the single-flight runner register only host-supported signals and replace destructive Windows `os.kill(pid, 0)` probing - launch the extensionless pre-push script through Git Bash and carry one explicit Python executable across every hook boundary, including the `PRE_PUSH_SKIP_PR_PREFLIGHT=1` failure-class hatch - contain the Windows command tree in a kill-on-close Job Object, with a bootstrap barrier that assigns the job before the real command can spawn - bind stale-lock identity to Windows process creation ticks so PID reuse cannot impersonate the prior owner - decode Git metadata as UTF-8 so native Windows locales can resolve non-ASCII worktree paths - make the check manifest Windows-aware and add a path-scoped native Windows workflow that executes the manifest-owned portability checks - preserve the mainline `forwardable_signals` and direct-child fallback contracts while extending Windows ownership to the full process tree - restore the linked-worktree repo-root fallback across all five downstream shell/Python pre-push entrypoints, so a `show-toplevel` exit 128 does not force contributors toward `--no-verify` - keep native process tests event-driven with pipe handshakes and `WaitForSingleObject`, without wall-clock polling or leaked handles ## Root cause The pre-push control plane assumed POSIX signals, process groups, executable script launching, virtualenv layout, and `python3` naming at native Windows boundaries. It also let Python decode Git's UTF-8 output with the active Windows code page, so a worktree path containing non-ASCII characters could fail before any check ran. A second gap remained after #10401: the installed hook dispatcher could recover when `git rev-parse --show-toplevel` failed in a linked worktree, but `scripts/pre-push`, `scripts/pre-push-singleflight`, `scripts/pr-preflight`, `.github/scripts/preflight_runner.py`, and `.github/scripts/pr_preflight.py` repeated the unguarded lookup and aborted later in the same chain. Fixing only the first Windows exception or only the Makefile/dispatcher boundary would expose the next launch, liveness, decoding, root-resolution, or hatch failure. This PR closes that reachable portability chain. ## Attribution The linked-worktree root-resolution slice preserves Nik Shevchenko's original #10491 implementation through the rebased commit lineage, with `Co-authored-by: Nik Shevchenko <[email protected]>`. Its regression was adapted to the explicit Windows Python launcher introduced by this PR and registered in both manifest lanes plus native Windows CI. ## Verification - rebased onto current `origin/main` (`ffc13daf4c`) and reran the native Windows checks - native Windows manifest run: `pre-push-worktree-fallback`, `preflight-runner-portability`, and `check-manifest-contract` -> 3 checks passed - native Windows: `test_preflight_runner.py` -> 23 tests passed with `ResourceWarning` promoted to an error, including a real Job Object parent/descendant termination proof, explicit hatch interpreter coverage, and runner/direct PR-preflight execution from a Chinese worktree path with `PYTHONUTF8=0` - native Windows: a temporary Git repository ran the real `pre-push-singleflight -> preflight_runner -> pre-push` chain with no `python3` on `PATH` - native Windows: `test_run_checks.py` -> 33 tests passed, 1 POSIX-only fixture skipped; the real manifest subprocess path also resolved `python3` to the active interpreter with an empty `PATH` - native Windows: full `test_pr_preflight.py` -> 26 tests passed, 3 explicit host-capability skips - native Windows: `test-pre-push-worktree-fallback.sh` passed against all five downstream root resolvers under the reproduced exit-128 condition - `test_pre_push_ci_prediction.py` -> 14 tests passed - `scripts/test-pre-push-diff-base.sh` passed under Git Bash - `bash -n` passed for all four touched shell scripts - Black 26.5.1 passed for the touched Python files with the repository's 120-column/no-string-normalization settings - actionlint 1.7.12 passed for the Windows workflow - `python -m py_compile` passed for all touched Python files - `scripts/failure-class validate --base origin/main --head HEAD ...` passed with `Failure-Class: none` - `git diff --check origin/main...HEAD` passed GNU Make is not installed on the local Windows host, so `scripts/test-make-setup.sh` could not be rerun there. The new regression exercises every downstream root resolver directly on native Windows; Linux CI remains authoritative for the existing Make fixture and the full manifest. The committed diff changes the manifest, so the legacy local selector intentionally attempts every manifest check. On native Windows that broad run currently stops while collecting the existing `dev-harness-unit-tests` because its qualification module imports POSIX-only `fcntl`; the path-scoped Windows workflow therefore executes the portability contracts by manifest check ID, while Linux CI remains the full-manifest authority. ## Product invariants affected none ## Failure class (fixes) Failure-Class: none
What
Make the whole pre-push hook chain resolve the repo root without a work tree in linked worktrees.
#10401fixed the Makefile and the installed hook dispatcher, but the scripts the dispatcher hands off to —scripts/pre-push,scripts/pre-push-singleflight,scripts/pr-preflight— and the Python entrypoints they exec —.github/scripts/preflight_runner.py,.github/scripts/pr_preflight.py— still resolved the root with an unguardedgit rev-parse --show-toplevel.Why
In a linked worktree whose git context resolves to a git dir rather than a work tree,
git rev-parse --show-toplevelexits 128 withfatal: this operation must be run in a work tree. The dispatcher survived (#10401gave it a|| pwdfallback), but it then execspre-push-singleflight→preflight_runner.py→pre-push, each of which re-ran the unguarded call and aborted — so the gate died and the user was forced into a--no-verifypush that silently bypasses all local checks. That is exactly the reported symptom (#10293):Fix
Fall back to the invoking work tree — git runs hooks with the working directory at the work-tree top, and the dispatcher/gate
cdinto the resolved root before invoking these scripts — matching the fallback#10401established for the dispatcher (git rev-parse --show-toplevel 2>/dev/null || pwd; the Python resolvers fall back toPath.cwd()).What I tested
GIT_DIR(which makesshow-toplevelexit 128, identical to the reporter's condition). Before the fix it aborted atpreflight_runner.py:249withfatal: this operation must be run in a work tree; after the fix the gate proceeds past root resolution.scripts/test-pre-push-worktree-fallback.sh(wired into.github/checks-manifest.yaml,local+ci): asserts all five call sites resolve the work-tree root instead of aborting under the 128 condition. Verified it fails against the pre-fix scripts and passes after.GIT_DIRoverride; existingscripts/test-make-setup.shand the manifest contract self-test (test_run_checks.py, 22 tests) still pass.Product invariants affected
none
Failure class (fixes)
Failure-Class: none
fixes #10293
Auto-generated from issue feedback by the mini issues-improver — tested and merged.