{"record":{"id":"fd3628f389f6d58f","repo":"ruvnet/ruflo","slug":"git-status-reported-changes-that-exact-state-captu","errorCode":null,"errorMessage":"Git status reported changes that exact-state capture could not identify","messagePattern":"Git status reported changes that exact-state capture could not identify","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/codex/src/harness/repository-state.ts","lineNumber":460,"sourceCode":"      baseCommit,\n      treeId,\n      sourceStateId: digest(canonicalJson(identity)),\n    };\n  }\n\n  repositoryPaths(repoRoot, true);\n  const first = captureContentState(repoRoot);\n  const second = captureContentState(repoRoot);\n  if (canonicalJson(first) !== canonicalJson(second)) {\n    throw new Error('repository changed while capturing exact source state');\n  }\n\n  const repository = repositoryIdentity(repoRoot);\n  const dirty = second.trackedPatch.bytes > 0\n    || second.untrackedManifest.entries.length > 0\n    || second.submodules.some(hasDirtySubmodule);\n\n  if (!dirty) throw new Error('Git status reported changes that exact-state capture could not identify');\n\n  const identity = {\n    version: 1,\n    scope: 'git-visible',\n    repositoryId: repository.repositoryId,\n    baseCommit: second.baseCommit,\n    tree: second.treeId,\n    trackedPatch: second.trackedPatch,\n    untrackedManifest: second.untrackedManifest,\n    submodules: second.submodules,\n  };\n  return {\n    version: 1,\n    scope: 'git-visible',\n    kind: 'dirty',\n    clean: false,\n    repository,\n    baseCommit: second.baseCommit,","sourceCodeStart":442,"sourceCodeEnd":478,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/codex/src/harness/repository-state.ts#L442-L478","documentation":"The porcelain status was non-empty, yet the exact-state capture found nothing dirty: no tracked patch bytes, no untracked manifest entries, no dirty submodules. Rather than emit a sourceStateId for an unattributable state, the harness throws. It is a consistency guarantee between `git status` and the content-level capture.","triggerScenarios":"Stat-dirty files: mtime/inode changes with identical content so `git status` reports modified but `git diff --binary` is empty; submodule status noise (modified config vs content); racy-git after checkouts or touches; files ignored by diff drivers.","commonSituations":"Running `touch src/**` or a checkout that rewrites mtimes right before capture; submodules whose status differs only by config (ignore=dirty settings); CI caching that restores mtimes incorrectly.","solutions":["Run `git update-index --refresh` (or a no-op `git status` then `git diff`) to settle stat info, then retry","Check submodule noise: `git submodule status` and diff `git config -f .gitmodules`","If a submodule is only config-dirty, set `submodule.<name>.ignore = dirty` or commit the submodule pointer change"],"exampleFix":"# settle racy stat info, then re-capture\ngit update-index --refresh || true\ngit status --porcelain  # should now match actual content\n# re-run the capture command","handlingStrategy":"validation","validationCode":"import { execSync } from 'node:child_process';\nexecSync('git update-index -q --refresh', { cwd: root });\nconst status = execSync('git status --porcelain', { cwd: root, encoding: 'utf8' });\nconst diff = execSync('git diff --binary --full-index HEAD', { cwd: root, encoding: 'buffer' });\nconst attributable = diff.length > 0 || /\\?\\?/.test(status);","typeGuard":null,"tryCatchPattern":"try { return capture(root); }\ncatch (e) {\n  if (/could not identify/.test(String(e))) { execSync('git update-index --refresh', { cwd: root }); return capture(root); }\n  throw e;\n}","preventionTips":["Run `git update-index --refresh` after checkouts/touches before capturing","Set submodule ignore=dirty for config-only-dirty submodules or commit pointer changes","Avoid touching files (mtime churn) right before snapshots"],"tags":["git","status-inconsistency","racy-git","harness"],"backgroundTag":"git-status-inconsistency","analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}