



























@@ -1617,10 +1617,19 @@ PY
1617161716181618wait_for_discord_host_visibility() {
16191619local nonce="$1"
1620+local message_id="${2:-}"
16201621local response
16211622local deadline=$((SECONDS + TIMEOUT_DISCORD_S))
16221623while (( SECONDS < deadline )); do
16231624set +e
1625+if [[ -n "$message_id" ]]; then
1626+ response="$(discord_api_request GET "/channels/$DISCORD_CHANNEL_ID/messages/$message_id")"
1627+local direct_rc=$?
1628+if [[ $direct_rc -eq 0 ]] && [[ -n "$response" ]] && printf '%s' "$response" | json_contains_string "$nonce"; then
1629+set -e
1630+return 0
1631+fi
1632+fi
16241633 response="$(discord_api_request GET "/channels/$DISCORD_CHANNEL_ID/messages?limit=20")"
16251634local rc=$?
16261635set -e
@@ -1697,7 +1706,7 @@ wait_for_guest_discord_readback() {
1697170616981707run_discord_roundtrip_smoke() {
16991708local phase="$1"
1700-local nonce outbound_nonce inbound_nonce outbound_message outbound_log sent_id_file host_id_file
1709+local nonce outbound_nonce inbound_nonce outbound_message outbound_log sent_id_file host_id_file sent_message_id
17011710 nonce="$(date +%s)-$RANDOM"
17021711 outbound_nonce="$phase-out-$nonce"
17031712 inbound_nonce="$phase-in-$nonce"
@@ -1706,6 +1715,7 @@ run_discord_roundtrip_smoke() {
17061715 sent_id_file="$RUN_DIR/$phase.discord-sent-message-id"
17071716 host_id_file="$RUN_DIR/$phase.discord-host-message-id"
170817171718+printf 'discord: guest-send\n'
17091719 guest_current_user_exec \
17101720"$GUEST_OPENCLAW_BIN" \
17111721 message send \
@@ -1715,9 +1725,13 @@ run_discord_roundtrip_smoke() {
17151725 --silent \
17161726 --json >"$outbound_log"
171717271718- discord_message_id_from_send_log "$outbound_log" >"$sent_id_file"
1719- wait_for_discord_host_visibility "$outbound_nonce"
1728+ sent_message_id="$(discord_message_id_from_send_log "$outbound_log")"
1729+printf '%s\n' "$sent_message_id" >"$sent_id_file"
1730+printf 'discord: host-visibility %s\n' "$sent_message_id"
1731+ wait_for_discord_host_visibility "$outbound_nonce" "$sent_message_id"
1732+printf 'discord: host-reply\n'
17201733 post_host_discord_message "$inbound_nonce" "$host_id_file"
1734+printf 'discord: guest-readback\n'
17211735 wait_for_guest_discord_readback "$inbound_nonce"
17221736}
17231737此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。