fix: prevent closing issues with open blockers (GH#962)

Added IsBlocked method to Storage interface that checks if an issue is
in the blocked_issues_cache and returns the blocking issue IDs.

The close command now checks for blockers before allowing an issue to
be closed:
- If an issue has open blockers, closing is blocked with an error message
- The --force flag overrides this check
- Works in both daemon mode (RPC) and direct storage mode
- Also handles cross-rig routed IDs

This addresses the bug where agents could close a bead even when it
depends on an open bug/issue.

Closes #962

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
fang
2026-01-09 22:56:56 -08:00
committed by Steve Yegge
parent 0933bf5eda
commit a851104203
8 changed files with 175 additions and 0 deletions

View File

@@ -1281,6 +1281,19 @@ func (m *MemoryStorage) GetBlockedIssues(ctx context.Context, filter types.WorkF
return results, nil
}
// IsBlocked checks if an issue is blocked by open dependencies (GH#962).
// Returns true if the issue has open blockers, along with the list of blocker IDs.
func (m *MemoryStorage) IsBlocked(ctx context.Context, issueID string) (bool, []string, error) {
m.mu.RLock()
defer m.mu.RUnlock()
blockers := m.getOpenBlockers(issueID)
if len(blockers) == 0 {
return false, nil, nil
}
return true, blockers, nil
}
// getAllDescendants returns all descendant IDs of a parent issue recursively
func (m *MemoryStorage) getAllDescendants(parentID string) map[string]bool {
descendants := make(map[string]bool)