openvibers/openvibe.codes Commits
Fleet routing tests measure resets from now (#243)
Changes
@@@ -2,15 +2,16 @@/*** Codes C9c, end to end: a task with no agent named is `auto`, and the router reads the fleet the machines reported.-- * Today (2026-10-30) Codex's week is spent, OpenCode's month is spent and Command Code is at 96% of its week, so auto++ * On 2026-10-30 Codex's week was spent, OpenCode's month is spent and Command Code is at 96% of its week, so auto* must land on MiniMax or DeepSeek — and never on Claude. A finished or unfinished task then tells the person once.*/const assert = require('assert');const { boot, check, done } = require('./helpers/boot');const NODE = 'nod_01J8Z3Q4R5S6T7V8W9X0Y1Z2N3';--const RESET_WEEK = '2026-11-04T00:00:00Z';--const RESET_MONTH = '2026-11-02T00:00:00Z';++// Measured from now, so the fleet stays spent however late the test runs (fixed dates went stale on 2026-11-02).++const RESET_WEEK = new Date(Date.now() + 4.5 * 86400000).toISOString();++const RESET_MONTH = new Date(Date.now() + 2.5 * 86400000).toISOString();(async () => {const submits = [];@@@ -10,9 +10,11 @@ const assert = require('node:assert/strict');const { check, done } = require('./helpers/boot');const router = require('../engine/router');--const NOW = Date.parse('2026-10-30T12:00:00Z');--const RESET_WEEK = '2026-11-04T00:00:00Z';--const RESET_MONTH = '2026-11-02T00:00:00Z';++// The fleet as it was on 2026-10-30, measured from now: the router reads the clock itself in places, so fixed dates++// went stale the day OpenCode's month really reset (2026-11-02).++const NOW = Date.now();++const RESET_WEEK = new Date(NOW + 4.5 * 86400000).toISOString();++const RESET_MONTH = new Date(NOW + 2.5 * 86400000).toISOString();const runner = (enabled = true) => ({ enabled, max: 4 });const cfg = { subagents: { cx: runner(), mm: runner(), cc: runner(), oc: runner(), dsh: runner(), claude: runner(false) } };@@@ -36,7 +38,7 @@ const BASIC = 'Rename the variable in the one file and reformat it.';await check('a window at the full mark is spent, and one that has already reset is not', () => {assert.equal(router.windowFull({ pct: 96 }, NOW), true, '96% of a week is spent, not 4% left');assert.equal(router.windowFull({ used: 19, limit: 20 }, NOW), true, 'used/limit is the same reading');-- assert.equal(router.windowFull({ pct: 100, resets_at: '2026-10-29T00:00:00Z' }, NOW), false, 'it freed yesterday');++ assert.equal(router.windowFull({ pct: 100, resets_at: new Date(NOW - 86400000).toISOString() }, NOW), false, 'it freed yesterday');assert.equal(router.windowFull({ pct: 40 }, NOW), false);assert.equal(router.windowFull(null, NOW), false);assert.equal(router.FULL_PCT, 95);
@@ -2,15 +2,16 @@
@@ -2,15 +2,16 @@
/**
/**
* Codes C9c, end to end: a task with no agent named is `auto`, and the router reads the fleet the machines reported.
* Codes C9c, end to end: a task with no agent named is `auto`, and the router reads the fleet the machines reported.
- * Today (2026-10-30) Codex's week is spent, OpenCode's month is spent and Command Code is at 96% of its week, so auto
+ * On 2026-10-30 Codex's week was spent, OpenCode's month is spent and Command Code is at 96% of its week, so auto
* must land on MiniMax or DeepSeek — and never on Claude. A finished or unfinished task then tells the person once.
* must land on MiniMax or DeepSeek — and never on Claude. A finished or unfinished task then tells the person once.
*/
*/
const assert = require('assert');
const assert = require('assert');
const { boot, check, done } = require('./helpers/boot');
const { boot, check, done } = require('./helpers/boot');
const NODE = 'nod_01J8Z3Q4R5S6T7V8W9X0Y1Z2N3';
const NODE = 'nod_01J8Z3Q4R5S6T7V8W9X0Y1Z2N3';
-const RESET_WEEK = '2026-11-04T00:00:00Z';
-const RESET_MONTH = '2026-11-02T00:00:00Z';
+// Measured from now, so the fleet stays spent however late the test runs (fixed dates went stale on 2026-11-02).
+const RESET_WEEK = new Date(Date.now() + 4.5 * 86400000).toISOString();
+const RESET_MONTH = new Date(Date.now() + 2.5 * 86400000).toISOString();
(async () => {
(async () => {
const submits = [];
const submits = [];
@@ -10,9 +10,11 @@ const assert = require('node:assert/strict');
@@ -10,9 +10,11 @@ const assert = require('node:assert/strict');
const { check, done } = require('./helpers/boot');
const { check, done } = require('./helpers/boot');
const router = require('../engine/router');
const router = require('../engine/router');
-const NOW = Date.parse('2026-10-30T12:00:00Z');
-const RESET_WEEK = '2026-11-04T00:00:00Z';
-const RESET_MONTH = '2026-11-02T00:00:00Z';
+// The fleet as it was on 2026-10-30, measured from now: the router reads the clock itself in places, so fixed dates
+// went stale the day OpenCode's month really reset (2026-11-02).
+const NOW = Date.now();
+const RESET_WEEK = new Date(NOW + 4.5 * 86400000).toISOString();
+const RESET_MONTH = new Date(NOW + 2.5 * 86400000).toISOString();
const runner = (enabled = true) => ({ enabled, max: 4 });
const runner = (enabled = true) => ({ enabled, max: 4 });
const cfg = { subagents: { cx: runner(), mm: runner(), cc: runner(), oc: runner(), dsh: runner(), claude: runner(false) } };
const cfg = { subagents: { cx: runner(), mm: runner(), cc: runner(), oc: runner(), dsh: runner(), claude: runner(false) } };
@@ -36,7 +38,7 @@ const BASIC = 'Rename the variable in the one file and reformat it.';
@@ -36,7 +38,7 @@ const BASIC = 'Rename the variable in the one file and reformat it.';
await check('a window at the full mark is spent, and one that has already reset is not', () => {
await check('a window at the full mark is spent, and one that has already reset is not', () => {
assert.equal(router.windowFull({ pct: 96 }, NOW), true, '96% of a week is spent, not 4% left');
assert.equal(router.windowFull({ pct: 96 }, NOW), true, '96% of a week is spent, not 4% left');
assert.equal(router.windowFull({ used: 19, limit: 20 }, NOW), true, 'used/limit is the same reading');
assert.equal(router.windowFull({ used: 19, limit: 20 }, NOW), true, 'used/limit is the same reading');
- assert.equal(router.windowFull({ pct: 100, resets_at: '2026-10-29T00:00:00Z' }, NOW), false, 'it freed yesterday');
+ assert.equal(router.windowFull({ pct: 100, resets_at: new Date(NOW - 86400000).toISOString() }, NOW), false, 'it freed yesterday');
assert.equal(router.windowFull({ pct: 40 }, NOW), false);
assert.equal(router.windowFull({ pct: 40 }, NOW), false);
assert.equal(router.windowFull(null, NOW), false);
assert.equal(router.windowFull(null, NOW), false);
assert.equal(router.FULL_PCT, 95);
assert.equal(router.FULL_PCT, 95);