🤯 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): keep the builder's editing target on the run origin (#19868)
Innei66697a53a007
diff --git a/apps/server/src/modules/AgentRuntime/adapters/ServerToolTransport.ts b/apps/server/src/modules/AgentRuntime/adapters/ServerToolTransport.tsindex f22b4fa69fb..448e4137aa8 100644--- a/apps/server/src/modules/AgentRuntime/adapters/ServerToolTransport.ts+++ b/apps/server/src/modules/AgentRuntime/adapters/ServerToolTransport.ts@@ -218,8 +218,8 @@ export class ServerToolTransport implements ToolTransport {? isDeviceCapablePlan(context.state.plan?.execution): undefined,documentId: context.state.origin?.documentId,- editingAgentId: context.state.metadata?.editingAgentId,- editingGroupId: context.state.metadata?.editingGroupId,+ editingAgentId: context.state.origin?.editingAgentId,+ editingGroupId: context.state.origin?.editingGroupId,execSubAgent: this.ctx.execSubAgent,executionTimeoutMs: timeoutMs,groupId: context.state.origin?.groupId,diff --git a/apps/server/src/modules/AgentRuntime/adapters/serverCallLlmContextBuilder.ts b/apps/server/src/modules/AgentRuntime/adapters/serverCallLlmContextBuilder.tsindex bcfd8e269e8..c8733e01064 100644--- a/apps/server/src/modules/AgentRuntime/adapters/serverCallLlmContextBuilder.ts+++ b/apps/server/src/modules/AgentRuntime/adapters/serverCallLlmContextBuilder.ts@@ -97,8 +97,8 @@ export const buildServerCallLlmContext = async ({},agentId,disabledPluginIds: state.world?.disabledPluginIds,- editingAgentId: state.metadata?.editingAgentId as string | undefined,- editingGroupId: state.metadata?.editingGroupId as string | undefined,+ editingAgentId: state.origin?.editingAgentId,+ editingGroupId: state.origin?.editingGroupId,enabledToolIds: resolved.enabledToolIds,executionTarget,features: resolveServerConnectorFeatures(),diff --git a/apps/server/src/services/agentRuntime/AgentRuntimeService.test.ts b/apps/server/src/services/agentRuntime/AgentRuntimeService.test.tsindex 70b2eff30fd..13567e6a2f6 100644--- a/apps/server/src/services/agentRuntime/AgentRuntimeService.test.ts+++ b/apps/server/src/services/agentRuntime/AgentRuntimeService.test.ts@@ -549,6 +549,23 @@ describe('AgentRuntimeService', () => {});});+ it('freezes the builder editing target on the run origin', async () => {+ await service.createOperation({+ ...mockParams,+ appContext: {+ editingAgentId: 'agt_target',+ editingGroupId: 'grp_target',+ scope: 'agent_builder',+ },+ });++ const [, state] = mockCoordinator.saveAgentState.mock.calls[0];+ expect(state.origin).toMatchObject({+ editingAgentId: 'agt_target',+ editingGroupId: 'grp_target',+ });+ });+it('records the approval mode as a run policy', async () => {await service.createOperation({...mockParams,diff --git a/apps/server/src/services/agentRuntime/AgentRuntimeService.ts b/apps/server/src/services/agentRuntime/AgentRuntimeService.tsindex 92822414960..6aea7ff8225 100644--- a/apps/server/src/services/agentRuntime/AgentRuntimeService.ts+++ b/apps/server/src/services/agentRuntime/AgentRuntimeService.ts@@ -1094,6 +1094,8 @@ export class AgentRuntimeService {continuation: interventionResolution,defaultTaskAssigneeAgentId: appContext?.defaultTaskAssigneeAgentId,documentId: appContext?.documentId ?? undefined,+ editingAgentId: appContext?.editingAgentId,+ editingGroupId: appContext?.editingGroupId,groupId: appContext?.groupId ?? undefined,lineage: {isSubAgent: appContext?.isSubAgent,diff --git a/apps/server/src/services/agentRuntime/types.ts b/apps/server/src/services/agentRuntime/types.tsindex ef7c957b71e..398bbe17ebc 100644--- a/apps/server/src/services/agentRuntime/types.ts+++ b/apps/server/src/services/agentRuntime/types.ts@@ -428,6 +428,8 @@ export interface OperationCreationParams {clientIp?: string;defaultTaskAssigneeAgentId?: string;documentId?: string | null;+ editingAgentId?: string;+ editingGroupId?: string;groupId?: string | null;isSubAgent?: boolean;/**diff --git a/packages/agent-runtime/src/types/state.ts b/packages/agent-runtime/src/types/state.tsindex 51196b142e8..2053186cc94 100644--- a/packages/agent-runtime/src/types/state.ts+++ b/packages/agent-runtime/src/types/state.ts@@ -84,6 +84,10 @@ export interface AgentRunOrigin {/** Default assignee for tasks the run creates. */defaultTaskAssigneeAgentId?: string;documentId?: string;+ /** Agent a builder run configures; the run itself is owned by the builtin builder. */+ editingAgentId?: string;+ /** Group a group-builder run configures. */+ editingGroupId?: string;groupId?: string;// --- Run tree ---lineage?: AgentRunLineage;