fix(agent): inject Shanghai time into each reply message

103 goosed harness_remember returns remembered:false, so session memory
never carried the time anchor. Prepend buildCurrentTimeAgentPrefix on every
H5 /reply and WeChat agent prompt so the model sees Asia/Shanghai clock.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-07-01 08:40:27 +08:00
parent 75e5a56b86
commit de5fab370c
5 changed files with 59 additions and 11 deletions
+11
View File
@@ -12,6 +12,7 @@ import {
resolveTimeOfDayPeriod,
suggestCodeExecutorForTask,
buildSessionMemoryEntries,
buildCurrentTimeAgentPrefix,
ensureUserMemoryProfile,
hasMemoryStore,
loadUserMemoryProfile,
@@ -123,6 +124,16 @@ test('buildSessionMemoryEntries injects time anchor even without memory store',
assert.match(entries[0].content, /13:00(中午)/);
});
test('buildCurrentTimeAgentPrefix wraps Shanghai anchor for agent-only injection', () => {
const text = buildCurrentTimeAgentPrefix({
now: Date.UTC(2026, 5, 29, 5, 0, 0),
timezone: 'Asia/Shanghai',
});
assert.match(text, /不要向用户复述/);
assert.match(text, /2026-06-29(星期一)/);
assert.match(text, /13:00(中午)/);
});
test('renderCurrentTimeAnchor formats Shanghai weekday from exact date', () => {
const text = renderCurrentTimeAnchor({
now: Date.UTC(2026, 5, 29, 5, 0, 0),