fix(agent99): frame remote bootstrap input
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 1s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 3m1s
CD Pipeline / build-and-deploy (push) Has started running
CD Pipeline / post-deploy-checks (push) Has been cancelled

This commit is contained in:
ogt
2026-07-14 21:07:29 +08:00
parent 66fb0c4f8d
commit 4edd802497
2 changed files with 13 additions and 1 deletions

View File

@@ -320,8 +320,16 @@ compressed = gzip.compress(
compresslevel=9,
mtime=0,
)
payload = base64.b64encode(compressed).decode("ascii")
line_width = 65536
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:
raise SystemExit("remote_bootstrap_payload_line_contract_failed")
output_path.write_text(
base64.b64encode(compressed).decode("ascii") + "\n" + sentinel + "\n",
"\n".join(payload_lines) + "\n" + sentinel + "\n",
encoding="ascii",
)
PY

View File

@@ -154,6 +154,10 @@ def test_sender_builds_sha256_envelope_and_streams_it_without_remote_cli_data()
assert "[Console]::In.ReadLine()" in source
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 '"\\n".join(payload_lines)' in source
assert "remote_bootstrap_payload_line_contract_failed" in source
assert "$lineCount -gt 8" in source
assert "$charCount -gt 1048576" in source
assert '<"${BOOTSTRAP_PAYLOAD_PATH}"' in source