@@ -287,10 +287,11 @@ def apply_repo_settings(pr_url):
287287 os .close (fd )
288288
289289 try :
290- dynconf_kwargs = {'core_loaders' : [], # DISABLE default loaders, otherwise will load toml files more than once.
290+ dynconf_kwargs = {'core_loaders' : [],
291+ # Disable default loaders, otherwise TOML files load more than once.
291292 'loaders' : ['pr_agent.custom_merge_loader' ],
292- # Use a custom loader to merge sections, but overwrite their overlapping values. Don't involve ENV variables.
293- 'merge_enabled' : True # Merge multiple files; ensures [XYZ] sections only overwrite overlapping keys, not whole sections.
293+ # Merge sections and overwrite overlapping values without involving environment variables.
294+ 'merge_enabled' : True
294295 }
295296
296297 new_settings = Dynaconf (settings_files = repo_settings_files ,
@@ -364,13 +365,21 @@ def handle_configurations_errors(config_errors, git_provider):
364365 err_message = err ['error' ]
365366 config_type = err ['category' ]
366367 header = f"❌ **PR-Agent failed to apply '{ config_type } ' repo settings**"
367- body = f"{ header } \n \n The configuration file needs to be a valid [TOML](https://qodo-merge-docs.qodo.ai/usage-guide/configuration_options/), please fix it.\n \n "
368+ body = (
369+ f"{ header } \n \n The configuration file needs to be a valid "
370+ "[TOML](https://qodo-merge-docs.qodo.ai/usage-guide/configuration_options/), please fix it.\n \n "
371+ )
368372 body += f"___\n \n **Error message:**\n `{ err_message } `\n \n "
369- if git_provider .is_supported ("gfm_markdown" ):
370- body += f"\n \n <details><summary>Configuration content:</summary>\n \n ```toml\n { configuration_file_content } \n ```\n \n </details>"
373+ if config_type == "global" :
374+ body += "\n \n The invalid configuration came from the organization's global settings file."
375+ elif git_provider .is_supported ("gfm_markdown" ):
376+ body += (
377+ "\n \n <details><summary>Configuration content:</summary>\n \n "
378+ f"```toml\n { configuration_file_content } \n ```\n \n </details>"
379+ )
371380 else :
372381 body += f"\n \n **Configuration content:**\n \n ```toml\n { configuration_file_content } \n ```\n \n "
373- get_logger ().warning (f "Sending a 'configuration error' comment to the PR" , artifact = {'body' : body })
382+ get_logger ().warning ("Sending a 'configuration error' comment to the PR" , artifact = {'body' : body })
374383 # git_provider.publish_comment(body)
375384 if hasattr (git_provider , 'publish_persistent_comment' ):
376385 git_provider .publish_persistent_comment (body ,
@@ -380,7 +389,7 @@ def handle_configurations_errors(config_errors, git_provider):
380389 else :
381390 git_provider .publish_comment (body )
382391 except Exception as e :
383- get_logger ().exception (f "Failed to handle configurations errors" , e )
392+ get_logger ().exception ("Failed to handle configurations errors" , e )
384393
385394
386395def set_claude_model ():
0 commit comments