MCPcopy
hub / github.com/coder/mux / attributeChildReportToParentGoal

Method attributeChildReportToParentGoal

src/node/services/taskService.ts:9300–9334  ·  view source on GitHub ↗
(
    parentWorkspaceId: string,
    childWorkspaceId: string
  )

Source from the content-addressed store, hash-verified

9298 }
9299
9300 private async attributeChildReportToParentGoal(
9301 parentWorkspaceId: string,
9302 childWorkspaceId: string
9303 ): Promise<void> {
9304 assert(
9305 parentWorkspaceId.trim().length > 0,
9306 "attributeChildReportToParentGoal requires parentWorkspaceId"
9307 );
9308 assert(
9309 childWorkspaceId.trim().length > 0,
9310 "attributeChildReportToParentGoal requires childWorkspaceId"
9311 );
9312 if (!this.workspaceGoalService) {
9313 return;
9314 }
9315
9316 const childCostCents = await this.getChildReportCostCents(childWorkspaceId);
9317 const attribution = await this.workspaceGoalService.attributeChildReport({
9318 parentWorkspaceId,
9319 childWorkspaceId,
9320 childCostCents,
9321 });
9322 if (!attribution?.causedBudgetLimit) {
9323 return;
9324 }
9325
9326 this.workspaceService.emitChatEvent(parentWorkspaceId, {
9327 type: "goal-budget-limited",
9328 workspaceId: parentWorkspaceId,
9329 goalId: attribution.goalAfter.goalId,
9330 causedByChild: true,
9331 childWorkspaceId,
9332 message: "Child workspace exceeded the parent's goal budget.",
9333 });
9334 }
9335
9336 private async shouldAllowLegacyInvalidWorkflowOutputSchema(
9337 childWorkspaceId: string,

Callers 1

Calls 4

attributeChildReportMethod · 0.80
assertFunction · 0.50
emitChatEventMethod · 0.45

Tested by

no test coverage detected