story-kit: merge 143_story_remove_0_running_count_from_agents_panel_header

This commit is contained in:
Dave
2026-02-24 13:59:10 +00:00
parent 4f1c458772
commit 41d86d29d0
2 changed files with 57 additions and 10 deletions

View File

@@ -70,6 +70,47 @@ describe("AgentPanel active work list removed", () => {
}); });
}); });
describe("Running count visibility in header", () => {
beforeAll(() => {
Element.prototype.scrollIntoView = vi.fn();
});
beforeEach(() => {
mockedAgents.getAgentConfig.mockResolvedValue(ROSTER);
mockedAgents.listAgents.mockResolvedValue([]);
});
// AC1: When no agents are running, "0 running" is NOT visible
it("does not show running count when no agents are running", async () => {
render(<AgentPanel />);
// Wait for roster to load
await screen.findByTestId("roster-badge-coder-1");
expect(screen.queryByText(/0 running/)).not.toBeInTheDocument();
});
// AC2: When agents are running, "N running" IS visible
it("shows running count when agents are running", async () => {
const agentList: AgentInfo[] = [
{
story_id: "99_active",
agent_name: "coder-1",
status: "running",
session_id: null,
worktree_path: "/tmp/wt",
base_branch: "master",
log_session_id: null,
},
];
mockedAgents.listAgents.mockResolvedValue(agentList);
render(<AgentPanel />);
await screen.findByText(/1 running/);
});
});
describe("RosterBadge availability state", () => { describe("RosterBadge availability state", () => {
beforeAll(() => { beforeAll(() => {
Element.prototype.scrollIntoView = vi.fn(); Element.prototype.scrollIntoView = vi.fn();

View File

@@ -268,16 +268,22 @@ export function AgentPanel({ configVersion = 0 }: AgentPanelProps) {
}} }}
> >
<div style={{ fontWeight: 600 }}>Agents</div> <div style={{ fontWeight: 600 }}>Agents</div>
<div {Object.values(agents).filter((a) => a.status === "running").length >
style={{ 0 && (
fontSize: "0.75em", <div
color: "#777", style={{
fontFamily: "monospace", fontSize: "0.75em",
}} color: "#777",
> fontFamily: "monospace",
{Object.values(agents).filter((a) => a.status === "running").length}{" "} }}
running >
</div> {
Object.values(agents).filter((a) => a.status === "running")
.length
}{" "}
running
</div>
)}
</div> </div>
{lastRefresh && ( {lastRefresh && (
<div style={{ fontSize: "0.7em", color: "#555" }}> <div style={{ fontSize: "0.7em", color: "#555" }}>