Fix bugs 2 and 3: agent panel expand and stale worktree references

Bug 2: Expand triangle now works when no agents are started - shows
"No agents started" message. AgentPanel moved to top of panels.

Bug 3: Run `git worktree prune` before `git worktree add` to clean
stale references from externally-deleted worktree directories.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dave
2026-02-20 13:17:20 +00:00
parent c6a04f5e53
commit 1eae2410f3
3 changed files with 93 additions and 10 deletions

View File

@@ -471,17 +471,23 @@ export function AgentPanel({ stories }: AgentPanelProps) {
>
<button
type="button"
onClick={() =>
onClick={() => {
const isExpanded =
expandedKey?.startsWith(`${story.story_id}:`) ||
expandedKey === story.story_id;
setExpandedKey(
expandedKey?.startsWith(`${story.story_id}:`)
isExpanded
? null
: (storyAgentEntries[0]?.[0] ?? story.story_id),
)
}
);
}}
onKeyDown={(e) => {
if (e.key === "Enter" || e.key === " ") {
const isExpanded =
expandedKey?.startsWith(`${story.story_id}:`) ||
expandedKey === story.story_id;
setExpandedKey(
expandedKey?.startsWith(`${story.story_id}:`)
isExpanded
? null
: (storyAgentEntries[0]?.[0] ?? story.story_id),
);
@@ -494,9 +500,11 @@ export function AgentPanel({ stories }: AgentPanelProps) {
cursor: "pointer",
fontSize: "0.8em",
padding: "0 4px",
transform: expandedKey?.startsWith(`${story.story_id}:`)
? "rotate(90deg)"
: "rotate(0deg)",
transform:
expandedKey?.startsWith(`${story.story_id}:`) ||
expandedKey === story.story_id
? "rotate(90deg)"
: "rotate(0deg)",
transition: "transform 0.15s",
}}
>
@@ -643,6 +651,21 @@ export function AgentPanel({ stories }: AgentPanelProps) {
)}
</div>
{/* Empty state when expanded with no agents */}
{expandedKey === story.story_id && storyAgentEntries.length === 0 && (
<div
style={{
borderTop: "1px solid #2a2a2a",
padding: "12px",
fontSize: "0.8em",
color: "#555",
textAlign: "center",
}}
>
No agents started. Use the Run button to start an agent.
</div>
)}
{/* Expanded detail per agent */}
{storyAgentEntries.map(([key, a]) => {
if (expandedKey !== key) return null;