Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

fix(x-content): close a posting slot three hours after it opens so a missed evening slot never posts in the small hours

nirholas061e2187b74e
diff --git a/api/_lib/x-content/schedule.js b/api/_lib/x-content/schedule.js
index 9369285d0..88efbffca 100644
--- a/api/_lib/x-content/schedule.js
+++ b/api/_lib/x-content/schedule.js
@@ -61,9 +61,9 @@ export function inQuietHours(now, quiet) {
// T2 features shipped features with proof
// T3 proof of work short demos, stats, build notes
// Slot times come from the engagement report's hour-of-day data, and each slot
-// opens at a jittered minute only the seed can reproduce. A slot stays open
-// until the next one starts, so a missed tick (deploy, outage) still posts, but
-// a day never gets more than one post per slot.
+// opens at a jittered minute only the seed can reproduce. A slot stays open for
+// three hours, so a missed tick (deploy, outage) still posts, but a day never
+// gets more than one post per slot and nothing spills into the small hours.
//
// Filling a slot: the slot's own tier first, then lower tiers (T1 slot empty ->
// best T2), so the best available post always gets the best time. A higher tier
@@ -102,12 +102,20 @@ export function slotOpenings(now, cadence = DEFAULT_CADENCE, seed = null) {
return openings.sort((a, b) => a.opensAt - b.opensAt);
}
-// The slot that is open right now (the latest one that has opened), and when
-// the next one opens.
+// How long a slot stays open after it opens. Long enough that a missed run or
+// a deploy does not lose the slot, short enough that an evening slot never
+// spills into the small hours where nobody is reading.
+export const SLOT_OPEN_MINUTES = 180;
+
+// The slot that is open right now (the latest one that has opened, and has not
+// yet closed), and when the next one opens.
export function currentSlot(now, cadence = DEFAULT_CADENCE, seed = null) {
const openings = slotOpenings(now, cadence, seed);
const index = openings.findLastIndex((slot) => slot.opensAt <= now);
- return { slot: index >= 0 ? openings[index] : null, next: openings[index + 1] || null };
+ const latest = index >= 0 ? openings[index] : null;
+ const openFor = Number(cadence.slotOpenMinutes ?? SLOT_OPEN_MINUTES) * MINUTE;
+ const slot = latest && now < latest.opensAt + openFor ? latest : null;
+ return { slot, next: openings[index + 1] || null };
}
// The order tiers are tried in for a slot: its own, then every lower tier,
diff --git a/docs/x-content-pipeline.md b/docs/x-content-pipeline.md
index 7360f2433..3a1b548cb 100644
--- a/docs/x-content-pipeline.md
+++ b/docs/x-content-pipeline.md
@@ -109,7 +109,7 @@ Cadence lives at the top of the file: `slots` (each `{ tier, at }` in UTC), `win
## How the next post is chosen
-**When:** three slots a day, one per tier, at the hours this account's own posts performed best in the engagement report: T3 at 08:00 UTC (2.75x the account median), T1 at 16:00 UTC (2.71x), T2 at 22:00 UTC (2.75x). Each opens at a minute only the production seed can reproduce, and stays open until the next slot starts, so a missed run still posts, but no slot is ever spent twice. Quiet hours are 02:00 to 07:00 UTC.
+**When:** three slots a day, one per tier, at the hours this account's own posts performed best in the engagement report: T3 at 08:00 UTC (2.75x the account median), T1 at 16:00 UTC (2.71x), T2 at 22:00 UTC (2.75x). Each opens at a minute only the production seed can reproduce, and stays open for three hours (`slotOpenMinutes`), so a missed run or a deploy still posts, but no slot is ever spent twice and an evening slot never spills into the small hours. Quiet hours are 02:00 to 07:00 UTC.
**What:** the slot's own tier first, highest priority first. An empty tier falls to the next tier down, so the best available post always gets the best time. A higher tier only fills a lower slot when it has more than one post ready, so the last flagship post is kept for prime time. When nothing is ready, nothing posts: three a day is a ceiling, not a quota.
diff --git a/tests/x-content.test.js b/tests/x-content.test.js
index 463ac6dca..4cbd72891 100644
--- a/tests/x-content.test.js
+++ b/tests/x-content.test.js
@@ -150,9 +150,12 @@ describe('schedule', () => {
expect(jitterMinutes('genesis', 60)).toBe(jitterMinutes('genesis', 60, null));
});
- it('keeps the overnight slot open until the next morning slot', () => {
- expect(currentSlot(Date.parse('2026-09-18T03:00:00Z'), cadence).slot.key).toBe('2026-09-17#2');
+ it('keeps a slot open for three hours, then closes it until the next one', () => {
expect(currentSlot(primeTime, cadence).slot.key).toBe('2026-09-17#1');
+ expect(currentSlot(Date.parse('2026-09-18T00:30:00Z'), cadence).slot.key).toBe('2026-09-17#2');
+ const small = currentSlot(Date.parse('2026-09-18T04:00:00Z'), cadence);
+ expect(small.slot).toBeNull();
+ expect(small.next.key).toBe('2026-09-18#0');
});
it('fills a slot from its own tier first, then lower tiers, then a higher tier with surplus', () => {
@@ -171,7 +174,7 @@ describe('schedule', () => {
it('spends each slot once, and respects embargo, spacing, and the daily cap', () => {
const used = { published: [{ id: 'z', slot: '2026-09-17#1', publishedAt: '2026-09-17T16:40:00Z' }] };
- expect(pickDue({ items: [item('a', { tier: 1 })], state: used, now: primeTime + 5 * HOUR, cadence }).reason).toMatch(/2026-09-17#1.*used|spacing/);
+ expect(pickDue({ items: [item('a', { tier: 1 })], state: used, now: primeTime, cadence }).reason).toMatch(/2026-09-17#1 \(T1\) is used/);
expect(pickDue({ items: [item('a', { tier: 1, notBefore: '2026-09-18T00:00:00Z' })], state: {}, now: primeTime, cadence }).reason).toMatch(/embargoed/);
const recent = { published: [{ id: 'z', slot: 'other', publishedAt: new Date(primeTime - HOUR).toISOString() }] };
expect(pickDue({ items: [item('a', { tier: 1 })], state: recent, now: primeTime, cadence }).reason).toMatch(/spacing/);