From de293e7b316e4554b5a51e3cd368b81bd8d3951b Mon Sep 17 00:00:00 2001 From: Vikas Singhal Date: Tue, 13 Oct 2026 14:17:35 +0530 Subject: [PATCH] test(drift): await the judge's real promises instead of a 150ms sleep (v0.461.1) The flat sleep lost to three stub round-trips on the expresstech droplet at load ~22, failing the make-live governance gate every run while the test passed alone. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 7 +++++++ package-lock.json | 4 ++-- package.json | 2 +- scripts/drift-nudge-test.cjs | 15 ++++++++++++++- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0387ea8e..00d6ff3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,13 @@ Every PR that bumps `package.json` moves its entries from **Unreleased** into a new version heading in the same commit. ## [Unreleased] + +## [0.461.1] - 2026-10-13 +### Fixed +- **`drift-nudge-test` no longer fails the deploy gate on a loaded box.** It waited a flat 150ms for the + background drift judge, which makes three HTTP round trips to its stub. On a 2 GB droplet at load ~22 + that lost the race on every `make-live` run, while the same test passed when run alone. It now awaits the + judge's real promises. ### Docs - `docs/code-graph-plan.md` — parked research on a code-graph for coding agents (fleet exploration share, tool landscape, evidence, and the A/B to run), plus `scripts/code-exploration-share.mjs`, the diff --git a/package-lock.json b/package-lock.json index 39da1b00..1636c444 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "agent-os", - "version": "0.461.0", + "version": "0.461.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "agent-os", - "version": "0.461.0", + "version": "0.461.1", "license": "MIT", "bin": { "agent-os": "bin/agent-os" diff --git a/package.json b/package.json index bab65f38..68609e73 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "agent-os", - "version": "0.461.0", + "version": "0.461.1", "description": "A generic, governed operating system for running autonomous agents safely across brands. Ships with a local web console.", "license": "MIT", "type": "commonjs", diff --git a/scripts/drift-nudge-test.cjs b/scripts/drift-nudge-test.cjs index 1e621e60..1e824b0c 100644 --- a/scripts/drift-nudge-test.cjs +++ b/scripts/drift-nudge-test.cjs @@ -209,7 +209,20 @@ for (const t of ['drift.judged', 'drift.judge_failed', 'drift.nudged', 'drift.es { kind: 'activity', tool: 'Bash', label: 'Ran a command', detail: 'cat .github/workflows/ci.yml', status: 'ok', ts: 2 }, { kind: 'assistant', text: 'The CI cache key looks wrong, let me rework the whole cache layer.', ts: 3 }, ] }); - const settle = () => new Promise((r) => setTimeout(r, 150)); + // Wait for the judgements the gate fired in the background — the REAL promises, not a guessed sleep. + // It used to be a flat 150ms, which three stub round-trips lose on a loaded box (a 2 GB droplet at load + // ~22 failed the deploy gate on every run while the same test passed alone). + const inFlight = new Set(); + const runJudge = tm.runDriftJudge.bind(tm); + tm.runDriftJudge = (...a) => { + const p = Promise.resolve(runJudge(...a)).finally(() => inFlight.delete(p)); + inFlight.add(p); + return p; + }; + const settle = async () => { + await new Promise((r) => setTimeout(r, 10)); + while (inFlight.size) await Promise.allSettled([...inFlight]); + }; let cmdSeq = 0; const bash = (sid, agent, n) => { const out = [];