GeezerVison is showing github.com — websearch: the year in the tool description invalidates every session's prompt cache at the new year · Issue #62548 · anomalyco/opencode
websearch: the year in the tool description invalidates every session's prompt cache at the new year #62548
Description
Description
The websearch tool description ends with The current year is ${new Date().getFullYear()}, read once when the module loads (packages/core/src/tool/plugin/websearch.ts).
Tool definitions open every cached prompt. The first time the server starts in a new year, the tools of every session change, so each session's next request writes its whole conversation to the prompt cache again instead of reading it. A server that keeps running over the new year keeps telling the model the old year.
The date already reaches the model through the instructions (Today's date: ...), and a date change there is appended after the cached prefix, so the description doesn't need the year.
Plugins
None
OpenCode version
dev (21bf6b4)
Steps to reproduce
- Use a session with the websearch tool available, on Dec 31.
- Restart OpenCode on Jan 1 and send another prompt in that session.
- The tool definitions differ from the previous request, so nothing after the start of the prompt is read from the cache.
Screenshot
No response
Operating System
macOS
Terminal
Desktop app
Activity
opencodejr commented on Nov 7, 2026
Thanks for the detailed write-up!
To restate the request: drop the year from the websearch tool description (The current year is ${new Date().getFullYear()} in packages/core/src/tool/plugin/websearch.ts), because the date already reaches the model through the instructions (Today's date: ...). That would stop the tool definitions from changing at the first restart in a new year, which rebuilds the prompt cache of every session, and a server running over New Year would no longer give the model an outdated year.
The year was added on purpose in #13559, which accepted a cache rebuild once a year as a trade-off. So I'm treating this as an improvement rather than a bug, but the point that the instructions now carry the date makes a good case for removing it. The maintainers will consider it.
Related:
brusnyak commented on Nov 7, 2026
Taking this. Plan: drop the hardcoded year from the websearch tool description and let the session instructions (Today's date: ...) carry it, plus a regression test that the description contains no year. I checked the other core/server tool descriptions for clock-dependent text and found none.
Metadata
Metadata
Development
No branches or pull requestsIssue actions