-
Notifications
You must be signed in to change notification settings - Fork 0
Description
The function ghFetchIssue in internal/project/workingmemory.go calls logFn unconditionally on any error from cmd.Output(), including the case where the gh binary is simply not installed.
Problem
// workingmemory.go:162
if err != nil {
logFn("[debug] gh issue fetch failed (issue #%d): %v", issueNumber, err)
return
}When gh is not in $PATH, cmd.Output() returns an *exec.Error wrapping exec.ErrNotFound. The code logs this at debug level, which triggers the logFn callback.
The existing test TestGhFetchIssue_GhUnavailable in internal/project/workingmemory_test.go:115 explicitly asserts that logFn is not called when gh is unavailable:
// workingmemory_test.go:133
if warned {
t.Error("logFn should not be called when gh is unavailable")
}Since the code does call logFn, this test fails.
The rationale in the test comment is correct: gh is an optional dependency; its absence should be silently ignored rather than generating noise in debug logs.
Fix
Check for exec.ErrNotFound before logging, and silently return if the binary is simply missing:
if err != nil {
var execErr *exec.Error
if errors.As(err, &execErr) && errors.Is(execErr.Err, exec.ErrNotFound) {
return // gh not installed — silently skip
}
logFn("[debug] gh issue fetch failed (issue #%d): %v", issueNumber, err)
return
}Location
internal/project/workingmemory.go:162(the unconditionallogFncall)internal/project/workingmemory_test.go:133(the assertion that is currently violated)
@claude please implement this