Repository navigation
Worktree receipt: check required local files even when Git status is clean #60282
ryanroundhouse
started this conversation in
Show and tell
Replies: 1 comment 1 reply
|
Really clean design on To answer your question ("which local-file requirement would catch a real setup mistake in your workflow?"), three categories of local files consistently cause silent multi-worktree failures when spawning coding agents across linked
|
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I built a small Python/Git receipt for checking a specific handoff gap: two worktrees can be at the same commit, both show no Git status changes, and still have different local setup files.
I'm Ryan, founder of Zozo HQ. This independent review aid and post were prepared with AI assistance. It works without Zozo and is not a Zozo or Codex feature, benchmark, bug reproduction, or security sandbox.
The negative control
The included
test_required_local_gap_negative_control_and_restorationcreates two disposable Git worktrees at the same commit. An ignored fixture file exists in only one. Both worktrees pass the status-only observation; an explicit required-file check reportspresent_regular_filefor one andmissingfor the other. Creating the file in the second worktree restores that type check, even with deliberately different bytes.That last step matters: a file being present does not mean its configuration is correct. This check separates the questions rather than treating a clean checkout as a ready environment.
Codex's current worktree guidance scopes
.worktreeincludecopying to local desktop-app-managed worktrees, not remote or self-created command-line worktrees. This helper does not parse those patterns, copy files, or test Codex's copying behavior. Independently choose the files your own task needs.Try the fixture before inspecting a real checkout
Save the two complete code blocks below as
worktree_receipt.pyandtest_receipt.pyin the same directory outside your repository. Review them first. They use the Python standard library and Git on PATH. Run them only with trusted Python, Git and operating-system executables. The test harness uses a disposable Git configuration and clears inherited Git redirection. It is not a general sandbox.The tests create and remove synthetic temporary repositories; the reported validation used no customer repository, real credentials, package installation, network or model calls. The fixture launcher is POSIX-only; an unsupported platform skips these tests, which must not be counted as a pass. On November 8, 2026, the complete 48-test suite passed on Linux with Python 3.12.14 and Git 2.52.0. Native macOS, Windows and older Git versions have not been validated. Platforms missing the required descriptor-relative operations fail closed for the new file check.
Use an explicit requirement
On a trusted repository/configuration, replace the placeholder with its absolute path:
Only request a file if you independently expect it in every listed checkout. Repeated identical requirements are deduplicated. No option means no assumed local-file requirements. The original index-flag and checkout-identity observations remain separate.
present_regular_file: observed file type only, not contents, readability, valid credentials, equal configuration, or application readiness.missing,symlink,nonregular,inaccessibleandinspection_failed: distinct outcomes. A failed observation is not a pass or a zero count.not_checked: checkout missing/bare or its Git identity could not be verified.The required-file check uses no-follow metadata operations, pins parent directories, and never opens, hashes, copies or repairs the requested file's contents. It rejects absolute/traversal/malformed requirement paths before probing. It does not follow a symlink in the requested relative path. The Git commands themselves can read tracked contents and invoke configured helpers/filters, so use trusted repositories and Git configuration only.
Exit 0 means a receipt was emitted, not that setup passed. Review every required-file state and the separate Git observations. A Git status/index failure may coexist with a completed file-type observation.
Default detailed output includes local checkout paths, branches and requested relative names. Keep it private.
--summaryemits fixed labels and aggregate counts, with no paths, branches, hashes, timestamps or raw output. Counts can still reveal workspace characteristics, so review them before sharing. The source's “Private review aid” description refers to handling the receipt, not restricted access to this code.What it cannot establish
This is a non-atomic snapshot, not a complete checkout census, backup, cleanup tool or permission to delete. In the tested Git 2.52.0
--separate-git-dirlayout, Git's inventory can list the administrative directory instead of the real main checkout. That row fails identity inspection; the omitted checkout stays uninspected. Compare against independently known checkout paths.Except for the explicit type observations, it does not audit ignored files, unsaved buffers, unpushed commits, credentials or external services. It does not recurse into nested submodule indexes. Index flags are Git-observed effective flags, not direct persisted-index bits; sparse checkout can legitimately use them. No flag is cleared. Concurrent changes can invalidate the result immediately, and directory pinning does not make the whole observation atomic.
This extends the earlier review walkthrough with an executable required-file check; that post's narrower index-flag diagnostic remains unchanged. For a Zozo evaluation, the Local quickstart is the separate product path: Node 22/24/26, Git and GitHub CLI 2.94+ for GitHub; native Windows uses Claude Code rather than Codex. Local agents run as your user with your files, services stay on loopback, work stops with the launch terminal, and runtime/model access is separate. No Zozo or Codex session was executed for this receipt test.
Complete source and tests
Both blocks are the exact files from the tested receipt revision. The synthetic fixture strings in the tests are not real credentials. Test assertions cover unchanged index bytes/mtime, checkout identity, index flags, malformed paths, missing and nonregular files, symlinks, failed observations, summary privacy and the ignored-file negative control.
Copy worktree_receipt.py
Copy test_receipt.py
Actual full-suite result summary
For people running coding agents across worktrees: which local-file requirement would catch a real setup mistake in your workflow? Please keep secrets and private paths out of replies.
All reactions