From e01393235ef52fc05f2a4a3768f22e73eb12cd73 Mon Sep 17 00:00:00 2001 From: Igor Soarez Date: Fri, 6 Nov 2026 13:58:14 +0200 Subject: pi forum: give a fresh session its notice with the first run Appended to a session with no conversation yet -- a new pi, or just after /new -- the join notice sat ahead of the system message pi records at the first run, and pi then sent that message without its content: the provider refused every request with a 400. Queue it for the next turn instead, which pi places after the system message. --- config/pi/extensions/forum.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'config') diff --git a/config/pi/extensions/forum.ts b/config/pi/extensions/forum.ts index 05d5edc..4b16103 100644 --- a/config/pi/extensions/forum.ts +++ b/config/pi/extensions/forum.ts @@ -567,10 +567,15 @@ export default function (pi: ExtensionAPI) { deliver(); } + // A notice that wakes nobody. A session with no conversation yet -- a fresh + // pi, or just after /new -- gets it with its first run instead: appended + // now, it would sit ahead of the system message pi records at that run, and + // pi then sends that message without its content, which providers reject. function notice(details: NoticeDetails, text: string) { + const started = session?.sessionManager.getBranch().some((e) => e.type === "message") ?? false; pi.sendMessage( { customType: NOTICE_TYPE, content: text, display: true, details }, - { triggerTurn: false }, + started ? { triggerTurn: false } : { deliverAs: "nextTurn" }, ); } -- cgit v1.2.3