fix: normalize Goosed reply payload and restart agent-run worker on release

Add id/created defaults for user_message, ensure metadata in agent-run
gateway before submit, and kickstart the agent-run worker after portal deploy
so queued page-generation runs use the latest runtime bundle.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-07-05 12:04:31 +08:00
parent cb7a446d3e
commit 1165ebf684
4 changed files with 18 additions and 4 deletions
+8 -3
View File
@@ -1,7 +1,8 @@
/**
* Goosed requires user_message.metadata.userVisible (and agentVisible) on /reply.
*/
import crypto from 'node:crypto';
/**
* Goosed requires user_message.metadata.userVisible/agentVisible and created on /reply.
*/
export function ensureGooseUserMessageMetadata(userMessage) {
if (!userMessage || typeof userMessage !== 'object' || Array.isArray(userMessage)) {
return userMessage;
@@ -12,8 +13,12 @@ export function ensureGooseUserMessageMetadata(userMessage) {
: {};
if (metadata.userVisible == null) metadata.userVisible = true;
if (metadata.agentVisible == null) metadata.agentVisible = true;
const created = Number(userMessage.created ?? 0) || Math.floor(Date.now() / 1000);
return {
...userMessage,
id: userMessage.id ?? crypto.randomUUID(),
role: userMessage.role ?? 'user',
created,
metadata,
};
}