mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 20:58:26 +00:00
refactor: use compact formatZonedTimestamp for injection
Replace verbose formatUserTime (Wednesday, January 28th, 2026 — 8:30 PM) with the same formatZonedTimestamp used by channel envelopes (2026-01-28 20:30 EST). This: - Saves ~4 tokens per message (~7 vs ~11) - Uses globally unambiguous YYYY-MM-DD 24h format - Removes 12/24h config option (always 24h, agent-facing) - Anchors envelope detection to the actual format function — if channels change their timestamp format, our injection + detection change too - Adds test that compares injection output to formatZonedTimestamp directly Exported formatZonedTimestamp from auto-reply/envelope.ts for reuse.
This commit is contained in:
committed by
Tak Hoffman
parent
08886eaaa3
commit
76391bba3f
@@ -125,7 +125,6 @@ describe("gateway agent handler", () => {
|
||||
agents: {
|
||||
defaults: {
|
||||
userTimezone: "America/New_York",
|
||||
timeFormat: "12",
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -164,9 +163,7 @@ describe("gateway agent handler", () => {
|
||||
await vi.waitFor(() => expect(mocks.agentCommand).toHaveBeenCalled());
|
||||
|
||||
const callArgs = mocks.agentCommand.mock.calls[0][0];
|
||||
expect(callArgs.message).toMatch(
|
||||
/^\[.*Wednesday.*January 28.*2026.*8:30 PM.*\] Is it the weekend\?$/,
|
||||
);
|
||||
expect(callArgs.message).toBe("[2026-01-28 20:30 EST] Is it the weekend?");
|
||||
|
||||
mocks.loadConfigReturn = {};
|
||||
vi.useRealTimers();
|
||||
|
||||
Reference in New Issue
Block a user