Filter active agents from resume list

This commit is contained in:
Mohamed Boudra
2025-11-15 12:49:19 +01:00
parent 3ba748ce7c
commit b5daa1fa66
2 changed files with 19 additions and 3 deletions

View File

@@ -98,7 +98,7 @@ export function CreateAgentModal({
const isCompactLayout = screenWidth < 720;
const { recentPaths, addRecentPath } = useRecentPaths();
const { ws, createAgent, resumeAgent } = useSession();
const { ws, createAgent, resumeAgent, agents } = useSession();
const router = useRouter();
const [isMounted, setIsMounted] = useState(isVisible);
@@ -143,10 +143,24 @@ export function CreateAgentModal({
);
const agentDefinition = providerDefinitionMap.get(selectedProvider);
const modeOptions = agentDefinition?.modes ?? [];
const activeSessionIds = useMemo(() => {
const ids = new Set<string>();
agents.forEach((agent) => {
if (agent.sessionId) {
ids.add(agent.sessionId);
}
const persistedSessionId = agent.persistence?.sessionId;
if (persistedSessionId) {
ids.add(persistedSessionId);
}
});
return ids;
}, [agents]);
const filteredResumeCandidates = useMemo(() => {
const providerFilter = resumeProviderFilter;
const query = resumeSearchQuery.trim().toLowerCase();
return resumeCandidates
.filter((candidate) => !activeSessionIds.has(candidate.sessionId))
.filter((candidate) => providerFilter === "all" || candidate.provider === providerFilter)
.filter((candidate) => {
if (query.length === 0) {
@@ -157,7 +171,7 @@ export function CreateAgentModal({
return titleText.includes(query) || cwdText.includes(query);
})
.sort((a, b) => b.lastActivityAt.getTime() - a.lastActivityAt.getTime());
}, [resumeCandidates, resumeProviderFilter, resumeSearchQuery]);
}, [activeSessionIds, resumeCandidates, resumeProviderFilter, resumeSearchQuery]);
useEffect(() => {
if (!agentDefinition) {

View File

@@ -15,6 +15,8 @@
- Normalized `todo` timeline entries into a dedicated `todo_list` stream item, rendered them with a new plan card in the agent stream (provider badge, completion status, checkboxes), and added consolidation logic plus regression coverage in `test-idempotent-stream.ts`. Ran `npm run typecheck --workspace=@voice-dev/app`.
- [x] Change "Refresh from disk" to "Refresh" in the agent three dot menu
- Updated the agent overflow menu label in `packages/app/src/app/agent/[id].tsx` so the refresh action now matches the desired wording while keeping the busy state text untouched; no additional changes were required.
- [ ] Are we filtering our own shats (already present in agents storage) from the resume agent list? We should if not.
- [x] Are we filtering our own shats (already present in agents storage) from the resume agent list? We should if not.
- Resume tab now filters out persisted sessions whose session ids match any active agent (live session id or persisted handle) to avoid duplicate entries; verified via `npm run typecheck --workspace=@voice-dev/app`.
- [ ] Getting "two children with the same key" for "thoughts" and "assistant" review our keying strategy, and make it more robust and performant, and stable.
- [ ] Hydrated session show previous tool calls as loading. At least for claude we're not loading the output Chekc Codex too.
- [ ] Add agent type indicator in the agent list, so we can quickly identify the agent type (Claude, Codex, etc.). On the left of the status pill.