Files
orca/config
d30ea72469 fix(session-history): discover OMP profile session dirs (#40264)
* fix(session-history): discover OMP profile session dirs

OMP stores per-profile transcripts under <config home>/profiles/<name>/agent/sessions
(XDG_DATA_HOME/omp/profiles/<name>/sessions on POSIX with XDG set). The app process
usually lacks OMP_PROFILE/PI_PROFILE, so profile-run sessions were missing from
Agent Session History, orca search, and native chat.

Enumerate existing profile session dirs in ompProfileSessionsDirs() (same env +
safety rules as resolveOmpSessionsDir; PI_CONFIG_DIR-aware; suppressed under the
legacy OMP_CODING_AGENT_DIR override) and include them in ompSessionsRootDirs()
(discovery + path allowlist) and the omp branch of the native chat resolver.
An explicit ompSessionsDir override still pins one location.

main-sync-fs baseline for omp-session-root.ts 1 -> 3: one readdir of the small
fixed profiles dir plus one existsSync candidate check per profile (single call
site), the same small-dir probe style the file already uses - not a per-file
sweep. Flagged for reviewer sign-off per the ratchet's rule.

* fix(session-history): enumerate XDG-only OMP profile dirs

ompProfileSessionsDirs only listed profile names from the local config home, so a profile that exists solely under $XDG_DATA_HOME/omp/profiles (e.g. OMP run with a different PI_CONFIG_DIR) was never discovered. Enumerate both roots; per-profile candidate checks and output dedup are unchanged.

* docs(session-history): document profile dir helpers for coverage

* fix(session-history): use non-blocking profile enumeration in the native chat ID lookup

* refactor(session-history): share one OMP root list for discovery and chat lookup

Drop the duplicated async profile scan: native chat ID lookup now reuses
ompSessionsRootDirs, which already runs the small sync profile probe on the
main process for row deletion. Reuse normalizedProfile for directory names
and trim tests to the behavior that fails on revert.

* fix(session-history): prefer a profile's XDG sessions dir in OMP ID lookup

---------

Co-authored-by: ducts <ducts@fpt.com>
Co-authored-by: Kelvin Amoaba <97001695+AmoabaKelvin@users.noreply.github.com>
2026-11-11 05:31:23 +00:00
..