Skip to content

perf: cache app and package name resolution #462

@thymikee

Description

@thymikee

Summary

Add a narrow daemon/platform cache for display-name-to-app-id resolution, covering Android package lookup and Apple bundle lookup where safe.

Motivation

Non-exact app targets can trigger expensive app/package enumeration, for example Android pm list packages in resolveAndroidApp() and installed-app listing in Apple app resolution. Agent flows often reopen or relaunch the same named target repeatedly.

Proposed approach

  • Cache only successful display-name/alias resolution results.
  • Bypass cache for exact package names, exact bundle ids, URLs, and deep links.
  • Key by platform, device id, target string, and any filter/surface that changes the result.
  • Use conservative built-in defaults and avoid adding new env vars unless clearly necessary. We should bias toward good defaults and eventually reduce tuning env var surface area.
  • Invalidate or bypass around install/reinstall flows where installed app state changes.
  • Keep failed lookups uncached at first.
  • Add tests that exact ids bypass the cache, display-name lookups reuse it, and install/reinstall paths do not retain stale app ids.

Safety notes

This must not cache current UI state or snapshots. It should only cache app identity resolution. If app inventory changes, the cache should be short-lived or explicitly invalidated before it can misroute an open command.

Measurement

Compare repeated open <display name> / relaunch flows on Android and iOS before/after, especially when opening by human-readable app name rather than exact id.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions