verify-Codex-run-commit-vs-working-tree-before-closing

After a Codex implementation run, verify the claimed file set against the actual commit and working tree before treating the issue as fully complete.

5 stars

Best use case

verify-Codex-run-commit-vs-working-tree-before-closing is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

After a Codex implementation run, verify the claimed file set against the actual commit and working tree before treating the issue as fully complete.

Teams using verify-Codex-run-commit-vs-working-tree-before-closing should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/verify-claude-run-commit-vs-working-tree-before-closing/SKILL.md --create-dirs "https://raw.githubusercontent.com/vamseeachanta/workspace-hub/main/.agents/skills/workspace-hub/verify-claude-run-commit-vs-working-tree-before-closing/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/verify-claude-run-commit-vs-working-tree-before-closing/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How verify-Codex-run-commit-vs-working-tree-before-closing Compares

Feature / Agentverify-Codex-run-commit-vs-working-tree-before-closingStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

After a Codex implementation run, verify the claimed file set against the actual commit and working tree before treating the issue as fully complete.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Verify Codex run commit vs working tree before closing

## When to use

Use this after a Codex implementation run that claims:
- files were changed and committed
- a GitHub issue was commented/closed
- verification passed

Especially important when:
- the repo has many unrelated dirty files
- pre-commit or repo-specific hooks may reject some paths
- Codex reports that some changes were applied but not committed
- the issue was closed automatically by the worker

## Why this skill exists

A Codex implementation run can successfully commit and close an issue while still leaving intended edits in the working tree.
Observed failure mode:
- Codex edited the target files
- some files were blocked from commit by repo rules / hooks / file policies
- Codex still posted a success comment and closed the issue
- the uncommitted delta remained in the working tree

This means "issue closed" is not sufficient evidence that all intended changes landed.

## Required checks

After the run finishes, do all of these before declaring success:

1. Inspect the commit Codex claims landed
```bash
git show --stat --name-only <commit>
```

2. Verify the commit landed in the intended checkout / branch, not just somewhere in the repo ecosystem
```bash
git rev-parse --show-toplevel
git branch --show-current
git branch --contains <commit>
```
- if you launched Codex from an isolated worktree, confirm the commit is actually on that worktree branch
- do not assume `workdir=` or prompt text was sufficient protection
- if the commit landed on another local branch / checkout (for example dirty `main`) treat the worker result as only partially integrated

3. Compare that file list against the files Codex claimed to have changed in its final summary
- look for any claimed files missing from the commit stat

4. Inspect current working tree for owned-path leftovers
```bash
git status --short
```
- look specifically for files owned by the executed issue
- ignore unrelated dirty files outside the issue's owned paths

5. If a claimed file is still modified after the run:
- read it and confirm whether the intended change is present only in the working tree
- decide whether to:
  - make a tiny fixup commit, or
  - reopen the issue and finish properly

6. Verify GitHub closeout state
- read the latest issue comments
- check whether the issue is open/closed
- if closed with residual owned-path changes still uncommitted, treat the closeout as incomplete
- if the issue comment says work landed in the isolated branch but the commit actually landed on another checkout, post a correction/update before closeout

## Recovery pattern when commit lands in the wrong checkout

Observed failure mode:
- Codex was launched from an isolated worktree
- Codex reported success and produced a valid commit
- the commit actually landed on local `main` instead of the intended issue worktree branch
- the intended worktree remained unchanged

Safe recovery:
1. identify the real landed commit hash
2. verify the diff and tests in the checkout where it actually landed
3. cherry-pick that exact commit into the intended clean worktree/branch
4. re-run the targeted validation in the intended worktree
5. treat the clean worktree commit as the authoritative execution result for push/closeout

This is distinct from the older “residual dirty files” failure mode: the code may be correct, but it is landed in the wrong branch context and must be re-homed before integration/closeout.
## Decision rules

### Case A — clean success
Criteria:
- all claimed files appear in the commit
- no owned-path files remain dirty
- issue comment matches actual commit
Action:
- accept the run as complete

### Case B — partial landing with residual owned-path edits
Criteria:
- some claimed files are not in the commit
- those files remain modified in the working tree
- issue may already be closed
Action:
- do NOT assume full completion
- create a tiny follow-up commit for the missing owned-path files, OR reopen the issue if the gap is material
- document the discrepancy in the next GitHub comment

### Case C — false success comment
Criteria:
- worker claimed success but commit does not contain the core deliverable
Action:
- reopen or continue the issue immediately
- do not treat the run as landed

## Recommended workflow

1. Capture Codex’s reported outputs:
- commit hash
- changed file list
- GitHub comment URL
- issue closed/open status

2. Run:
```bash
git show --stat --name-only <commit>
git status --short
gh issue view <issue> --json state,comments
```

3. Compare three surfaces:
- Codex summary
- actual commit contents
- residual working tree state

4. Only then decide whether the implementation is truly done.

## Workspace-hub-specific lessons

In workspace-hub, this matters when:
- docs or generated files violate local repo conventions
- some wiki/domain files are already oversized or shaped in ways that trip repo expectations
- the run stages only a subset of the owned-path edits
- a Codex run launched from an isolated worktree may still create the commit on an unexpected local branch / checkout, even when the orchestrator passed the intended worktree as cwd

Concrete example pattern A:
- worker committed 10 files
- claimed 12 intended updates
- 2 wiki `AGENTS.md` files were still modified in working tree
- issue was already closed
- correct response was to treat the issue as substantially complete but with a small residual follow-up

