mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-28 05:16:23 -06:00
improve(ci): reduce main gating delays and add timing trends (#122441)
* ci: stop publishing warm dependency snapshots
Amp-Thread-ID: https://ampcode.com/threads/T-019ff3db-c467-70ad-8ed3-81f2ba94b0c0
* ci: isolate the high-variance source test shard
Amp-Thread-ID: https://ampcode.com/threads/T-019ff3db-c467-70ad-8ed3-81f2ba94b0c0
* ci: guarantee rebuilt dependency snapshot publication
Amp-Thread-ID: https://ampcode.com/threads/T-019ff3db-c467-70ad-8ed3-81f2ba94b0c0
* ci: add balanced main timing trends
Amp-Thread-ID: https://ampcode.com/threads/T-019ff3db-c467-70ad-8ed3-81f2ba94b0c0
* fix(ci): fall back when Crabbox CLI is unavailable
Amp-Thread-ID: https://ampcode.com/threads/T-019ff3db-c467-70ad-8ed3-81f2ba94b0c0
* Revert "fix(ci): fall back when Crabbox CLI is unavailable"
This reverts commit 0583ac8a9d.
---------
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
committed by
GitHub
parent
dd57cfb6c1
commit
72e42eed48
@@ -139,12 +139,28 @@ runs:
|
||||
# disk here, this gate binds cooperating code, not hostile code: the
|
||||
# enforced trust boundary is the fork/dispatch runner gate in ci.yml,
|
||||
# and same-repo PR authors already hold repository write access.
|
||||
# Explicit true (not on-change) because the allocated-byte heuristic
|
||||
# can miss a fingerprint refresh whose reinstall keeps disk usage
|
||||
# stable, permanently stranding consumers on a stale marker. The action
|
||||
# skips commit after failed/cancelled steps, so a broken install cannot
|
||||
# seed this key.
|
||||
commit: ${{ inputs.save-sticky-disk == 'true' && github.event_name != 'pull_request' && 'true' || 'false' }}
|
||||
# Warm validated snapshots stay read-only so asynchronous publication
|
||||
# does not perpetually chase no-op commits. The canonical writer records
|
||||
# the action's allocation baseline below; after any real capture and
|
||||
# store pruning, preflight forces a verified delta before this action's
|
||||
# post phase. The action also skips commit after failed/cancelled steps.
|
||||
commit: ${{ inputs.save-sticky-disk == 'true' && github.event_name != 'pull_request' && 'on-change' || 'false' }}
|
||||
|
||||
- name: Record sticky disk allocation baseline
|
||||
if: inputs.sticky-disk == 'true' && inputs.save-sticky-disk == 'true' && github.event_name != 'pull_request'
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
sticky_root=/var/tmp/openclaw-node-deps
|
||||
initial_usage_bytes="$(df -B1 --output=used "$sticky_root" | tail -n1 | tr -d '[:space:]')"
|
||||
if [[ ! "$initial_usage_bytes" =~ ^[0-9]+$ ]] || [[ "$initial_usage_bytes" -le 0 ]]; then
|
||||
echo "::error::Could not record sticky disk allocation baseline"
|
||||
exit 1
|
||||
fi
|
||||
rebuild_signal="${RUNNER_TEMP:?}/openclaw-sticky-deps-rebuilt"
|
||||
rm -f "$rebuild_signal"
|
||||
echo "OPENCLAW_STICKY_INITIAL_USAGE_BYTES=$initial_usage_bytes" >> "$GITHUB_ENV"
|
||||
echo "OPENCLAW_STICKY_REBUILD_SIGNAL=$rebuild_signal" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Restore and save Vitest transform cache
|
||||
if: inputs.vitest-fs-cache == 'true' && inputs.save-vitest-fs-cache == 'true' && runner.os != 'Windows'
|
||||
@@ -462,7 +478,7 @@ runs:
|
||||
# publishes the fingerprint; read-only clones are discarded at job
|
||||
# end, so capturing there would only burn shard wall clock.
|
||||
if [ "$STICKY_DISK" = "true" ] && [ "$STICKY_WRITER" = "true" ]; then
|
||||
bash "$GITHUB_ACTION_PATH/sticky-importers.sh" capture "$STICKY_ROOT" "$GITHUB_WORKSPACE" "$OPENCLAW_STICKY_DEPS_FINGERPRINT"
|
||||
bash "$GITHUB_ACTION_PATH/sticky-importers.sh" capture "$STICKY_ROOT" "$GITHUB_WORKSPACE" "$OPENCLAW_STICKY_DEPS_FINGERPRINT" "${OPENCLAW_STICKY_REBUILD_SIGNAL:?}"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@@ -3,11 +3,12 @@ set -euo pipefail
|
||||
|
||||
mode="${1:?mode is required}"
|
||||
sticky_root="${2:?sticky root is required}"
|
||||
workspace="${3:?workspace is required}"
|
||||
workspace="${3:-}"
|
||||
archive="$sticky_root/importer-node-modules.tar"
|
||||
archive_checksum="$sticky_root/.openclaw-importer-archive.sha256"
|
||||
importer_manifest="$sticky_root/importer-node-modules.manifest"
|
||||
marker="$sticky_root/.openclaw-deps-fingerprint"
|
||||
force_commit_sentinel="$sticky_root/.openclaw-force-commit"
|
||||
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
archive_sha256() {
|
||||
@@ -32,7 +33,9 @@ verify_importers() {
|
||||
|
||||
case "$mode" in
|
||||
capture)
|
||||
workspace="${workspace:?workspace is required}"
|
||||
fingerprint="${4:?fingerprint is required}"
|
||||
rebuild_signal="${5:?rebuild signal is required}"
|
||||
mkdir -p "$sticky_root"
|
||||
list_file="$(mktemp)"
|
||||
temp_archive="$archive.tmp.$$"
|
||||
@@ -67,8 +70,10 @@ case "$mode" in
|
||||
# registry-backed importer resolution before trusting this snapshot.
|
||||
printf '%s\n' "$fingerprint" >"$temp_marker"
|
||||
mv "$temp_marker" "$marker"
|
||||
: >"$rebuild_signal"
|
||||
;;
|
||||
restore)
|
||||
workspace="${workspace:?workspace is required}"
|
||||
if [[ ! -f "$archive" || ! -f "$archive_checksum" || ! -f "$importer_manifest" ]]; then
|
||||
echo "sticky importer archive, manifest, or checksum is missing under $sticky_root" >&2
|
||||
exit 1
|
||||
@@ -97,6 +102,61 @@ case "$mode" in
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
ensure-change)
|
||||
initial_usage_bytes="${3:?initial usage bytes are required}"
|
||||
if [[ ! "$initial_usage_bytes" =~ ^[0-9]+$ ]] || [[ "$initial_usage_bytes" -le 0 ]]; then
|
||||
echo "invalid initial sticky disk usage: $initial_usage_bytes" >&2
|
||||
exit 2
|
||||
fi
|
||||
current_usage_bytes() {
|
||||
df -B1 --output=used "$sticky_root" | tail -n1 | tr -d '[:space:]'
|
||||
}
|
||||
allocation_delta() {
|
||||
local current="$1"
|
||||
if [[ "$current" -ge "$initial_usage_bytes" ]]; then
|
||||
echo $((current - initial_usage_bytes))
|
||||
else
|
||||
echo $((initial_usage_bytes - current))
|
||||
fi
|
||||
}
|
||||
|
||||
# The pinned StickyDisk action commits only when the absolute whole-disk
|
||||
# allocation delta exceeds 4096 bytes. Measure against the same baseline
|
||||
# after store pruning, then leave a 64 KiB margin for its post phase.
|
||||
target_delta_bytes=65536
|
||||
max_sentinel_bytes=1048576
|
||||
current="$(current_usage_bytes)"
|
||||
if [[ ! "$current" =~ ^[0-9]+$ ]] || [[ "$current" -le 0 ]]; then
|
||||
echo "could not read current sticky disk usage" >&2
|
||||
exit 1
|
||||
fi
|
||||
delta="$(allocation_delta "$current")"
|
||||
if [[ "$delta" -le "$target_delta_bytes" ]] &&
|
||||
[[ -f "$force_commit_sentinel" ]] &&
|
||||
[[ "$(stat -c %s "$force_commit_sentinel")" -ge "$max_sentinel_bytes" ]]; then
|
||||
: >"$force_commit_sentinel"
|
||||
sync
|
||||
current="$(current_usage_bytes)"
|
||||
delta="$(allocation_delta "$current")"
|
||||
fi
|
||||
for _ in 1 2 3; do
|
||||
if [[ "$delta" -gt "$target_delta_bytes" ]]; then
|
||||
echo "Sticky dependency rebuild changed allocation by ${delta} bytes"
|
||||
exit 0
|
||||
fi
|
||||
bytes_needed=$((initial_usage_bytes + target_delta_bytes + 4096 - current))
|
||||
blocks_needed=$(((bytes_needed + 4095) / 4096))
|
||||
if [[ "$blocks_needed" -lt 1 ]]; then
|
||||
blocks_needed=1
|
||||
fi
|
||||
dd if=/dev/zero bs=4096 count="$blocks_needed" status=none >>"$force_commit_sentinel"
|
||||
sync
|
||||
current="$(current_usage_bytes)"
|
||||
delta="$(allocation_delta "$current")"
|
||||
done
|
||||
echo "could not force a detectable sticky disk allocation change (delta: ${delta} bytes)" >&2
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
echo "unsupported sticky importer mode: $mode" >&2
|
||||
exit 2
|
||||
|
||||
Reference in New Issue
Block a user