fix: remove seconds-precision time from env context to stop breaking token cache

Current time with HH:MM:SS changed every second, invalidating the prompt cache
on every request. Date-level precision is sufficient; timezone and locale are
stable. Removes Current time field entirely from createEnvContext output.
This commit is contained in:
YeonGyu-Kim
2026-02-26 20:06:06 +09:00
parent 87d6b2b519
commit ad01f60e99
2 changed files with 41 additions and 9 deletions
+1 -9
View File
@@ -1,5 +1,5 @@
/**
* Creates OmO-specific environment context (time, timezone, locale).
* Creates OmO-specific environment context (timezone, locale).
* Note: Working directory, platform, and date are already provided by OpenCode's system.ts,
* so we only include fields that OpenCode doesn't provide to avoid duplication.
* See: https://github.com/code-yeongyu/oh-my-opencode/issues/379
@@ -16,17 +16,9 @@ export function createEnvContext(): string {
day: "numeric",
})
const timeStr = now.toLocaleTimeString(locale, {
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
hour12: true,
})
return `
<omo-env>
Current date: ${dateStr}
Current time: ${timeStr}
Timezone: ${timezone}
Locale: ${locale}
</omo-env>`