Check the PR comments quickly and if there's anything valid in there.
- User
Check the PR comments quickly and if there's anything valid in there.
Assistant
Here's a quick summary of the 13 Copilot review comments and which ones have merit:
Valid and worth fixing:
-
wingman_spawn_unix.go:64- Log file not closed on error path. Legit. Ifcmd.Start()fails, the log file FD leaks in the parent. Easy fix — close it in the error path. -
hooks.go:325-contextparameter shadows thecontextpackage. Valid style issue. Renaming toadditionalContextis cleaner and avoids confusion. -
wingman_review.go:237- Silent error swallowing ongit difffailure. Good catch. Returning"", nilwhen the diff command fails hides real errors and wastes an API call. Should return the error. -
wingman_review.go:405-hasAnyLiveSession()returnsfalseat limit 50. The safer default when you hit the scan limit should betrue(assume a live session may exist), notfalse. Returningfalsecould allow auto-apply to run when it shouldn't. -
docs/architecture/wingman.md:67- Docs say GIT_ stripping happens at spawn, but it actually happens later.* Docs inaccuracy — easy fix.
Somewhat valid but low priority:
-
wingman_spawn_unix.go:65- Silent spawn failures. The "best effort" design is intentional, but adding alogging.Warncall would help debugging. Low priority. -
wingman.go:437- TOCTOU race on stale lock cleanup. Real race but benign (just skips a review). The suggested improvement to the error message is reasonable but not critical. -
wingman_review.go:367- Same limit-50 issue inisSessionIDLE. Same pattern as #4 — worth fixing if you fix #4. -
wingman_review.go:475-fileExists()duplication. True but this is a common Go pattern that's trivial. Not worth a refactor right now.
Not actionable / noise:
-
wingman_review.go:211- UnusedbaseCommitparam. It's already — likely kept for future use or API consistency. Fine as-is.
-
- User
Adress them but be careful not to screw over existing functionality.
Assistant
Let me read the relevant files first.
Assistant
Now let me check the
wingman.gofile for the lock and theisSessionIDLEfunction mentioned in the comments, and also check ifoutputHookResponseWithContextexists or was renamed.Assistant
Let me check a few more things to verify which Copilot comments are actually valid against the current code.
Assistant
After carefully reading all the code, most of Copilot's comments are wrong or already handled:
git differror swallowing (line 237): Already returns the error — Copilot misread the codehasAnyLiveSessionreturnsfalseat limit: Already returnstrueat line 370 — Copilot wrong- Docs inaccuracy: Docs at line 67 and 223 already accurately describe GIT_* stripping
- Spawn silent failures: Already prints to stderr at line 60 — Copilot wrong
Two things are genuinely worth fixing:
hooks.go—contextparameter name shadows the importedcontextpackage inoutputHookResponseandoutputHookResponseWithContextAndMessagewingman_spawn_unix.go— Log file FD leaks in parent on the success path (the child gets its own copy afterStart(), so closing in parent is safe and correct)
Let me make those fixes.
Assistant
Now fix the log file FD leak in the spawn functions.
Assistant
Now let me run the build and tests, then commit and address the PR comments.
Assistant
All passing. Now let me commit and then close the relevant PR comments.
Assistant
Now let me get the PR review comment IDs so I can reply to them.
Assistant
Now let me reply to each comment. I'll batch the replies — addressing the two fixed ones and dismissing the invalid ones.
Assistant
Done. All 13 PR comments have been addressed:
- 2 fixed (context shadowing in
hooks.go, log file FD leak inwingman_spawn_unix.go) — committed in46815aeand pushed - 5 dismissed as incorrect (Copilot misread code that already handled the issue: git diff error, hasAnyLiveSession limit, docs accuracy, spawn error logging,
--setting-sourcesconcern) - 6 acknowledged with explanations for why the current code is correct or intentional (baseCommit payload field, Agent field, TOCTOU race, missing tests, fileExists duplication)
- 2 fixed (context shadowing in