﻿# Review a Codex worktree before bringing changes back

Review a Codex worktree before handoff: identify its base, inspect the diff, verify the right checkout and preserve task ownership when bringing changes to Local.

Author: Retrivium editorial team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/learn-codex-worktree-handoff/
Language: en

A background worktree can produce a useful patch while the foreground checkout continues changing. Bringing that work back is therefore a state transition, not merely opening another directory. Codex’s documented Handoff workflow moves the conversation and code so work can continue in the selected checkout.

## Identify what the worktree was based on

The review starts with the selected starting branch or commit and the current worktree changes. A diff has meaning relative to a base. If the local checkout has advanced, the reviewer needs to distinguish the task’s edits from changes that occurred elsewhere. This makes it possible to discuss an actual integration conflict rather than treating every unfamiliar line as part of the agent’s patch.

## Inspect the intended scope of the diff

A focused task should leave a diff that can be explained through its requested behavior. Generated outputs can legitimately accompany a source change, but their relationship should be visible. In a schema update, identify the authoritative definition and the generated client. A reviewer can then assess whether both belong to the same change instead of accepting a large file count as an unavoidable property of agent work.

## Verify in the checkout that contains the change

Validation should run against the worktree’s actual files. A test executed in Local before Handoff may establish nothing about the background patch. Preserve the working directory and the relevant test target in the handoff record. If the local environment is the only place that can run a necessary integration check, make that remaining dependency explicit and complete it after the code arrives there.

## Account for ignored and environment-specific files

The documentation notes that ignored files do not generally move through Git Handoff unless the managed-worktree inclusion mechanism covers them. A local environment file or generated cache may therefore need separate preparation. Do not assume that a working background server proves the receiving checkout has the same supporting state. Compare the relevant setup requirements while keeping secrets and incidental caches outside the patch itself.

## Finish with a coherent ownership record

After Handoff, the continuing task should know which checkout owns its next edits and which evidence remains applicable. A short final record can name the patch, checks already run and any new combined-state check. This lets a human review or continue the work without guessing whether the background or local copy is authoritative. The result is a controlled continuation of the same task rather than competing copies of its state.

## Documentation and further study

- [Worktrees](https://learn.chatgpt.com/docs/environments/git-worktrees).

- [Codex as a platform: build on the open agent harness](https://developers.openai.com/blog/codex-as-a-platform).

- [Codex App Server](https://learn.chatgpt.com/docs/app-server).

Related engineering guides: [Reproducible inference stacks: preserving a GPU pilot’s result](/journal/software-stack-reproducibility/); [Choose a local AI stack: desktop chat, shared UI or coding agent](/journal/local-ai-app-stack-selection/).
