🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🐛 fix(agent-runtime): support slim compression payloads (#18587)
Arvin Xuc3ed4078e895
diff --git a/packages/agent-runtime/src/agents/GeneralChatAgent.ts b/packages/agent-runtime/src/agents/GeneralChatAgent.tsindex 883d920ae31..5e601ae6dd3 100644--- a/packages/agent-runtime/src/agents/GeneralChatAgent.ts+++ b/packages/agent-runtime/src/agents/GeneralChatAgent.ts@@ -911,7 +911,7 @@ export class GeneralChatAgent implements Agent {? { assistantMessageId: seededAssistantMessageId }: // Force create new assistant message after compression{ createAssistantMessage: true }),- messages: compressionPayload.compressedMessages,+ messages: compressionPayload.compressedMessages ?? state.messages,model: this.config.modelRuntimeConfig?.model,parentMessageId: compressionPayload.parentMessageId,provider: this.config.modelRuntimeConfig?.provider,diff --git a/packages/agent-runtime/src/agents/__tests__/GeneralChatAgent.test.ts b/packages/agent-runtime/src/agents/__tests__/GeneralChatAgent.test.tsindex 1fa5198d1b0..286ebe4a6b0 100644--- a/packages/agent-runtime/src/agents/__tests__/GeneralChatAgent.test.ts+++ b/packages/agent-runtime/src/agents/__tests__/GeneralChatAgent.test.ts@@ -2102,6 +2102,32 @@ describe('GeneralChatAgent', () => {});});+ it('should fall back to state messages when a new producer omits compressed messages', async () => {+ const agent = new GeneralChatAgent({+ agentConfig: { maxSteps: 100 },+ operationId: 'test-session',+ modelRuntimeConfig: mockModelRuntimeConfig,+ });+ const compressedMessages = [+ { content: 'Compressed summary', id: 'group-1', role: 'compressedGroup' },+ { content: 'Latest user follow-up', role: 'user' },+ ] as any;+ const state = createMockState({ messages: compressedMessages });+ const context = createMockContext('compression_result', {+ groupId: 'group-1',+ parentMessageId: 'assistant-msg-after-compression',+ });++ const result = await agent.runner(context, state);++ expect(result).toEqual(+ expect.objectContaining({+ payload: expect.objectContaining({ messages: compressedMessages }),+ type: 'call_llm',+ }),+ );+ });+// High-context tool-first resume: when the first post-tool turn compresses// before running, the seeded placeholder must still be reused after// compression rather than orphaned by createAssistantMessage.diff --git a/packages/agent-runtime/src/types/generalAgent.ts b/packages/agent-runtime/src/types/generalAgent.tsindex 4c4fb750889..a5c3646d757 100644--- a/packages/agent-runtime/src/types/generalAgent.ts+++ b/packages/agent-runtime/src/types/generalAgent.ts@@ -129,7 +129,7 @@ export interface GeneralAgentConfig {*/export interface GeneralAgentCompressionResultPayload {/** Compressed messages (summary + pinned + recent) */- compressedMessages: any[];+ compressedMessages?: any[];/** Compression group ID in database */groupId: string;/** Parent message ID for subsequent LLM call (last assistant message before compression) */