From 9476b234fcafae4669e5498550d675402b00a3ea Mon Sep 17 00:00:00 2001 From: ogt Date: Wed, 15 Jul 2026 10:36:04 +0800 Subject: [PATCH] fix(agent99): align transport framing with payload cap --- scripts/reboot-recovery/deploy-agent99-via-windows99-ssh.sh | 6 ++++-- .../test_agent99_remote_atomic_deploy_transport_contract.py | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/reboot-recovery/deploy-agent99-via-windows99-ssh.sh b/scripts/reboot-recovery/deploy-agent99-via-windows99-ssh.sh index 12e557f03..7c62ba318 100755 --- a/scripts/reboot-recovery/deploy-agent99-via-windows99-ssh.sh +++ b/scripts/reboot-recovery/deploy-agent99-via-windows99-ssh.sh @@ -336,11 +336,12 @@ compressed = gzip.compress( ) payload = base64.b64encode(compressed).decode("ascii") line_width = 65536 +max_payload_lines = 16 payload_lines = [ payload[offset : offset + line_width] for offset in range(0, len(payload), line_width) ] -if not payload_lines or len(payload_lines) > 8: +if not payload_lines or len(payload_lines) > max_payload_lines: raise SystemExit("remote_bootstrap_payload_line_contract_failed") output_path.write_text( "\n".join(payload_lines) + "\n" + sentinel + "\n", @@ -504,8 +505,9 @@ if ($allLines.Count -lt 2 -or $allLines[-1] -cne $sentinel) {{ throw "remote_bootstrap_sentinel_missing" }} $payloadLines = @($allLines[0..($allLines.Count - 2)]) +$maxPayloadLines = 16 $charCount = [int](($payloadLines | Measure-Object -Property Length -Sum).Sum) + (2 * $payloadLines.Count) -if ($payloadLines.Count -gt 8 -or $charCount -gt 1048576) {{ +if ($payloadLines.Count -gt $maxPayloadLines -or $charCount -gt 1048576) {{ throw "remote_bootstrap_input_limit_exceeded" }} $payload = [string]::Join("", $payloadLines) diff --git a/scripts/reboot-recovery/tests/test_agent99_remote_atomic_deploy_transport_contract.py b/scripts/reboot-recovery/tests/test_agent99_remote_atomic_deploy_transport_contract.py index 15aa9709d..5edc6ebd1 100644 --- a/scripts/reboot-recovery/tests/test_agent99_remote_atomic_deploy_transport_contract.py +++ b/scripts/reboot-recovery/tests/test_agent99_remote_atomic_deploy_transport_contract.py @@ -163,10 +163,12 @@ def test_sender_builds_sha256_envelope_and_streams_it_without_remote_cli_data() assert "remote_bootstrap_input_limit_exceeded" in source assert "remote_bootstrap_sentinel_missing" in source assert "line_width = 65536" in source - assert "len(payload_lines) > 8" in source + assert "max_payload_lines = 16" in source + assert "len(payload_lines) > max_payload_lines" in source assert '"\\n".join(payload_lines)' in source assert "remote_bootstrap_payload_line_contract_failed" in source - assert "$payloadLines.Count -gt 8" in source + assert "$maxPayloadLines = 16" in source + assert "$payloadLines.Count -gt $maxPayloadLines" in source assert "$charCount -gt 1048576" in source assert '<"${BOOTSTRAP_PAYLOAD_PATH}"' not in source assert "rawEnvelope" not in source