Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Sources/KanbanCodeCore/UseCases/AssignColumn.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ public enum AssignColumn {
// Only .activelyWorking should keep a card in In Progress.
return .waiting
case .ended:
if hasWorktree { return .waiting }
// No worktree: fall through to recency check below
// Finished assistant sessions should leave the triage lanes.
// PR cards are handled above, and genuinely idle sessions use
// `.needsAttention` or `.idleWaiting`.
return .allSessions
case .stale:
break // No hook data: fall through to recency check below
}
Expand Down
8 changes: 4 additions & 4 deletions Tests/KanbanCodeCoreTests/AssignColumnTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ struct AssignColumnTests {
#expect(col == .waiting)
}

@Test("Ended with worktree → waiting")
@Test("Ended with worktree → allSessions")
func endedWithWorktree() {
let link = Link(sessionLink: SessionLink(sessionId: "s1"))
let col = AssignColumn.assign(link: link, activityState: .ended, hasWorktree: true)
#expect(col == .waiting)
#expect(col == .allSessions)
}

@Test("Stale + recent → waiting (falls through to recency check)")
Expand All @@ -126,11 +126,11 @@ struct AssignColumnTests {
#expect(col == .allSessions)
}

@Test("Ended without worktree, recent → waiting")
@Test("Ended without worktree, recent → allSessions")
func endedNoWorktreeRecent() {
let link = Link(lastActivity: Date.now.addingTimeInterval(-3600), sessionLink: SessionLink(sessionId: "s1"))
let col = AssignColumn.assign(link: link, activityState: .ended)
#expect(col == .waiting)
#expect(col == .allSessions)
}

@Test("Ended without worktree, old → allSessions")
Expand Down
4 changes: 2 additions & 2 deletions Tests/KanbanCodeCoreTests/CardLifecycleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ struct CardLifecycleTests {
#expect(link.column == .done)
}

@Test("Ended session with worktree → waiting")
@Test("Ended session with worktree → allSessions")
func endedWithWorktree() {
var link = Link(
column: .inProgress,
sessionLink: SessionLink(sessionId: "s1"),
worktreeLink: WorktreeLink(path: "", branch: "feature-x")
)
UpdateCardColumn.update(link: &link, activityState: .ended, hasWorktree: true)
#expect(link.column == .waiting)
#expect(link.column == .allSessions)
}

@Test("Stale session → allSessions")
Expand Down