Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import software.aws.toolkits.core.utils.createTemporaryZipFile
import software.aws.toolkits.core.utils.debug
import software.aws.toolkits.core.utils.getLogger
import software.aws.toolkits.core.utils.putNextEntry
import software.aws.toolkits.jetbrains.core.credentials.sono.isInternalUser
import software.aws.toolkits.jetbrains.services.codewhisperer.codescan.sessionconfig.Payload
import software.aws.toolkits.jetbrains.services.codewhisperer.codescan.sessionconfig.PayloadContext
import software.aws.toolkits.jetbrains.services.codewhisperer.codescan.sessionconfig.PayloadMetadata
Expand All @@ -32,8 +33,10 @@ import software.aws.toolkits.jetbrains.services.codewhisperer.language.programmi
import software.aws.toolkits.jetbrains.services.codewhisperer.util.CodeWhispererConstants.CODE_SCAN_CREATE_PAYLOAD_TIMEOUT_IN_SECONDS
import software.aws.toolkits.jetbrains.services.codewhisperer.util.CodeWhispererConstants.DEFAULT_CODE_SCAN_TIMEOUT_IN_SECONDS
import software.aws.toolkits.jetbrains.services.codewhisperer.util.CodeWhispererConstants.DEFAULT_PAYLOAD_LIMIT_IN_BYTES
import software.aws.toolkits.jetbrains.services.codewhisperer.util.CodeWhispererConstants.INTERNAL_PAYLOAD_LIMIT_IN_BYTES
import software.aws.toolkits.jetbrains.services.codewhisperer.util.GitIgnoreFilteringUtil
import software.aws.toolkits.jetbrains.services.codewhisperer.util.isWithin
import software.aws.toolkits.jetbrains.services.cwc.controller.chat.telemetry.getStartUrl
import software.aws.toolkits.resources.message
import java.io.File
import java.nio.file.Path
Expand All @@ -60,7 +63,12 @@ class CodeTestSessionConfig(
*/
fun overallJobTimeoutInSeconds(): Long = DEFAULT_CODE_SCAN_TIMEOUT_IN_SECONDS

fun getPayloadLimitInBytes(): Long = DEFAULT_PAYLOAD_LIMIT_IN_BYTES
fun getPayloadLimitInBytes(): Long =
if (isInternalUser(getStartUrl(project))) {
Copy link
Contributor

@rli rli Feb 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this limit be fetched from the service instead?

Copy link
Contributor Author

@ashishrp-aws ashishrp-aws Feb 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not right now. This needs service changes which would take time, so we used existing client options. This change is temporary right now for debugging the issue. we will make this permanent across the customers(external or internal) once we have data

INTERNAL_PAYLOAD_LIMIT_IN_BYTES
} else {
DEFAULT_PAYLOAD_LIMIT_IN_BYTES
}

private fun willExceedPayloadLimit(currentTotalFileSize: Long, currentFileSize: Long): Boolean =
currentTotalFileSize.let { totalSize -> totalSize > (getPayloadLimitInBytes() - currentFileSize) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ object CodeWhispererConstants {
const val CODE_SCAN_ISSUE_TITLE_MAX_LENGTH = 60
const val DEFAULT_CODE_SCAN_TIMEOUT_IN_SECONDS: Long = 60 * 10 // 10 minutes
const val DEFAULT_PAYLOAD_LIMIT_IN_BYTES: Long = 1 * 1024 * 1024 * 1024 // 1GB
const val INTERNAL_PAYLOAD_LIMIT_IN_BYTES: Long = (1024L * 1024L * 1024L * 2L) // 2GB
const val CODE_SCAN_POLLING_INTERVAL_IN_SECONDS: Long = 1
const val FILE_SCAN_INITIAL_POLLING_INTERVAL_IN_SECONDS: Long = 10
const val PROJECT_SCAN_INITIAL_POLLING_INTERVAL_IN_SECONDS: Long = 30
Expand Down
Loading