Concrete example pattern B:
- orchestrator launched `Codex -p` from a clean issue worktree
- Codex reported success and a commit hash
- the intended issue worktree branch did **not** move
- the reported commit actually landed on the dirty local `main` checkout instead
- correct response was:
  1. verify the reported commit hash really contains the claimed file set
  2. confirm which branch/worktree actually contains that commit
  3. cherry-pick the validated commit into the clean execution worktree
  4. re-run the targeted tests in the clean worktree
  5. treat the clean worktree commit as the authoritative execution artifact for push/closeout

Add these checks when the worker was supposed to run in an isolated worktree:
- `git branch --contains <commit>` from the parent repo
- `git log --oneline -3` in both the intended worktree and the default/main checkout
- verify the expected issue branch tip actually advanced

If the commit landed on the wrong local branch but the diff/tests are valid, prefer cherry-picking into the clean worktree over trying to salvage closeout directly from the dirty checkout.
If the commit landed on the wrong local branch but the diff/tests are valid, prefer cherry-picking into the clean worktree over trying to salvage closeout directly from the dirty checkout.

## Separate remote landing from parent-checkout state

Another live-use failure mode:
- Codex runs in a clean issue worktree
- the commit is pushed successfully to `origin/main`
- GitHub issues auto-close correctly
- but the user's current parent checkout (`/mnt/local-analysis/workspace-hub`) is still dirty and remains one commit behind remote main

This is easy to misreport as "everything is updated locally" when only the remote and worker branch are updated.

Required post-push checks when working from a side worktree:
1. verify the push target really contains the commit
```bash
git fetch origin
git rev-parse <commit>
git rev-parse origin/main
git branch --contains <commit>
```
2. separately inspect the parent/default checkout state
```bash
cd <parent-checkout>
git status --short
git rev-list --left-right --count HEAD...origin/main
```
3. report these as two different truths:
- `remote landed state` (did the change reach `origin/main`?)
- `current local checkout state` (is the user's working checkout updated/clean?)

Decision rule:
- if remote landed but parent checkout is dirty/behind, do **not** say the repo is fully synced locally
- say the implementation landed remotely and the parent checkout still needs an explicit sync/reconciliation step
- avoid auto-pulling into a dirty parent checkout unless the user asked for that reconciliation work

## Output template for post-run review

Use this structure when reporting your verification:

- Commit landed: `<hash>`
- Issue state: open/closed
- Claimed changed files: N
- Actually committed files: N
- Residual owned-path files still dirty: list or none
- Verdict: complete / substantially complete with follow-up / incomplete
- Next action: none / tiny fixup commit / reopen and continue

## Pitfalls

- Trusting the worker’s final summary without checking `git show`
- Looking only at `git status` and not the actual commit
- Missing residual issue-owned files because the repo has lots of unrelated dirt
- Treating an auto-closed issue as authoritative proof of completeness

## Minimal command set

```bash
git show --stat --name-only <commit>
git status --short
gh issue view <issue> --json state,comments
```

Use this every time a Codex run claims success on a dirty repo.

Related Skills

digitalmodel-worktree-test-execution-with-shared-venv

5
from vamseeachanta/workspace-hub

Run digitalmodel tests from isolated worktrees without uv editable-dependency failures by using the main repo's existing virtualenv and PYTHONPATH.

blender-worktree-test-hardening

5
from vamseeachanta/workspace-hub

Recover and harden digitalmodel Blender automation work in isolated worktrees when uv/editable dependency paths break and local machines lack a Blender executable.

worktree-pre-push-bypass-for-tier1-checks

5
from vamseeachanta/workspace-hub

Handle workspace-hub integration-branch pushes from isolated git worktrees when the pre-push hook incorrectly assumes sibling tier-1 repos exist under the worktree path.

worktree-branch-sync-hygiene

5
from vamseeachanta/workspace-hub

Class-level branch, worktree, dirty-main, stash, sync, and hook hygiene for workspace-hub style multi-repo work.

staged-issue-tree-creation-with-deduplication

5
from vamseeachanta/workspace-hub

Pattern for creating hierarchical GitHub issue trees from phased project plans while checking for duplicate/overlapping issues

git-worktree-cleanup-at-scale

5
from vamseeachanta/workspace-hub

Identify and remove stale git worktrees blocking branch deletion in multi-repo environments

git-worktree-cleanup-and-branch-reconciliation

5
from vamseeachanta/workspace-hub

Systematic process for cleaning up stale git worktrees, resolving merge conflicts in diverged branches, and reconciling branch state across multiple repositories.

git-worktree-cleanup-and-branch-hygiene

5
from vamseeachanta/workspace-hub

Systematic approach to cleaning up stale git worktrees, orphan branches, and branch hygiene at scale across multiple repos

extract-skills-from-Codex-sessions

5
from vamseeachanta/workspace-hub

Automatically extract reusable skills from Codex session transcripts using LLM analysis and wire them into a Stop hook

evaluate-local-commits-via-cherry-pick-dry-run

5
from vamseeachanta/workspace-hub

Technique to identify which ahead commits contain real changes vs. already-merged or ephemeral content

adversarial-code-review-for-committed-diffs

5
from vamseeachanta/workspace-hub

Systematic process for reviewing already-committed code changes to catch type inconsistencies, edge cases, and docstring gaps

learned-git-worktree-hook-path-and-real-hook-shape-review

5
from vamseeachanta/workspace-hub

Catch hook-installation and governance bugs that only appear in linked git worktrees or against the real generated hook shape, not simplified test fixtures.