Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

ci: mine Postgres-arm weights as per-file medians; re-mined

time-attack6c1230101424
diff --git a/scripts/postgres-arm-weights.json b/scripts/postgres-arm-weights.json
index 25d5b92318..1a2045b3e3 100644
--- a/scripts/postgres-arm-weights.json
+++ b/scripts/postgres-arm-weights.json
@@ -1,108 +1,108 @@
{
- "test/alias-source-cascade-5094.test.ts": 26505,
- "test/attribution-backfill-history.test.ts": 65952,
- "test/behavior-change-notice.test.ts": 13178,
- "test/capture-consent-admission.test.ts": 50959,
- "test/chronicle-backfill-max-usd.test.ts": 12717,
- "test/colon-slug-windows-5032.test.ts": 12121,
- "test/company-brain-policy.test.ts": 23904,
- "test/company-brain-runtime.test.ts": 44102,
- "test/cycle/synthesize-concepts-merge.test.ts": 13535,
- "test/decide/conflict-proposals-managed.test.ts": 13387,
- "test/declared-lineage-visibility.test.ts": 10400,
- "test/derived-link-reconciliation.test.ts": 8503,
- "test/doctor-frontmatter-holds.test.ts": 12232,
- "test/doctor-routing-skill-pack-source.test.ts": 9804,
- "test/embedding-completion-atomic.serial.test.ts": 11308,
- "test/engine-sql-facts-keyset.test.ts": 11144,
- "test/extract-endpoint-revision.serial.test.ts": 10592,
- "test/fence-repair-receipts.test.ts": 14456,
- "test/graduation-copy.test.ts": 90847,
- "test/graduation-digest.test.ts": 3793,
- "test/graduation-drain.test.ts": 25358,
- "test/graduation-inventory.test.ts": 8644,
- "test/graduation-rollback.test.ts": 147274,
- "test/graduation-state.test.ts": 210852,
- "test/graduation-target.test.ts": 8888,
- "test/graduation-verify.test.ts": 26562,
- "test/grandfather-managed.test.ts": 68489,
- "test/harness-skills-epoch.test.ts": 7091,
- "test/held-read-signals.test.ts": 12384,
- "test/import-frontmatter-key-order-5158.test.ts": 8513,
- "test/import-revision-concurrency.test.ts": 13854,
- "test/lane-apply-pipelining.test.ts": 6481,
- "test/link-preparation-shared-index.test.ts": 24352,
- "test/links-attendance-blocked.test.ts": 12509,
- "test/managed-cycle-pull-upstream.test.ts": 11245,
- "test/managed-lint.test.ts": 17059,
- "test/managed-maintenance-links.test.ts": 8537,
- "test/managed-sweep-corpus-windows.test.ts": 9465,
- "test/managed-sweep-refused-window-retry.test.ts": 18837,
- "test/managed-sweep-timeline.test.ts": 10522,
- "test/managed-sync-bulk.test.ts": 12301,
- "test/managed-sync-chunker-version.test.ts": 15067,
- "test/managed-sync-concurrent-write-hold.test.ts": 29665,
- "test/managed-sync-drain.test.ts": 14832,
- "test/managed-sync-foreground-priority.test.ts": 56761,
- "test/managed-sync-group-completion.test.ts": 13673,
- "test/managed-sync-group-uncommitted-head.test.ts": 20865,
- "test/managed-sync-images-5493.test.ts": 13227,
- "test/managed-sync-lanes.test.ts": 16676,
- "test/managed-sync-page-fault-holds.test.ts": 26505,
- "test/managed-sync-pinned-reads.test.ts": 34348,
- "test/managed-sync-preparation-stalled-holds.test.ts": 47718,
- "test/managed-sync-row-parity.test.ts": 13616,
- "test/managed-sync-stale-group-head.test.ts": 8474,
- "test/owner-refusal.test.ts": 10326,
- "test/pack-relation-direction-engine.test.ts": 12632,
- "test/page-embedding-install-batch.test.ts": 12007,
- "test/page-state-engine.test.ts": 4167,
- "test/persistence-commit-durability.test.ts": 13121,
- "test/persistence-deactivate.test.ts": 39388,
- "test/persistence-diagnostics.test.ts": 12315,
- "test/persistence-file-import.test.ts": 43691,
- "test/persistence-git-subdir-origin.test.ts": 18385,
- "test/persistence-graph-publication.test.ts": 11315,
- "test/persistence-history-fixture.test.ts": 42405,
- "test/persistence-image-import.serial.test.ts": 8692,
- "test/persistence-import-batch.test.ts": 28758,
- "test/persistence-managed-lifecycle.test.ts": 30953,
- "test/persistence-managed-sync.test.ts": 92773,
- "test/persistence-manifest-git-scope.test.ts": 12807,
- "test/persistence-memory-mutations.test.ts": 16867,
- "test/persistence-page-authority.test.ts": 15809,
- "test/persistence-physical-root-device.test.ts": 9267,
- "test/persistence-preactivation-claim.test.ts": 16175,
- "test/persistence-reconcile-git-dirty-6138.test.ts": 11250,
- "test/persistence-skill-bundles.serial.test.ts": 9366,
- "test/persistence-skill-crash.slow.test.ts": 64347,
- "test/persistence-sync-cursor-options.test.ts": 15512,
- "test/persistence-sync-fence-holds.test.ts": 29124,
- "test/persistence-sync-holds.test.ts": 22612,
- "test/persistence-write-stall.test.ts": 10465,
- "test/persistence-writer-fences.test.ts": 8032,
- "test/remediation-manual-only.test.ts": 11913,
- "test/repair-embedding-effects.test.ts": 12689,
- "test/repair-failed-writes-drift-w411.test.ts": 8780,
- "test/repair-fences.test.ts": 30985,
- "test/repair-frontmatter.test.ts": 24361,
- "test/scripts/test-stress-postgres.test.ts": 12993,
- "test/shared-content-freshness.test.ts": 13236,
- "test/shared-skills-catalog.test.ts": 72063,
- "test/shared-skills-retention-capacity.test.ts": 8309,
- "test/shared-skills-source-opt-out.test.ts": 8559,
- "test/shared-skills-writer-boundary.test.ts": 29220,
- "test/source-retire-missing-checkout.test.ts": 10161,
- "test/stats-health-source-scope.test.ts": 4550,
- "test/sync-drain-claims.test.ts": 17440,
- "test/sync-drain-write-capacity.test.ts": 12295,
- "test/sync-frontmatter-recovery.test.ts": 11527,
- "test/sync-frontmatter-slug-conflict.test.ts": 8308,
- "test/sync-group-member-order.test.ts": 18676,
- "test/sync-legacy-holds.test.ts": 15939,
- "test/sync-waiver-budget.test.ts": 11071,
- "test/takes-vector-lifecycle-5885.serial.test.ts": 14900,
- "test/withdrawal-overlay-concurrency.test.ts": 9691,
- "test/withdrawal-publication-file.test.ts": 9737,
- "test/writer-status-owner-backends.test.ts": 8954
+ "test/alias-source-cascade-5094.test.ts": 11388,
+ "test/attribution-backfill-history.test.ts": 27113,
+ "test/behavior-change-notice.test.ts": 6212,
+ "test/capture-consent-admission.test.ts": 8222,
+ "test/chronicle-backfill-max-usd.test.ts": 5251,
+ "test/colon-slug-windows-5032.test.ts": 6912,
+ "test/company-brain-policy.test.ts": 12603,
+ "test/company-brain-runtime.test.ts": 22824,
+ "test/cycle/synthesize-concepts-merge.test.ts": 7096,
+ "test/decide/conflict-proposals-managed.test.ts": 5517,
+ "test/declared-lineage-visibility.test.ts": 5553,
+ "test/derived-link-reconciliation.test.ts": 5803,
+ "test/doctor-frontmatter-holds.test.ts": 7718,
+ "test/doctor-routing-skill-pack-source.test.ts": 5554,
+ "test/embedding-completion-atomic.serial.test.ts": 5398,
+ "test/engine-sql-facts-keyset.test.ts": 4613,
+ "test/extract-endpoint-revision.serial.test.ts": 5426,
+ "test/fence-repair-receipts.test.ts": 8063,
+ "test/graduation-copy.test.ts": 66236,
+ "test/graduation-digest.test.ts": 2436,
+ "test/graduation-drain.test.ts": 10267,
+ "test/graduation-inventory.test.ts": 4009,
+ "test/graduation-rollback.test.ts": 94547,
+ "test/graduation-state.test.ts": 127763,
+ "test/graduation-target.test.ts": 2610,
+ "test/graduation-verify.test.ts": 14279,
+ "test/grandfather-managed.test.ts": 48957,
+ "test/harness-skills-epoch.test.ts": 3004,
+ "test/held-read-signals.test.ts": 6976,
+ "test/import-frontmatter-key-order-5158.test.ts": 4264,
+ "test/import-revision-concurrency.test.ts": 4197,
+ "test/lane-apply-pipelining.test.ts": 3494,
+ "test/link-preparation-shared-index.test.ts": 8218,
+ "test/links-attendance-blocked.test.ts": 6950,
+ "test/managed-cycle-pull-upstream.test.ts": 6642,
+ "test/managed-lint.test.ts": 9759,
+ "test/managed-maintenance-links.test.ts": 5357,
+ "test/managed-sweep-corpus-windows.test.ts": 6592,
+ "test/managed-sweep-refused-window-retry.test.ts": 9454,
+ "test/managed-sweep-timeline.test.ts": 5259,
+ "test/managed-sync-bulk.test.ts": 4840,
+ "test/managed-sync-chunker-version.test.ts": 5750,
+ "test/managed-sync-concurrent-write-hold.test.ts": 14224,
+ "test/managed-sync-drain.test.ts": 6516,
+ "test/managed-sync-foreground-priority.test.ts": 50818,
+ "test/managed-sync-group-completion.test.ts": 8640,
+ "test/managed-sync-group-uncommitted-head.test.ts": 16335,
+ "test/managed-sync-images-5493.test.ts": 7844,
+ "test/managed-sync-lanes.test.ts": 11058,
+ "test/managed-sync-page-fault-holds.test.ts": 13616,
+ "test/managed-sync-pinned-reads.test.ts": 21910,
+ "test/managed-sync-preparation-stalled-holds.test.ts": 33150,
+ "test/managed-sync-row-parity.test.ts": 7487,
+ "test/managed-sync-stale-group-head.test.ts": 3274,
+ "test/owner-refusal.test.ts": 4382,
+ "test/pack-relation-direction-engine.test.ts": 5026,
+ "test/page-embedding-install-batch.test.ts": 5021,
+ "test/page-state-engine.test.ts": 2380,
+ "test/persistence-commit-durability.test.ts": 4578,
+ "test/persistence-deactivate.test.ts": 16183,
+ "test/persistence-diagnostics.test.ts": 5526,
+ "test/persistence-file-import.test.ts": 24725,
+ "test/persistence-git-subdir-origin.test.ts": 8590,
+ "test/persistence-graph-publication.test.ts": 4249,
+ "test/persistence-history-fixture.test.ts": 25246,
+ "test/persistence-image-import.serial.test.ts": 4348,
+ "test/persistence-import-batch.test.ts": 18514,
+ "test/persistence-managed-lifecycle.test.ts": 11758,
+ "test/persistence-managed-sync.test.ts": 69169,
+ "test/persistence-manifest-git-scope.test.ts": 5298,
+ "test/persistence-memory-mutations.test.ts": 8707,
+ "test/persistence-page-authority.test.ts": 4700,
+ "test/persistence-physical-root-device.test.ts": 4899,
+ "test/persistence-preactivation-claim.test.ts": 7870,
+ "test/persistence-reconcile-git-dirty-6138.test.ts": 4886,
+ "test/persistence-skill-bundles.serial.test.ts": 5384,
+ "test/persistence-skill-crash.slow.test.ts": 41262,
+ "test/persistence-sync-cursor-options.test.ts": 6948,
+ "test/persistence-sync-fence-holds.test.ts": 17454,
+ "test/persistence-sync-holds.test.ts": 15244,
+ "test/persistence-write-stall.test.ts": 4165,
+ "test/persistence-writer-fences.test.ts": 3784,
+ "test/remediation-manual-only.test.ts": 8512,
+ "test/repair-embedding-effects.test.ts": 6204,
+ "test/repair-failed-writes-drift-w411.test.ts": 4849,
+ "test/repair-fences.test.ts": 18467,
+ "test/repair-frontmatter.test.ts": 13932,
+ "test/scripts/test-stress-postgres.test.ts": 11736,
+ "test/shared-content-freshness.test.ts": 4237,
+ "test/shared-skills-catalog.test.ts": 49980,
+ "test/shared-skills-retention-capacity.test.ts": 5212,
+ "test/shared-skills-source-opt-out.test.ts": 4290,
+ "test/shared-skills-writer-boundary.test.ts": 13997,
+ "test/source-retire-missing-checkout.test.ts": 4844,
+ "test/stats-health-source-scope.test.ts": 2657,
+ "test/sync-drain-claims.test.ts": 12214,
+ "test/sync-drain-write-capacity.test.ts": 6867,
+ "test/sync-frontmatter-recovery.test.ts": 5050,
+ "test/sync-frontmatter-slug-conflict.test.ts": 4750,
+ "test/sync-group-member-order.test.ts": 8852,
+ "test/sync-legacy-holds.test.ts": 8989,
+ "test/sync-waiver-budget.test.ts": 5274,
+ "test/takes-vector-lifecycle-5885.serial.test.ts": 8340,
+ "test/withdrawal-overlay-concurrency.test.ts": 4486,
+ "test/withdrawal-publication-file.test.ts": 4605,
+ "test/writer-status-owner-backends.test.ts": 4494
}
diff --git a/scripts/postgres-unit-arms.ts b/scripts/postgres-unit-arms.ts
index 3b0a98e7ec..26acdb433d 100644
--- a/scripts/postgres-unit-arms.ts
+++ b/scripts/postgres-unit-arms.ts
@@ -45,9 +45,14 @@ export function readArmsList(root: string): ArmsList {
return parseArmsList(readFileSync(path, 'utf8'));
}
-/** Per-file durations from GitHub job logs: each `##[group]<file>` line to the next group or endgroup. */
+/**
+ * Per-file durations from GitHub job logs: each `##[group]<file>` line to the
+ * next group or endgroup, the median across logs. The median balances shards
+ * on a typical run; one slow runner's outlier would otherwise set a file's
+ * weight (a max did, and pushed most of the slow suites into one shard).
+ */
export function mineArmWeights(logs: string[]): Map<string, number> {
- const weights = new Map<string, number>();
+ const samples = new Map<string, number[]>();
for (const log of logs) {
let open: { file: string; at: number } | undefined;
for (const line of log.split('\n')) {
@@ -56,13 +61,17 @@ export function mineArmWeights(logs: string[]): Map<string, number> {
const at = m ? Date.parse(m[1]!) : end ? Date.parse(end[1]!) : NaN;
if (!Number.isFinite(at) || (!m && !open)) continue;
if (open && (m || end)) {
- weights.set(open.file, Math.max(weights.get(open.file) ?? 0, at - open.at));
+ samples.set(open.file, [...(samples.get(open.file) ?? []), at - open.at]);
open = undefined;
}
if (m) open = { file: m[2]!, at };
}
}
- return weights;
+ return new Map([...samples].map(([file, ms]) => {
+ const sorted = [...ms].sort((a, b) => a - b);
+ const mid = Math.floor(sorted.length / 2);
+ return [file, sorted.length % 2 ? sorted[mid]! : Math.round((sorted[mid - 1]! + sorted[mid]!) / 2)];
+ }));
}
function main(argv: string[]): number {
diff --git a/test/scripts/postgres-unit-arms.test.ts b/test/scripts/postgres-unit-arms.test.ts
index 6649401961..3bdb19c70a 100644
--- a/test/scripts/postgres-unit-arms.test.ts
+++ b/test/scripts/postgres-unit-arms.test.ts
@@ -47,4 +47,13 @@ describe('postgres-unit-arms list', () => {
].join('\n');
expect(Object.fromEntries(mineArmWeights([log]))).toEqual({ 'test/a.test.ts': 10000, 'test/b.serial.test.ts': 1500 });
});
+
+ test('a file timed in several logs weighs its median, so one slow runner does not set it', () => {
+ const log = (seconds: number) => [
+ `2026-10-05T18:44:00.0000000Z ##[group]test/a.test.ts`,
+ `2026-10-05T18:44:${String(seconds).padStart(2, '0')}.0000000Z ##[endgroup]`,
+ ].join('\n');
+ expect(mineArmWeights([log(10), log(50), log(12)]).get('test/a.test.ts')).toBe(12000);
+ expect(mineArmWeights([log(10), log(50), log(12), log(14)]).get('test/a.test.ts')).toBe(13000);
+ });
});