fix(agent99): scope SigNoz SCP process receipt
All checks were successful
CD Pipeline / select-latest-carrier (push) Successful in 56s
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 2m41s
CD Pipeline / revalidate-deploy-carrier (push) Successful in 41s
CD Pipeline / build-and-deploy (push) Successful in 15m2s
CD Pipeline / revalidate-post-deploy-carrier (push) Successful in 39s
CD Pipeline / post-deploy-checks (push) Successful in 4m45s

This commit is contained in:
Your Name
2026-07-22 21:42:23 +08:00
parent 2e5e273919
commit df50718ac5
2 changed files with 23 additions and 6 deletions

View File

@@ -501,16 +501,16 @@ function Invoke-Agent99SignozToolchainScp {
$stderrPath = Join-Path $env:TEMP "agent99-signoz-toolchain-scp-$token.err"
$script:TransientTransportOutputUsed = $true
try {
$process = Start-Process -FilePath "scp.exe" -ArgumentList $arguments `
$scpProcess = Start-Process -FilePath "scp.exe" -ArgumentList $arguments `
-NoNewWindow -RedirectStandardOutput $stdoutPath `
-RedirectStandardError $stderrPath -PassThru
if (-not $process.WaitForExit(180000)) {
try { & taskkill.exe /PID $process.Id /T /F 2>&1 | Out-Null } catch {}
if (-not $scpProcess.WaitForExit(180000)) {
try { & taskkill.exe /PID $scpProcess.Id /T /F 2>&1 | Out-Null } catch {}
return $false
}
$process.WaitForExit() | Out-Null
$process.Refresh()
return [bool]($process.HasExited -and [int]$process.ExitCode -eq 0)
$scpProcess.WaitForExit() | Out-Null
$scpProcess.Refresh()
return [bool]($scpProcess.HasExited -and [int]$scpProcess.ExitCode -eq 0)
} finally {
Remove-Item -LiteralPath $stdoutPath, $stderrPath -Force -ErrorAction SilentlyContinue
if ((Test-Path -LiteralPath $stdoutPath) -or (Test-Path -LiteralPath $stderrPath)) {

View File

@@ -168,6 +168,23 @@ def test_entrypoint_uses_typed_stdout_without_windows_process_exit_code() -> Non
assert "taskkill.exe /PID $process.Id /T /F" in transport
def test_toolchain_scp_uses_scoped_bounded_process_exit_readback() -> None:
source = ENTRYPOINT.read_text(encoding="utf-8")
transport = source[
source.index("function Invoke-Agent99SignozToolchainScp") : source.index(
"function New-Agent99SignozLockedRemoteCommand"
)
]
assert '$scpProcess = Start-Process -FilePath "scp.exe"' in transport
assert "$scpProcess.WaitForExit(180000)" in transport
assert "taskkill.exe /PID $scpProcess.Id /T /F" in transport
assert "$scpProcess.WaitForExit()" in transport
assert "$scpProcess.Refresh()" in transport
assert "$scpProcess.HasExited -and [int]$scpProcess.ExitCode -eq 0" in transport
assert "$process.ExitCode" not in source
def test_entrypoint_preflight_has_explicit_credential_and_artifact_state_contracts() -> (
None
):