Skip to content

Add TaskGroup feature#1072

Merged
toubatbrian merged 9 commits intomainfrom
brian/task-group
Feb 24, 2026
Merged

Add TaskGroup feature#1072
toubatbrian merged 9 commits intomainfrom
brian/task-group

Conversation

@toubatbrian
Copy link
Contributor

@toubatbrian toubatbrian commented Feb 24, 2026

Add TaskGroup as well as it's dependent features:

  • ChatContext._summarize
  • agent.updateTools
  • ToolFlags

@changeset-bot
Copy link

changeset-bot bot commented Feb 24, 2026

🦋 Changeset detected

Latest commit: 908aab7

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@toubatbrian toubatbrian requested a review from a team February 24, 2026 03:05
chatgpt-codex-connector[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

Copy link
Member

@theomonnom theomonnom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🏎️ speed!

Comment on lines +825 to +843
const promptCtx = new ChatContext();
promptCtx.addMessage({
role: 'system',
content:
'Compress older chat history into a short, faithful summary.\n' +
'Focus on user goals, constraints, decisions, key facts/preferences/entities, and pending tasks.\n' +
'Exclude chit-chat and greetings. Be concise.',
});
promptCtx.addMessage({
role: 'user',
content: `Conversation to summarize:\n\n${sourceText}`,
});

const chunks: string[] = [];
for await (const chunk of llm.chat({ chatCtx: promptCtx })) {
if (chunk.delta?.content) {
chunks.push(chunk.delta.content);
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need it for now, but I also added a better way to call LLMs on Python
livekit/agents#4680

@toubatbrian toubatbrian merged commit b11c863 into main Feb 24, 2026
7 checks passed
@toubatbrian toubatbrian deleted the brian/task-group branch February 24, 2026 22:27
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

View 16 additional findings in Devin Review.

Open in Devin Review

Comment on lines +860 to +864
}

if (it.type === 'message' && (it.role === 'user' || it.role === 'assistant')) {
continue;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 _summarize unconditionally drops existing summary messages and non-text user/assistant messages

The filtering loop at lines 862-864 removes ALL ChatMessage items with role user or assistant, regardless of whether they were part of the summarized head or preserved tail. Only tail messages are re-inserted at line 881. This silently drops:

Detailed explanation of lost messages
  1. Existing summary messages (extra.is_summary === true): These are excluded from toSummarize at line 789, so they're NOT in head or tail. But they ARE assistant messages, so they're removed at line 862 and never re-inserted. Their content is also NOT included in sourceText for the new summary.

  2. User/assistant messages with only non-text content (e.g., images): textContent returns undefined for these, so (item.textContent ?? '').trim() is empty, excluding them from toSummarize (line 792). They're removed at line 862 but never re-inserted.

Calling _summarize twice on the same context causes the first summary to be silently lost without its content being incorporated into the second summary. The fix should either preserve items with extra?.is_summary === true in the preserved array, or include them in the summarization input.

Impact: If _summarize is ever called more than once on the same ChatContext (e.g., incremental summarization), previously summarized information is permanently lost.

Suggested change
}
if (it.type === 'message' && (it.role === 'user' || it.role === 'assistant')) {
continue;
}
if (it.type === 'message' && (it.role === 'user' || it.role === 'assistant') && it.extra?.is_summary !== true) {
continue;
}
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants