all repos — dot @ e01393235ef52fc05f2a4a3768f22e73eb12cd73

Shell, editor and terminal configuration, and the tools that go with them

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.
Igor Soarez igor@soarez.org
Fri, 06 Nov 2026 13:58:14 +0200
commit

e01393235ef52fc05f2a4a3768f22e73eb12cd73

parent

3cfe984ab7e26aaad4a2442501526b6a2f232bc0

1 files changed, 6 insertions(+), 1 deletions(-)

jump to
M config/pi/extensions/forum.ts → config/pi/extensions/forum.ts

@@ -567,10 +567,15 @@ due.push({ details, text: messageContent(details, forumNames(forums)), forums, sent: false });

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<NoticeDetails>( { customType: NOTICE_TYPE, content: text, display: true, details }, - { triggerTurn: false }, + started ? { triggerTurn: false } : { deliverAs: "nextTurn" }, ); }