You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
collectTouchedFiles includes failed/declined fileChange items and omits move_path destinations #846
collectTouchedFiles in plugins/codex/scripts/lib/codex.mjs derives touchedFiles (exposed by task --json and stored in jobs/<id>.json) from turnState.fileChanges. Currently it iterates over every completed fileChange notification item without checking fileChange.status, and only reads change.path.
Per the generated codex app-server v2 types (v2/ThreadItem.ts, v2/PatchApplyStatus.ts, v2/PatchChangeKind.ts):
fileChange.status is "inProgress" | "completed" | "failed" | "declined". When a patch fails to apply or is declined by sandbox/approval policy, item/completed still fires with status: "failed" or status: "declined", and collectTouchedFiles falsely reports those untouched paths in touchedFiles.
change.kind for moved/renamed files is { type: "update", move_path: string | null }. collectTouchedFiles records the old change.path but drops change.kind.move_path.
Reproduction
Run codex-companion.mjs task --write --json against an app-server turn that emits:
an item/completedfileChange with status: "declined" or status: "failed" for src/untouched.js, and
an item/completedfileChange with status: "completed" and changes: [{ path: "src/old.js", kind: { type: "update", move_path: "src/new.js" }, diff: "" }].
Inspect touchedFiles in the JSON output.
Actual
touchedFiles contains ["src/untouched.js", "src/old.js"] (includes the failed/declined patch target and omits "src/new.js").
Expected
touchedFiles should include only paths from fileChange items with status === "completed", and include change.kind.move_path when an update moves/renames a file (["src/old.js", "src/new.js"]).
Activity