Skip to content

fix(core): canonicalize location in activity tracking - #59087

Merged
Hona merged 1 commit into
devfrom
backport-location-canonical
Oct 25, 2026
Merged

Hona merged 1 commit into
devfrom
backport-location-canonical

Conversation

@Hona

@Hona Hona commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

Backport of #56259 (Kit Langton) from beta.

Problem

LocationActivity keys 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.location with LocationServiceMap.canonical before checking and touching the cache.

Testing

  • typecheck:tsc passes in core.
  • core/test/location-activity.test.ts adds 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

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.
Copilot AI balanced review requested due to automatic review settings October 25, 2026 22:57
@Hona
Hona enabled auto-merge (squash) October 25, 2026 22:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Related: #48691, #51828

@Hona
Hona merged commit c156d3c into dev Oct 25, 2026
15 checks passed
@Hona
Hona deleted the backport-location-canonical branch October 25, 2026 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants