fix(schedule): auto-create reminders when agent only writes schedule items

When schedule_create_item includes a start time and reminder intent, create the
matching h5_schedule_reminders row in the same tool call so 10:00 pushes are not
lost. Also reconcile Goose SSE request ids with the portal agent-run gate to keep
MindSpace chat streaming reliable.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-07-12 08:11:43 +08:00
parent 32fb2cdeaf
commit 97d0e8d970
9 changed files with 552 additions and 21 deletions
+22
View File
@@ -1,6 +1,7 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import {
reconcileSessionEventRequestContext,
resolvePostAgentRunChatState,
shouldPromoteSessionIdToStreaming,
} from './chat-agent-run-gate.mjs';
@@ -29,3 +30,24 @@ test('shouldPromoteSessionIdToStreaming skips re-streaming after Finish', () =>
assert.equal(shouldPromoteSessionIdToStreaming('waiting'), true);
assert.equal(shouldPromoteSessionIdToStreaming('streaming'), true);
});
test('reconcileSessionEventRequestContext adopts Goose request id while agent-run gate waits', () => {
assert.deepEqual(
reconcileSessionEventRequestContext({
activeRequestId: 'portal-req',
chatState: 'waiting',
eventType: 'ActiveRequests',
activeRequestIds: ['goose-req'],
}),
{ activeRequestId: 'goose-req', promoteStreaming: true, allowMissingGrace: false },
);
assert.deepEqual(
reconcileSessionEventRequestContext({
activeRequestId: 'portal-req',
chatState: 'waiting',
eventType: 'Message',
eventRequestId: 'goose-req',
}),
{ activeRequestId: 'goose-req', promoteStreaming: true, allowMissingGrace: false },
);
});