Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix: pre-landing review fixes (remote verify carries the item result, doc-only failure stays a gate result, re-mined weights drop deleted files, order-based watchdog test, empty pull test, TTL on long repro recipes)

garrytan8920ad64aae3
diff --git a/docs/eval/managed-sync-stall-repro.md b/docs/eval/managed-sync-stall-repro.md
index 901f7b91e3..629d42e4cf 100644
--- a/docs/eval/managed-sync-stall-repro.md
+++ b/docs/eval/managed-sync-stall-repro.md
@@ -178,7 +178,7 @@ bun scripts/bench/managed-sync-stall-repro.ts --cli-repo <checkout> --files 600
The reporter-shape run on a VM:
```bash
-UBI_OWNER=gbra59 scripts/ubicloud/ubi-runner.sh run -s standard-16 --setup scripts/bench/stall-repro-vm-setup.sh \
+UBI_OWNER=gbra59 scripts/ubicloud/ubi-runner.sh run -s standard-16 --ttl-hours 4 --setup scripts/bench/stall-repro-vm-setup.sh \
--env RELEASE_COMMIT=8e11aa1f -- 'bun scripts/bench/managed-sync-stall-repro.ts --cli-repo ../gbrain-release \
--files 15000 --history 1500 --legacy-facts 60 --marker-pages 6 --doomed-pages 9 --drip-rows 6 --backlog-marker-pages 20 \
--rtt 57 --pool-size 10 --max-minutes 170 --passes 3 --adoption-interval 120 --stall-signal SIGUSR2 --out .context/bench/stall-run'
diff --git a/docs/eval/managed-sync-two-consumer-repro.md b/docs/eval/managed-sync-two-consumer-repro.md
index 5c196d0ced..96fe744e6b 100644
--- a/docs/eval/managed-sync-two-consumer-repro.md
+++ b/docs/eval/managed-sync-two-consumer-repro.md
@@ -288,7 +288,7 @@ so a `ClientRead` wedge is visible in one command; leave
```bash
# the mechanism, either build (RELEASE_COMMIT for 0.60.110; omit --cli-repo for this branch)
-UBI_OWNER=gbra61 scripts/ubicloud/ubi-runner.sh run -s standard-16 --setup scripts/bench/stall-repro-vm-setup.sh \
+UBI_OWNER=gbra61 scripts/ubicloud/ubi-runner.sh run -s standard-16 --ttl-hours 4 --setup scripts/bench/stall-repro-vm-setup.sh \
--env RELEASE_COMMIT=1935c74a9 -- 'python3 scripts/bench/stall-debug-instrument.py ../gbrain-release && \
bun scripts/bench/managed-sync-stall-repro.ts --cli-repo ../gbrain-release --scenario passes --lanes 1 --files 3000 --history 300 \
--legacy-facts 0 --marker-pages 0 --doomed-pages 0 --backlog-marker-pages 0 --adoption-interval 0 --rtt 57 --pool-size 10 \
diff --git a/scripts/ci-ubicloud.ts b/scripts/ci-ubicloud.ts
index db8fc4f685..aed0a4ffe0 100755
--- a/scripts/ci-ubicloud.ts
+++ b/scripts/ci-ubicloud.ts
@@ -257,7 +257,6 @@ async function main() {
if (classification === "DOC_ONLY") {
log("--diff: doc-only diff — running the doc checks locally, then gitleaks (ci:local doc-only fast-path)");
if (spawnSync("bash", ["scripts/ci-doc-checks.sh"], { cwd: ROOT, stdio: "inherit" }).status !== 0) {
- await leftover(owner, [], false);
process.exit(1);
}
opts.lanes = new Set(["gitleaks"]);
diff --git a/scripts/mine-shard-weights.ts b/scripts/mine-shard-weights.ts
index 5a83f09dd4..fa7507701d 100644
--- a/scripts/mine-shard-weights.ts
+++ b/scripts/mine-shard-weights.ts
@@ -309,7 +309,8 @@ async function main(): Promise<void> {
mined = [{ run: null, commit: null, jobs: [], raw, measured: mineWeights(raw, lane, { e2eProfile }) }];
}
const { run, commit, attempt, jobs: fullJobs, expectedFiles, raw } = mined[0]!;
- const measured = medianWeights(mined.map(m => m.measured));
+ // The newest run (the first --run) names the current files; one only older runs measured was deleted or renamed since.
+ const measured = new Map([...medianWeights(mined.map(m => m.measured))].filter(([file]) => mined[0]!.measured.has(file)));
// Downloaded artifacts/stdin may cover only one shard. Only an authoritative
// complete GitHub unit/serial/full-E2E run replaces the full map; selected E2E always
// merges because its executed corpus depends on the diff.
diff --git a/scripts/ubicloud/ci-item.sh b/scripts/ubicloud/ci-item.sh
index 5f768d9134..6aab0913a3 100755
--- a/scripts/ubicloud/ci-item.sh
+++ b/scripts/ubicloud/ci-item.sh
@@ -21,6 +21,7 @@
# __ubi_item_begin__ <lane> <file>
# __ubi_item__ rc=<exit> ms=<duration> lane=<lane> file=<file>
# __ubi_load__ load1=<1-minute load average> vcpus=<nproc> (the VM's load as the item ended)
+# The script exits with the highest item exit code, so a one-item run (.gstack/ubicloud.json's verify) carries its result.
set -uo pipefail
cd "$(dirname "$0")/../.."
@@ -78,6 +79,7 @@ run_item() {
esac
}
+worst=0
items=("$@")
[ "${#items[@]}" -gt 0 ] || items=("-")
for item in "${items[@]}"; do
@@ -85,6 +87,8 @@ for item in "${items[@]}"; do
start=$(date +%s%3N)
run_item "$item" 2>&1
rc=$?
+ [ "$rc" -gt "$worst" ] && worst=$rc
echo "__ubi_item__ rc=$rc ms=$(( $(date +%s%3N) - start )) lane=$lane file=$item"
echo "__ubi_load__ load1=$(cut -d' ' -f1 /proc/loadavg) vcpus=$(nproc)"
done
+exit "$worst"
diff --git a/test/scripts/ci-ubicloud-schedule.test.ts b/test/scripts/ci-ubicloud-schedule.test.ts
index ec1826b770..d126cfc9ba 100644
--- a/test/scripts/ci-ubicloud-schedule.test.ts
+++ b/test/scripts/ci-ubicloud-schedule.test.ts
@@ -228,3 +228,11 @@ describe("gate location", () => {
}
});
});
+
+describe("ci-item.sh exit status", () => {
+ it("exits with the worst item's rc, so a one-item run (.gstack/ubicloud.json's verify) carries its result", () => {
+ const r = spawnSync("bash", [resolve(import.meta.dir, "../../scripts/ubicloud/ci-item.sh"), "no-such-lane"], { env: { ...process.env, SLOT: "1" }, encoding: "utf8" });
+ expect(r.stdout).toContain("__ubi_item__ rc=2 ");
+ expect(r.status).toBe(2);
+ });
+});
diff --git a/test/scripts/mine-shard-weights.test.ts b/test/scripts/mine-shard-weights.test.ts
index 95c6667030..dc634d6b76 100644
--- a/test/scripts/mine-shard-weights.test.ts
+++ b/test/scripts/mine-shard-weights.test.ts
@@ -493,9 +493,10 @@ it('a refresh from several GitHub runs takes each file\'s median, so one fast or
writeFileSync(join(fixtures, `${id}-timings-unit-1.log`), shard('test (1)', files.slice(0, 1)));
writeFileSync(join(fixtures, `${id}-timings-unit-2.log`), shard('test (2)', files.slice(1)));
};
- run('101', 'commit-a', [['test/one.test.ts', 1000], ['test/two.test.ts', 9000]]);
+ run('101', 'commit-a', [['test/one.test.ts', 1000], ['test/two.test.ts', 9000], ['test/new.test.ts', 500]]);
run('102', 'commit-b', [['test/one.test.ts', 2000], ['test/two.test.ts', 6000]]);
- run('103', 'commit-c', [['test/one.test.ts', 4000], ['test/two.test.ts', 3000], ['test/new.test.ts', 500]]);
+ // test/gone.test.ts was deleted before the newest run (101), so it must not stay in the weights.
+ run('103', 'commit-c', [['test/one.test.ts', 4000], ['test/two.test.ts', 3000], ['test/gone.test.ts', 700]]);
run('104', 'commit-d', [['test/one.test.ts', 1], ['test/two.test.ts', 1]], 'failure');
const out = join(dir, 'weights.json');
const meta = join(dir, 'weights.metadata.json');
diff --git a/test/scripts/ubi-runner-run.test.ts b/test/scripts/ubi-runner-run.test.ts
index 76268d24cd..28dd8b9334 100644
--- a/test/scripts/ubi-runner-run.test.ts
+++ b/test/scripts/ubi-runner-run.test.ts
@@ -46,6 +46,7 @@ const FAKE_SSH = [
" *\"cat > ~/.ubirun-setup.sh\"*) cat > \"$root/ubirun-setup.sh\" ;;",
" *\"tar -xzf -\"*) cat > /dev/null ;;",
" *\"tar -czf -\"*) base=${cmd##* }; tar -czf - -C \"$root/remote-fs\" \"$base\" ;;",
+ " *\"ls -d -- \"*) g=${cmd#*ls -d -- }; g=${g%% *}; ls -d -- \"$root/remote-fs/\"$g >/dev/null 2>&1 ;;",
" *\"bash -l ~/.ubirun-setup.sh\"*) echo \"setup start\"; if [ -f \"$root/setup-mode\" ]; then bash -c \"$(cat \"$root/setup-mode\")\"; fi; echo \"setup done\" ;;",
" *\"bash -lc \"*) if [ -f \"$root/command-mode\" ]; then bash -c \"$(cat \"$root/command-mode\")\"; else echo \"ran: $cmd\"; fi ;;",
" *) : ;;",
@@ -267,7 +268,8 @@ describe("watchdog", () => {
it("times each command on its own clock: a silent command dies while another on the same VM keeps printing", async () => {
knownVm();
- writeFileSync(join(dir, "command-mode"), 'if [ -f "$UBI_FAKE_ROOT/chatty" ]; then rm -f "$UBI_FAKE_ROOT/chatty"; for i in $(seq 1 16); do echo "chat $i"; sleep 0.5; done; else sleep 12; fi');
+ // The chatty command prints until the test says the silent one has returned, so the order is fixed, not raced on timing.
+ writeFileSync(join(dir, "command-mode"), 'if [ -f "$UBI_FAKE_ROOT/chatty" ]; then rm -f "$UBI_FAKE_ROOT/chatty"; i=0; while [ ! -f "$UBI_FAKE_ROOT/silent-done" ] && [ $i -lt 100 ]; do i=$((i + 1)); echo "chat $i"; sleep 0.5; done; echo "chat end"; else sleep 12; fi');
writeFileSync(join(dir, "chatty"), "");
let chattyDone = false;
const chatty = run(["ssh", "vm-a", "chatty"], { UBI_IDLE_TIMEOUT: "3" }).then((r) => ((chattyDone = true), r));
@@ -275,9 +277,10 @@ describe("watchdog", () => {
const silent = await run(["ssh", "vm-a", "silent"], { UBI_IDLE_TIMEOUT: "3" });
expect(silent.code).toBe(124);
expect(chattyDone).toBe(false);
+ writeFileSync(join(dir, "silent-done"), "");
const c = await chatty;
expect(c.code).toBe(0);
- expect(c.stdout).toContain("chat 16");
+ expect(c.stdout).toContain("chat end");
}, 60_000);
it("ssh NAME COMMAND hands the caller's stdin to the remote command", async () => {
@@ -442,6 +445,15 @@ describe("verify", () => {
expect(api.vms.size).toBe(0);
}, 60_000);
+ it("a pull whose remote glob matches nothing is reported and skipped, not a failure", async () => {
+ serve();
+ knownVm();
+ const r = await run(["pull", "vm-a", "heavy-logs", join(dir, "out")]);
+ expect(r.code).toBe(0);
+ expect(r.stderr).toContain("pull: nothing matches heavy-logs");
+ expect(read("ssh.log")).not.toContain("tar -czf - heavy-logs");
+ }, 60_000);
+
it("the committed .gstack/ubicloud.json is accepted: its setup is inside the checkout and it forwards nothing", async () => {
const cfg = JSON.parse(readFileSync(join(ROOT, ".gstack/ubicloud.json"), "utf8")) as { setup: string; command: string; pass?: string[]; env?: string[] };
expect(existsSync(join(ROOT, cfg.setup))).toBe(true);