Repository navigation
Show truthful agent activity without hiding notifications #10041
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
krandder
wants to merge
11
commits into
manaflow-ai:main
from
krandder:codex/cmux-group-agent-aggregate-current
Closed
Changes from 8 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7a46c82
test: cover structured agent sidebar previews
krandder 792805d
sidebar: show agent counts on collapsed groups
krandder f42d73c
sidebar: harden grouped agent aggregation
krandder 7355b34
sidebar: fix Xcode 26 warning
krandder b182bf1
test: cover agent notification preview suppression
krandder 7137684
sidebar: hide agent notification previews
krandder a42e57e
test: distinguish notifications from idle reminders
krandder 925292d
fix: keep notification truth separate from idle state
krandder b36069b
test: assert truthful idle and notification states
krandder 29cf858
test: require x marker for agent errors
krandder 3a71d45
fix: mark terminal agent errors with x
krandder File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
.../macOS/CmuxSidebar/Sources/CmuxSidebar/AgentActivity/SidebarAgentActivityAggregator.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| /// Aggregates immutable agent-activity values for sidebar presentation. | ||
| public struct SidebarAgentActivityAggregator: Sendable { | ||
| /// Creates an agent-activity aggregator. | ||
| public init() {} | ||
|
|
||
| /// Counts the highest-priority activity state already selected for each panel. | ||
| /// | ||
| /// - Parameter panelActivities: One activity value per panel. | ||
| /// - Returns: The number of running and needs-input panels. | ||
| public func counts<S: Sequence>(panelActivities: S) -> SidebarAgentActivityCounts | ||
| where S.Element == SidebarAgentPanelActivity { | ||
| panelActivities.reduce(into: SidebarAgentActivityCounts()) { counts, activity in | ||
| switch activity { | ||
| case .running: | ||
| counts.running += 1 | ||
| case .needsInput: | ||
| counts.needsInput += 1 | ||
| case .inactive: | ||
| break | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /// Combines workspace counts into a larger sidebar scope. | ||
| /// | ||
| /// - Parameter counts: Counts from the workspaces in the scope. | ||
| /// - Returns: The combined counts. | ||
| public func total<S: Sequence>(counts: S) -> SidebarAgentActivityCounts | ||
| where S.Element == SidebarAgentActivityCounts { | ||
| counts.reduce(SidebarAgentActivityCounts(), +) | ||
| } | ||
| } |
31 changes: 31 additions & 0 deletions
31
...ages/macOS/CmuxSidebar/Sources/CmuxSidebar/AgentActivity/SidebarAgentActivityCounts.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| /// Counts active agents by the state shown in the sidebar. | ||
| public struct SidebarAgentActivityCounts: Equatable, Hashable, Sendable { | ||
| /// The number of agents currently running. | ||
| public var running: Int | ||
|
|
||
| /// The number of agents waiting for user input. | ||
| public var needsInput: Int | ||
|
|
||
| /// Creates sidebar agent counts. | ||
| /// | ||
| /// - Parameters: | ||
| /// - running: The number of running agents. | ||
| /// - needsInput: The number of agents waiting for input. | ||
| public init(running: Int = 0, needsInput: Int = 0) { | ||
| self.running = running | ||
| self.needsInput = needsInput | ||
| } | ||
|
|
||
| /// Adds counts from two sidebar scopes. | ||
| /// | ||
| /// - Parameters: | ||
| /// - lhs: Counts from the first scope. | ||
| /// - rhs: Counts from the second scope. | ||
| /// - Returns: The combined counts. | ||
| public static func + (lhs: Self, rhs: Self) -> Self { | ||
| Self( | ||
| running: lhs.running + rhs.running, | ||
| needsInput: lhs.needsInput + rhs.needsInput | ||
| ) | ||
| } | ||
| } |
11 changes: 11 additions & 0 deletions
11
Packages/macOS/CmuxSidebar/Sources/CmuxSidebar/AgentActivity/SidebarAgentPanelActivity.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| /// The highest-priority active-agent state for one sidebar panel. | ||
| public enum SidebarAgentPanelActivity: Sendable { | ||
| /// At least one agent in the panel is running. | ||
| case running | ||
|
|
||
| /// At least one agent in the panel is waiting for user input. | ||
| case needsInput | ||
|
|
||
| /// The panel has no active agent state to count. | ||
| case inactive | ||
| } |
25 changes: 25 additions & 0 deletions
25
Packages/macOS/CmuxSidebar/Tests/CmuxSidebarTests/SidebarAgentActivityAggregatorTests.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import Testing | ||
|
|
||
| @testable import CmuxSidebar | ||
|
|
||
| @Suite("Sidebar agent activity aggregator") | ||
| struct SidebarAgentActivityAggregatorTests { | ||
| @Test func countsOneStatePerPanel() { | ||
| let counts = SidebarAgentActivityAggregator().counts(panelActivities: [ | ||
| .running, | ||
| .needsInput, | ||
| .inactive, | ||
| ]) | ||
|
|
||
| #expect(counts == .init(running: 1, needsInput: 1)) | ||
| } | ||
|
|
||
| @Test func combinesWorkspaceCounts() { | ||
| let counts = SidebarAgentActivityAggregator().total(counts: [ | ||
| SidebarAgentActivityCounts(running: 2), | ||
| SidebarAgentActivityCounts(running: 1, needsInput: 3), | ||
| ]) | ||
|
|
||
| #expect(counts == .init(running: 3, needsInput: 3)) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.