@@ -17,6 +17,7 @@ import {
1717 writeWorkspaceFileByPath ,
1818} from '@/lib/copilot/vfs/resource-writer'
1919import { isRemoteSandboxEnabled } from '@/lib/core/config/env-flags'
20+ import { setRecordValue } from '@/lib/core/utils/records'
2021import { generateRequestId } from '@/lib/core/utils/request'
2122import { withRouteHandler } from '@/lib/core/utils/with-route-handler'
2223import { executeInIsolatedVM , type IsolatedVMBrokerHandler } from '@/lib/execution/isolated-vm'
@@ -580,7 +581,7 @@ function scopeEnvironmentVariables(
580581 const scoped : Record < string , string > = { }
581582 const missing : string [ ] = [ ]
582583 for ( const name of allowed ) {
583- if ( name in envVars ) scoped [ name ] = envVars [ name ]
584+ if ( Object . hasOwn ( envVars , name ) ) setRecordValue ( scoped , name , envVars [ name ] )
584585 else missing . push ( name )
585586 }
586587 if ( missing . length > 0 ) {
@@ -608,19 +609,19 @@ function resolveEnvironmentVariables(
608609 const resolverVars : Record < string , string > = { }
609610 Object . entries ( params ) . forEach ( ( [ key , value ] ) => {
610611 if ( value !== undefined && value !== null ) {
611- resolverVars [ key ] = String ( value )
612+ setRecordValue ( resolverVars , key , String ( value ) )
612613 }
613614 } )
614615 Object . entries ( envVars ) . forEach ( ( [ key , value ] ) => {
615616 if ( value !== undefined && value !== null ) {
616- resolverVars [ key ] = value
617+ setRecordValue ( resolverVars , key , value )
617618 }
618619 } )
619620
620621 while ( ( match = regex . exec ( code ) ) !== null ) {
621622 const varName = match [ 1 ] . trim ( )
622623
623- if ( ! ( varName in resolverVars ) ) {
624+ if ( ! Object . hasOwn ( resolverVars , varName ) ) {
624625 continue
625626 }
626627
0 commit comments