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:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user