Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

bench(production-soak): weekly schedule plus dispatch; --managed-passes and --extract-budget-s pass through run.sh

garrytan5e245c1234a7
diff --git a/.github/workflows/production-soak.yml b/.github/workflows/production-soak.yml
index 334c6b3b47..2a7eea558a 100644
--- a/.github/workflows/production-soak.yml
+++ b/.github/workflows/production-soak.yml
@@ -10,11 +10,13 @@ name: Production soak
# external writer, put/remember, extract/embed --stale) for N hours.
# Writes a JSON scoreboard per cell. Every gate is record-only: this workflow
# never fails on a gate; it fails only when the harness itself breaks.
-# Nightly and on dispatch; never in the PR tier.
+# Weekly (Monday 06:17 UTC, ahead of stable promotion) and on dispatch; never in
+# the PR tier. A gate flips to blocking only after #7355 closes and two
+# consecutive soaks are clean on it, as its own reviewed PR.
on:
schedule:
- - cron: '17 6 * * *'
+ - cron: '17 6 * * 1'
workflow_dispatch:
inputs:
pages:
diff --git a/scripts/bench/production-soak/README.md b/scripts/bench/production-soak/README.md
index bdb8057922..c1b20ea52d 100644
--- a/scripts/bench/production-soak/README.md
+++ b/scripts/bench/production-soak/README.md
@@ -4,7 +4,7 @@ Opt-in harness that runs gbrain the way a large personal brain runs in
production, for hours, and writes a pass/fail scoreboard. It exists because
50k-300k clean synthetic pages never show the bugs a brain with years of
history, connectors, private pages, held items and concurrent writers shows.
-Nightly in `.github/workflows/production-soak.yml`; never in the PR tier.
+Weekly (and on dispatch) in `.github/workflows/production-soak.yml`; never in the PR tier.
## Pieces
@@ -30,7 +30,7 @@ private page's canary or search token.
Every gate is `record` mode: computed, printed, never failing a run. Moving a
gate to `block` is a reviewed edit of `GATES` in `scoreboard.ts` after the
-release owner has seen several nightly runs.
+captain has seen two consecutive clean weekly soaks on that gate.
## Run it
diff --git a/scripts/bench/production-soak/load.ts b/scripts/bench/production-soak/load.ts
index b7f2c5f290..49cfbd9f39 100644
--- a/scripts/bench/production-soak/load.ts
+++ b/scripts/bench/production-soak/load.ts
@@ -3,7 +3,7 @@
* Production-shaped scale soak, step 2: load a fixture.ts brain into Postgres
* the way production got there (GBRA-174). Opt-in bench code, never run in CI.
*
- * bun scripts/bench/production-soak/load.ts --fixture <dir> --work <dir> [--db soak_brain] [--skip-embed] [--extract-budget-s 1200]
+ * bun scripts/bench/production-soak/load.ts --fixture <dir> --work <dir> [--db soak_brain] [--skip-embed] [--extract-budget-s 1200] [--managed-passes 20]
*
* 1. Starts the topology (lib.ts): Postgres, the session and transaction
* PgBouncers and toxiproxy (no latency while loading).
@@ -40,7 +40,7 @@ const WORK = resolve(flag('work') ?? '');
const DB = flag('db', 'soak_brain')!;
const CLI = join(resolve(flag('gbrain-root', REPO)!), 'src', 'cli.ts');
const log = (m: string) => baseLog('soak-load', m);
-if (!flag('fixture') || !flag('work') || !/^[a-z0-9_]+$/.test(DB)) { console.error('usage: load.ts --fixture <dir> --work <dir> [--db name] [--skip-embed] [--extract-budget-s 1200]'); process.exit(2); }
+if (!flag('fixture') || !flag('work') || !/^[a-z0-9_]+$/.test(DB)) { console.error('usage: load.ts --fixture <dir> --work <dir> [--db name] [--skip-embed] [--extract-budget-s 1200] [--managed-passes 20]'); process.exit(2); }
interface SourceRow { id: string; repo: string; head: string; import_base: string; live_pages: number }
const manifest = JSON.parse(readFileSync(join(FIXTURE, 'manifest.json'), 'utf8'));
@@ -120,7 +120,7 @@ async function main() {
if (a.json?.enabled !== true) throw new Error('activation did not enable managed persistence: ' + a.stdout.slice(-1500));
ready.activate_ms = Math.round(now() - t2);
for (const s of sources) {
- ready['first_managed_sync_' + s.id] = await syncUntilSettled(CLI, home, env, s.id, 'first managed sync ' + s.id, 20);
+ ready['first_managed_sync_' + s.id] = await syncUntilSettled(CLI, home, env, s.id, 'first managed sync ' + s.id, Number(flag('managed-passes', '20')));
const st = await gb(CLI, home, env, ['sync', 'status', '--source', s.id, '--json'], { allowFail: true });
ready['after_activation_' + s.id] = { state: st.json?.state ?? null, reason: st.json?.reason ?? null, holds: Array.isArray(st.json?.holds) ? st.json.holds.length : null, legacy_swept: st.json?.convergence?.counts?.legacy_swept ?? null, legacy_recorded: st.json?.convergence?.counts?.legacy_recorded ?? null };
}
diff --git a/scripts/bench/production-soak/run.sh b/scripts/bench/production-soak/run.sh
index bb5bb06b43..5a76d1dfd5 100755
--- a/scripts/bench/production-soak/run.sh
+++ b/scripts/bench/production-soak/run.sh
@@ -3,7 +3,7 @@
# machine (GBRA-174): generate the fixture, load it, soak it, and leave the
# scoreboard in <out>. Every step is deterministic up to the soak itself.
#
-# bash scripts/bench/production-soak/run.sh [--pages 600000] [--rtt-ms 65] [--hours 3] [--seed 7] [--out ~/soak/out] [--label name]
+# bash scripts/bench/production-soak/run.sh [--pages 600000] [--rtt-ms 65] [--hours 3] [--seed 7] [--out ~/soak/out] [--label name] [--managed-passes 20] [--extract-budget-s 1200]
#
# Postgres gets a quarter of the machine's RAM as shared_buffers. The fixture
# and the database stay on the machine; only <out> (events, scoreboard, logs)
@@ -11,7 +11,7 @@
set -euo pipefail
cd "$(dirname "$0")/../../.."
export PATH="$HOME/.bun/bin:$PATH"
-PAGES=600000 RTT=65 HOURS=3 SEED=7 OUT="$HOME/soak/out" LABEL="" EXTRA=()
+PAGES=600000 RTT=65 HOURS=3 SEED=7 OUT="$HOME/soak/out" LABEL="" EXTRA=() LOAD_EXTRA=()
while [ $# -gt 0 ]; do
case $1 in
--pages) PAGES=$2; shift 2 ;;
@@ -20,6 +20,7 @@ while [ $# -gt 0 ]; do
--seed) SEED=$2; shift 2 ;;
--out) OUT=$2; shift 2 ;;
--label) LABEL=$2; shift 2 ;;
+ --managed-passes|--extract-budget-s) LOAD_EXTRA+=("$1" "$2"); shift 2 ;;
*) EXTRA+=("$1"); shift ;;
esac
done
@@ -30,7 +31,7 @@ t0=$(date +%s)
echo "[soak-run] fixture: $PAGES pages, seed $SEED"
bun scripts/bench/production-soak/fixture.ts --out "$ROOT/fixture" --pages "$PAGES" --seed "$SEED" 2>&1 | tee "$OUT/fixture.log"
echo "[soak-run] load (+$(( $(date +%s) - t0 ))s)"
-bun scripts/bench/production-soak/load.ts --fixture "$ROOT/fixture" --work "$ROOT/work" 2>&1 | tee "$OUT/load.log"
+bun scripts/bench/production-soak/load.ts --fixture "$ROOT/fixture" --work "$ROOT/work" "${LOAD_EXTRA[@]}" 2>&1 | tee "$OUT/load.log"
cp "$ROOT/work/ready.json" "$OUT/ready.json"
echo "[soak-run] soak $HOURS h at $RTT ms (+$(( $(date +%s) - t0 ))s)"
bun scripts/bench/production-soak/soak.ts --fixture "$ROOT/fixture" --work "$ROOT/work" --out "$OUT" --rtt-ms "$RTT" --hours "$HOURS" --label "${LABEL:-rtt$RTT}" "${EXTRA[@]}" 2>&1 | tee "$OUT/soak.log"
diff --git a/scripts/bench/production-soak/scoreboard.ts b/scripts/bench/production-soak/scoreboard.ts
index 03b3763ea0..357b7e13a3 100644
--- a/scripts/bench/production-soak/scoreboard.ts
+++ b/scripts/bench/production-soak/scoreboard.ts
@@ -7,7 +7,7 @@
*
* Every gate starts in "record" mode: it is computed and printed, and never
* fails a run. Moving a gate to "block" is a reviewed edit of GATES, decided
- * by the release owner after several nightly runs show the threshold is
+ * by the release owner after two consecutive clean weekly soaks show the threshold is
* stable.
*/
import { existsSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';