π€― 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
β»οΈ refactor: replace LOBE-XXX markers with contextual comments (2026-06-29) (#16407)
Arvin Xu601622326fa4
diff --git a/apps/server/src/modules/AgentRuntime/AgentStateManager.ts b/apps/server/src/modules/AgentRuntime/AgentStateManager.tsindex 6f117d9634b..360d29ca82c 100644--- a/apps/server/src/modules/AgentRuntime/AgentStateManager.ts+++ b/apps/server/src/modules/AgentRuntime/AgentStateManager.ts@@ -25,9 +25,9 @@ export interface AgentOperationMetadata {/*** When set, the Gateway stream notifier mirrors this operation's stream events* onto the named operation's Gateway channel as well (single-connection- * multiplexing, LOBE-10868). Used so a broadcast member's streaming events- * also flow down the supervisor's existing WebSocket β the supervisor's own- * operationId β instead of stranding on a member channel nobody subscribes to.+ * multiplexing). Used so a broadcast member's streaming events also flow down+ * the supervisor's existing WebSocket β the supervisor's own operationId β+ * instead of stranding on a member channel nobody subscribes to.*/mirrorToOperationId?: string;modelRuntimeConfig?: any;diff --git a/apps/server/src/modules/AgentRuntime/GatewayStreamNotifier.ts b/apps/server/src/modules/AgentRuntime/GatewayStreamNotifier.tsindex 2786c371099..466831e346c 100644--- a/apps/server/src/modules/AgentRuntime/GatewayStreamNotifier.ts+++ b/apps/server/src/modules/AgentRuntime/GatewayStreamNotifier.ts@@ -31,7 +31,7 @@ export class GatewayStreamNotifier implements IStreamEventManager {* supervisor op), every Gateway push for that operation is additionally* delivered to the mirror op's channel β so member streaming events ride down* the supervisor's single WebSocket instead of stranding on a per-member- * channel nobody subscribes to (single-connection multiplexing, LOBE-10868).+ * channel nobody subscribes to (single-connection multiplexing).** Two population paths, so this works both in-process AND across queue workers:* - fast path: set at `publishAgentRuntimeInit` from the initial state (thediff --git a/apps/server/src/services/agentRuntime/AgentRuntimeService.ts b/apps/server/src/services/agentRuntime/AgentRuntimeService.tsindex b89304f2e7a..136924ccdfe 100644--- a/apps/server/src/services/agentRuntime/AgentRuntimeService.ts+++ b/apps/server/src/services/agentRuntime/AgentRuntimeService.ts@@ -528,7 +528,7 @@ export class AgentRuntimeService {// For an in-group broadcast/speak member, mirror its Gateway stream events// onto the supervisor op's channel (parentOperationId) so they flow down the// supervisor's existing WebSocket β the client subscribes to one connection,- // not one per member (single-connection multiplexing, LOBE-10868).+ // not one per member (single-connection multiplexing).const mirrorToOperationId =appContext?.orchestrationRole === 'member' ? (parentOperationId ?? undefined) : undefined;await this.coordinator.createAgentOperation(operationId, {diff --git a/apps/server/src/services/agentRuntime/CompletionLifecycle.ts b/apps/server/src/services/agentRuntime/CompletionLifecycle.tsindex c21611d9c48..b46daa66369 100644--- a/apps/server/src/services/agentRuntime/CompletionLifecycle.ts+++ b/apps/server/src/services/agentRuntime/CompletionLifecycle.ts@@ -269,9 +269,10 @@ export class CompletionLifecycle {payload: {agentId: metadata?.agentId,// Anchor the deferred skill synthesis to the completed assistant- // turn (LOBE-10802): the completion-stage skill handler walks- // this id back to the user message to read the parked candidate- // and seeds the skill under the assistant group. Resolved from+ // turn: the completion-stage skill handler walks this id back+ // to the user message to read the parked candidate and seeds+ // the skill under the assistant group β instead of synthesizing+ // from the user prompt alone at inbound time. Resolved from// the final assistant message row when operation metadata omits// it (the server execAgent path).anchorMessageId: assistantMessageId,@@ -482,8 +483,10 @@ export class CompletionLifecycle {// Operation-level metadata only carries `assistantMessageId` on the client// runtime path; a server `execAgent` turn leaves it unset (`{}` in DB). Fall// back to the persisted id on the final assistant message row in state so the- // completion event can anchor deferred skill synthesis to this turn- // (LOBE-10802). A metadata value, when present, still wins.+ // completion event can anchor deferred skill synthesis to this turn (skill+ // synthesis deferred from inbound to turn completion so it uses the full+ // trajectory β tool sequence + final product β not just the user prompt).+ // A metadata value, when present, still wins.const assistantMessageId =metadata?.assistantMessageId ?? (lastAssistantMessage as { id?: string } | undefined)?.id;diff --git a/apps/server/src/services/agentRuntime/__tests__/CompletionLifecycle.test.ts b/apps/server/src/services/agentRuntime/__tests__/CompletionLifecycle.test.tsindex 3388884f12b..4a9cc2d23e5 100644--- a/apps/server/src/services/agentRuntime/__tests__/CompletionLifecycle.test.ts+++ b/apps/server/src/services/agentRuntime/__tests__/CompletionLifecycle.test.ts@@ -227,11 +227,13 @@ describe('CompletionLifecycle.buildLifecycleEvent', () => {});it('resolves assistantMessageId from the final assistant message row when metadata omits it', () => {- // Regression (LOBE-10802): a server execAgent turn carries operation-level- // metadata ({} in DB) with no assistantMessageId, so the completion event- // previously shipped assistantMessageId=undefined and the deferred- // skill-synthesis handler no-oped. The id must fall back to the persisted- // id on the final assistant message row in state.+ // Regression: a server execAgent turn carries operation-level metadata+ // ({} in DB) with no assistantMessageId, so the completion event previously+ // shipped assistantMessageId=undefined and the deferred skill-synthesis+ // handler no-oped. The id must fall back to the persisted id on the final+ // assistant message row in state (deferred skill synthesis needs the+ // anchor to seed the skill under the assistant group, not under the user+ // message).const state = {messages: [{ content: 'user prompt', id: 'msg-user', role: 'user' },@@ -416,10 +418,12 @@ describe('CompletionLifecycle.emitSignalEvents β assistant anchor', () => {});it('ships the resolved assistantMessageId on the completed payload for a server turn', async () => {- // Regression (LOBE-10802): on a server execAgent turn the operation metadata- // has no assistantMessageId, so the agent.execution.completed event used to- // carry assistantMessageId=undefined and the deferred skill-synthesis handler- // no-oped. The payload must now anchor to the final assistant message row.+ // Regression: on a server execAgent turn the operation metadata has no+ // assistantMessageId, so the agent.execution.completed event used to carry+ // assistantMessageId=undefined and the deferred skill-synthesis handler+ // no-oped. The payload must now anchor to the final assistant message row+ // (so deferred skill synthesis seeds the skill under the completed turn's+ // assistant group, not as a floating mainline root).const emitSpy = vi.spyOn(agentSignalService, 'emitAgentSignalSourceEvent').mockResolvedValue(undefined as any);diff --git a/apps/server/src/services/agentSignal/policies/analyzeIntent/__tests__/completionSkillSynthesis.test.ts b/apps/server/src/services/agentSignal/policies/analyzeIntent/__tests__/completionSkillSynthesis.test.tsindex 0b3e8940a04..5de3725c0c2 100644--- a/apps/server/src/services/agentSignal/policies/analyzeIntent/__tests__/completionSkillSynthesis.test.ts+++ b/apps/server/src/services/agentSignal/policies/analyzeIntent/__tests__/completionSkillSynthesis.test.ts@@ -9,7 +9,10 @@ import { createCompletionSkillSynthesisSourceHandler } from '../completionSkillSimport type { PendingSkillSynthesis, RecordedSkillIntent } from '../skillIntentRecord';/**- * LOBE-10802 β deferred skill synthesis on `agent.execution.completed`.+ * Deferred skill synthesis on `agent.execution.completed` β skill synthesis+ * moved from user-message-inbound to turn-completion so the evidence carries the+ * full trajectory (tool sequence + final product) instead of just the user+ * prompt.** These tests pin the completion-stage handler in isolation: the parked* candidate is read, the turn trajectory (tool sequence + final product) is@@ -261,10 +264,11 @@ describe('createCompletionSkillSynthesisSourceHandler', () => {});/**- * End-to-end across the seam the LOBE-10802 bug lived in: emit the completion- * event from a *server execAgent* state whose operation metadata carries NO- * per-turn `assistantMessageId` (DB shape: `{}` + agentId/topicId/userId), then- * feed the emitted payload straight into the completion-skill-synthesis handler.+ * End-to-end across the seam the deferred skill synthesis bug lived in: emit the+ * completion event from a *server execAgent* state whose operation metadata+ * carries NO per-turn `assistantMessageId` (DB shape: `{}` + agentId/topicId/+ * userId), then feed the emitted payload straight into the completion-skill-+ * synthesis handler.** The whole logic chain runs in-process β no QStash, no HTTP. The earlier* handler tests hardcoded `assistantMessageId` in `createSource()`, which maskeddiff --git a/apps/server/src/services/agentSignal/policies/analyzeIntent/__tests__/feedbackAction.test.ts b/apps/server/src/services/agentSignal/policies/analyzeIntent/__tests__/feedbackAction.test.tsindex bbc9bb89993..7aca4234743 100644--- a/apps/server/src/services/agentSignal/policies/analyzeIntent/__tests__/feedbackAction.test.ts+++ b/apps/server/src/services/agentSignal/policies/analyzeIntent/__tests__/feedbackAction.test.ts@@ -431,11 +431,11 @@ describe('feedbackActionPlanner', () => {});/**- * @example- * LOBE-10802: a server execAgent inbound skill candidate (trigger is neither+ * A server execAgent inbound skill candidate (trigger is neither* `client.runtime.*` nor an agent-signal self-iteration run) is parked WITH a* synthesis payload and NOT dispatched on the user prompt alone β the deferred- * completion-stage handler synthesizes it off the full trajectory instead.+ * completion-stage handler synthesizes it off the full trajectory instead of+ * just the user prompt.*/it('parks a server-inbound skill candidate until agent.execution.completed', async () => {const store = createStore();diff --git a/apps/server/src/services/agentSignal/policies/analyzeIntent/actions/skillManagement.ts b/apps/server/src/services/agentSignal/policies/analyzeIntent/actions/skillManagement.tsindex e651fb6bfb7..8674b73433e 100644--- a/apps/server/src/services/agentSignal/policies/analyzeIntent/actions/skillManagement.ts+++ b/apps/server/src/services/agentSignal/policies/analyzeIntent/actions/skillManagement.ts@@ -156,9 +156,10 @@ export const executeSkillManagementAction = async (const { assistantMessageId, messageId, topicId } = action.payload;// Anchor the skill seed under the completed assistant turn when the synthesis- // ran deferred at `agent.execution.completed` (LOBE-10802); fall back to the- // user message for the legacy inbound dispatch. Anchoring to the assistant- // message keeps the seed inside the assistant group instead of surfacing as a+ // ran deferred at `agent.execution.completed` (skill delayed to turn+ // completion so evidence carries the full trajectory); fall back to the user+ // message for the legacy inbound dispatch. Anchoring to the assistant message+ // keeps the seed inside the assistant group instead of surfacing as a// floating `parent_id=null` mainline root.const anchorMessageId = assistantMessageId ?? messageId;diff --git a/apps/server/src/services/agentSignal/policies/analyzeIntent/completionSkillSynthesis.ts b/apps/server/src/services/agentSignal/policies/analyzeIntent/completionSkillSynthesis.tsindex f4b464cde5e..2d093b198cc 100644--- a/apps/server/src/services/agentSignal/policies/analyzeIntent/completionSkillSynthesis.ts+++ b/apps/server/src/services/agentSignal/policies/analyzeIntent/completionSkillSynthesis.ts@@ -127,7 +127,7 @@ const renderTrajectoryMessage = (message: CompletedTurnMessage): string => {* Assembles the completed-turn trajectory (user request, the tool-call sequence,* tool results, and the final assistant product) into one XML envelope used as* the deferred skill synthesis context. This is the evidence the inbound prompt- * alone could not provide (LOBE-10802 acceptance: evidence carries the tool+ * alone could not provide (deferred synthesis: evidence carries the tool* sequence + final product, not just the user prompt).*/const assembleTrajectoryContext = async (input: {@@ -182,7 +182,8 @@ export type CompletionSkillSynthesisOptions = SkillManagementActionHandlerOption/*** Builds the `agent.execution.completed` source handler that performs deferred- * skill synthesis (LOBE-10802).+ * skill synthesis (skill synthesis delayed to turn completion so evidence+ * carries the full trajectory instead of just the user prompt).** For a normal, non-error, non-self-iteration server execAgent turn it:* 1. Hydrates the completed turn (assistant -> user parent).diff --git a/apps/server/src/services/agentSignal/policies/analyzeIntent/feedbackAction.ts b/apps/server/src/services/agentSignal/policies/analyzeIntent/feedbackAction.tsindex 4da31212440..baa23ce79b8 100644--- a/apps/server/src/services/agentSignal/policies/analyzeIntent/feedbackAction.ts+++ b/apps/server/src/services/agentSignal/policies/analyzeIntent/feedbackAction.ts@@ -126,10 +126,12 @@ const detectClientComplete = (signal: FeedbackDomainSignal) => {/*** Detects a server execAgent inbound skill candidate that should be parked and- * synthesized after the run finishes (LOBE-10802), rather than dispatched on the- * user message alone. The client-runtime lane parks/synthesizes through its own- * `client.runtime.start` / `client.runtime.complete` pair and is never re-routed- * here; agent-signal self-iteration runs are suppressed upstream but guarded too.+ * synthesized after the run finishes (deferred skill synthesis so the evidence+ * carries the full trajectory, not just the user prompt), rather than dispatched+ * on the user message alone. The client-runtime lane parks/synthesizes through+ * its own `client.runtime.start` / `client.runtime.complete` pair and is never+ * re-routed here; agent-signal self-iteration runs are suppressed upstream but+ * guarded too.*/const detectServerInboundDeferredSkill = (signal: FeedbackDomainSignal): boolean => {const { trigger } = signal.payload;@@ -486,12 +488,12 @@ export const createFeedbackActionPlannerSignalHandler = (};}- // Defer server execAgent inbound synthesis to agent.execution.completed- // (LOBE-10802): park the candidate with its synthesis payload so the- // completion-stage handler synthesizes from the full trajectory (tool- // sequence + final product) instead of the user prompt alone. Only when- // the intent-record store is wired β otherwise fall through to the legacy- // inbound dispatch so synthesis is never silently dropped.+ // Defer server execAgent inbound synthesis to agent.execution.completed:+ // park the candidate with its synthesis payload so the completion-stage+ // handler synthesizes from the full trajectory (tool sequence + final+ // product) instead of the user prompt alone. Only when the intent-record+ // store is wired β otherwise fall through to the legacy inbound dispatch+ // so synthesis is never silently dropped.const skillIntentWriter = options.procedure?.procedureState?.skillIntentRecords?.write;if (skillIntentWriter && detectServerInboundDeferredSkill(signal)) {await skillIntentWriter(diff --git a/apps/server/src/services/agentSignal/policies/analyzeIntent/index.ts b/apps/server/src/services/agentSignal/policies/analyzeIntent/index.tsindex aa9ff1d258d..d71b354200a 100644--- a/apps/server/src/services/agentSignal/policies/analyzeIntent/index.ts+++ b/apps/server/src/services/agentSignal/policies/analyzeIntent/index.ts@@ -86,8 +86,9 @@ export const createAnalyzeIntentPolicy = (options: CreateAnalyzeIntentPolicyOptiprocedureState:options.skillManagement.procedureState ?? options.procedure?.procedureState,}),- // Deferred skill synthesis (LOBE-10802): synthesize the parked skill- // candidate after `agent.execution.completed`, off the full trajectory.+ // Deferred skill synthesis: synthesize the parked skill candidate after+ // `agent.execution.completed`, off the full trajectory (tool sequence+ // + final product) rather than the user prompt alone.createCompletionSkillSynthesisSourceHandler({...options.skillManagement,procedureState:diff --git a/apps/server/src/services/agentSignal/policies/analyzeIntent/skillIntentRecord.ts b/apps/server/src/services/agentSignal/policies/analyzeIntent/skillIntentRecord.tsindex c801f131364..52fcb932b1b 100644--- a/apps/server/src/services/agentSignal/policies/analyzeIntent/skillIntentRecord.ts+++ b/apps/server/src/services/agentSignal/policies/analyzeIntent/skillIntentRecord.ts@@ -94,9 +94,11 @@ export interface RecordedSkillIntent {feedbackMessageId: string;/*** Synthesis payload for the deferred completion-stage skill run. Present when- * a server execAgent inbound turn parked a candidate to synthesize after- * `agent.execution.completed` (LOBE-10802); absent for the client-runtime- * lane, which re-derives the source at `client.runtime.complete`.+ * a server execAgent inbound turn parked a candidate to synthesize at+ * `agent.execution.completed` (skill synthesis deferred to turn completion so+ * the evidence carries the full trajectory, not just the user prompt); absent+ * for the client-runtime lane, which re-derives the source at+ * `client.runtime.complete`.*/pendingSynthesis?: PendingSkillSynthesis;/** Optional private-safe reason suitable for traces and eval assertions. */diff --git a/apps/server/src/services/agentSignal/policies/types.ts b/apps/server/src/services/agentSignal/policies/types.tsindex 0059a60171f..4d9dbd0045a 100644--- a/apps/server/src/services/agentSignal/policies/types.ts+++ b/apps/server/src/services/agentSignal/policies/types.ts@@ -319,8 +319,8 @@ export interface AgentSignalPolicyActionPayloadMap {agentId?: string;/*** Assistant message that completed the turn. When present (deferred- * completion-stage synthesis, LOBE-10802) the skill seed anchors here- * instead of under the user message, so it is not a floating mainline root.+ * completion-stage synthesis) the skill seed anchors here instead of under+ * the user message, so it is not a floating mainline root.*/assistantMessageId?: string;conflictPolicy?: AgentSignalFeedbackDomainConflictPolicy;diff --git a/packages/agent-gateway-client/src/client.test.ts b/packages/agent-gateway-client/src/client.test.tsindex 8b55eae72da..8922a30eb18 100644--- a/packages/agent-gateway-client/src/client.test.ts+++ b/packages/agent-gateway-client/src/client.test.ts@@ -307,9 +307,10 @@ describe('AgentStreamClient', () => {});it('should NOT disconnect on a forwarded terminal for a different operationId', async () => {- // Multiplexed WS (LOBE-10868): a broadcast member's agent_runtime_end is- // mirrored onto the supervisor's channel. It must be emitted (so the member- // handler can finalize that member) but must NOT close the supervisor WS.+ // Single-connection WS multiplexing: a broadcast member's+ // agent_runtime_end is mirrored onto the supervisor's channel. It must+ // be emitted (so the member handler can finalize that member) but must+ // NOT close the supervisor WS.const client = createClient(); // operationId: 'op-123'const events: any[] = [];client.on('agent_event', (e) => events.push(e));diff --git a/packages/agent-gateway-client/src/client.ts b/packages/agent-gateway-client/src/client.tsindex f2968fa92bf..80227b3ea96 100644--- a/packages/agent-gateway-client/src/client.ts+++ b/packages/agent-gateway-client/src/client.ts@@ -283,13 +283,13 @@ export class AgentStreamClient extends TypedEmitter {const agentEvent: AgentStreamEvent = message.event;if (message.id) this.lastEventId = message.id;- // A single WS can be multiplexed: alongside this op's events it may+ // A single WebSocket is multiplexed: alongside this op's events it may// carry forwarded events from other operations (e.g. broadcast council- // members mirrored onto the supervisor's channel, LOBE-10868). A- // terminal event ends the SESSION only when it belongs to THIS op β- // a member finishing must not disconnect the supervisor's socket and- // stop sibling/supervisor streaming. Events with no operationId- // (legacy gateway) are treated as this op's, preserving old behavior.+ // members mirrored onto the supervisor's channel). A terminal event+ // ends the SESSION only when it belongs to THIS op β a member+ // finishing must not disconnect the supervisor's socket and stop+ // sibling/supervisor streaming. Events with no operationId (legacy+ // gateway) are treated as this op's, preserving old behavior.const isOwnTerminal =(agentEvent.type === 'agent_runtime_end' || agentEvent.type === 'error') &&(!agentEvent.operationId || agentEvent.operationId === this.operationId);diff --git a/src/store/chat/slices/agentRun/actions/transports/gateway/gateway.ts b/src/store/chat/slices/agentRun/actions/transports/gateway/gateway.tsindex 97f75c91fd9..cbeb253e020 100644--- a/src/store/chat/slices/agentRun/actions/transports/gateway/gateway.ts+++ b/src/store/chat/slices/agentRun/actions/transports/gateway/gateway.ts@@ -212,8 +212,8 @@ export class GatewayActionImpl {// Forward agent events to caller, and track terminal events.//- // Only THIS op's terminal counts. On a multiplexed connection (LOBE-10868)- // the supervisor's WS also carries forwarded member terminals; a member+ // Only THIS op's terminal counts. On a multiplexed connection the+ // supervisor's WS also carries forwarded member terminals; a member// finishing must not mark the supervisor run complete or stomp its unread// status. Match on the event's operationId (absent β legacy single-op WS,// treat as this op's to preserve prior behavior).@@ -613,9 +613,9 @@ export class GatewayActionImpl {});// Demux the supervisor's WebSocket: with single-connection multiplexing- // (LOBE-10868) this WS also carries each broadcast member's streaming events- // (forwarded server-side onto the supervisor op channel). Route owner events- // to the full handler and member events to render-only member handlers so a+ // this WS also carries each broadcast member's streaming events (forwarded+ // server-side onto the supervisor op channel). Route owner events to the+ // full handler and member events to render-only member handlers so a// member's chunks stream into its own council column instead of corrupting// the supervisor bubble.const eventRouter = createGatewayEventRouter({diff --git a/src/store/chat/slices/agentRun/actions/transports/gateway/gatewayEventRouter.ts b/src/store/chat/slices/agentRun/actions/transports/gateway/gatewayEventRouter.tsindex 471cf1ccff9..e170ccb9c59 100644--- a/src/store/chat/slices/agentRun/actions/transports/gateway/gatewayEventRouter.ts+++ b/src/store/chat/slices/agentRun/actions/transports/gateway/gatewayEventRouter.ts@@ -30,11 +30,11 @@ export interface GatewayEventRouterParams {* one `operationId`.** The Gateway connection model is moving from per-operation (one WS per op) to- * single-connection multiplexing (LOBE-10868): a broadcast supervisor's WS now- * also receives the streaming events of each of its members, forwarded- * server-side onto the supervisor's op channel. Every `AgentStreamEvent` already- * carries its own `operationId`, so the routing key is intrinsic to the event β- * we just need to fan it out to the right handler.+ * single-connection multiplexing: a broadcast supervisor's WS now also receives+ * the streaming events of each of its members, forwarded server-side onto the+ * supervisor's op channel. Every `AgentStreamEvent` already carries its own+ * `operationId`, so the routing key is intrinsic to the event β we just need to+ * fan it out to the right handler.** - Events for `ownerOperationId` β `ownerHandler` (existing behavior, unchanged).* - Events for any other operationId β a render-only member handler, createddiff --git a/src/store/chat/slices/agentRun/actions/transports/gateway/gatewayMemberStreamHandler.ts b/src/store/chat/slices/agentRun/actions/transports/gateway/gatewayMemberStreamHandler.tsindex 580bfd7e5ca..32397f3c67c 100644--- a/src/store/chat/slices/agentRun/actions/transports/gateway/gatewayMemberStreamHandler.ts+++ b/src/store/chat/slices/agentRun/actions/transports/gateway/gatewayMemberStreamHandler.ts@@ -40,8 +40,9 @@ export interface GatewayMemberStreamHandlerParams {/*** A render-only handler for a broadcast council member whose streaming events- * are multiplexed onto the supervisor's Gateway WebSocket (LOBE-10868, option- * B: server forwards member events onto the supervisor op channel).+ * are multiplexed onto the supervisor's Gateway WebSocket (server forwards+ * member events onto the supervisor op channel, single-connection+ * multiplexing).** Scope is deliberately narrow β it owns ONLY the member's live text/reasoning/* tool-call streaming into its council column. It does NOT drive any run