Files
orca/src
Neil 298c765a00 fix(ai-vault): stop the scan-stamp guard from deciding merged results (#14261)
Follow-up to #14245. That PR made `scannedAt` meaningful again by keeping
the newest leg stamp on an all-host merge instead of reminting it, and made
the renderer reconcile session rows structurally. Three loose ends:

- An 'all' result is a merge of legs on independent clocks stamped with the
  newest leg, so the renderer's `scannedAt` equality guard could hard-skip a
  real change: a paired host whose clock lags the desktop can return new
  sessions while the merged stamp repeats, hiding them for up to the local
  leg's 60s TTL. Restrict the guard to single-host scopes, where the stamp is
  minted by one scanner at scan completion and equality does imply equal
  content. Merged scopes now let the structural reconcile decide, which costs
  one deep compare per refocus and keeps the identity reuse intact.
  The scope test routes through `normalizeExecutionHostScope` so it matches
  what the main process merges on, including an empty or unrecognized scope.

- `latestAiVaultScannedAt` compared stamps lexicographically after only
  checking `Date.parse` validity. `scannedAt` is `z.string()` on the wire, so
  a legal ISO variant orders wrongly: '...:05Z' sorts after '...:05.500Z',
  and a '-05:00' offset five hours in the future sorts below the local stamp
  and would have been accepted. Compare parsed instants instead.

- `EMPTY_AI_VAULT_SESSIONS` is shared by every mounted hook; freeze it and
  return `readonly AiVaultSession[]` so no consumer can mutate the sentinel.

Each test fails against the pre-fix logic.
2026-08-13 02:26:06 -07:00
..