Repository navigation
fix(core): canonicalize location in activity tracking - #59087
Conversation
Backport of #56259 from beta. Session events can carry a non-canonical location, which never matched the cached location, so activity was not recorded and a busy location could be evicted as idle.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
There was a problem hiding this comment.
The fix looks right. I checked it with the PR's new test: on the base it fails (the location is evicted even though a session event arrived), and with the PR all 8 tests in location-activity.test.ts pass. typecheck:tsc passes in core. Canonicalizing in the listener matches how location-lifecycle.ts already handles event.location. The bug isn't Windows-only: canonical always sets the workspaceID key, so a ref built without that key also missed the cache on other platforms.
Public API: unchanged.
No concerns.
Backport of #56259 (Kit Langton) from
beta.Problem
LocationActivitykeys its cache by canonical location, but looked up the location of each session event as it arrived. An event with a non-canonical location, for example a different spelling of the same directory, missed the cache. Its activity was never recorded, so a busy location could be evicted as idle.Change
The bus listener canonicalizes
event.locationwithLocationServiceMap.canonicalbefore checking and touching the cache.Testing
typecheck:tscpasses in core.core/test/location-activity.test.tsadds a case where events with a non-canonical location refresh the inactivity deadline. It passes with the rest of the file.Added by the opencode bot (AI-generated).
Related: #48691, #51828