@@ -598,6 +598,7 @@ export async function tryTargetsRecursively(
598
598
599
599
// start: merge inherited config with current target config (preference given to current)
600
600
const currentInheritedConfig : Record < string , any > = {
601
+ id : inheritedConfig . id || currentTarget . id ,
601
602
overrideParams : {
602
603
...inheritedConfig . overrideParams ,
603
604
...currentTarget . overrideParams ,
@@ -751,8 +752,8 @@ export async function tryTargetsRecursively(
751
752
] ;
752
753
// end: merge inherited config with current target config (preference given to current)
753
754
754
- const circuitBreakerConfigId = c . get ( 'circuitBreakerConfigId' ) ;
755
- if ( circuitBreakerConfigId ) {
755
+ const isHandlingCircuitBreaker = currentInheritedConfig . id ;
756
+ if ( isHandlingCircuitBreaker ) {
756
757
const healthyTargets = ( currentTarget . targets || [ ] )
757
758
. map ( ( t : any , index : number ) => ( {
758
759
...t ,
@@ -891,10 +892,11 @@ export async function tryTargetsRecursively(
891
892
currentJsonPath ,
892
893
method
893
894
) ;
894
- if ( circuitBreakerConfigId ) {
895
+ if ( isHandlingCircuitBreaker ) {
895
896
await c . get ( 'handleCircuitBreakerResponse' ) (
896
897
response ,
897
- circuitBreakerConfigId ,
898
+ currentInheritedConfig . id ,
899
+ currentTarget . cbConfig ,
898
900
currentJsonPath ,
899
901
c
900
902
) ;
@@ -924,11 +926,13 @@ export async function tryTargetsRecursively(
924
926
) ;
925
927
} else {
926
928
response = error . response ;
927
- if ( circuitBreakerConfigId ) {
929
+ if ( isHandlingCircuitBreaker ) {
928
930
await c . get ( 'recordCircuitBreakerFailure' ) (
929
931
env ( c ) ,
930
- circuitBreakerConfigId ,
931
- currentJsonPath
932
+ currentInheritedConfig . id ,
933
+ currentTarget . cbConfig ,
934
+ currentJsonPath ,
935
+ response . status
932
936
) ;
933
937
}
934
938
}
@@ -1240,6 +1244,7 @@ export function constructConfigFromRequestHeaders(
1240
1244
'output_guardrails' ,
1241
1245
'default_input_guardrails' ,
1242
1246
'default_output_guardrails' ,
1247
+ 'cb_config' ,
1243
1248
] ) as any ;
1244
1249
}
1245
1250
0 commit comments