Fix all Windows-specific test failures caused by path handling problems
and EBUSY errors from unclosed SQLite database handles.
Root causes fixed:
1. POSIX path assumptions: replaced hard-coded file:///tmp, /repo, etc.
with pathToFileURL/path.resolve/path.join computed expectations
2. shortenPath() now normalizes backslashes to forward slashes after ~
and respects home directory boundaries
3. HistoryStorage.resetInstance() leaked its Database — added #close()
that finalizes all prepared statements and closes the DB
4. AgentStorage gained the same resetInstance()/#close() pattern
5. SqliteAuthCredentialStore.close() leaked one-off prepared statements
from inline this.#db.prepare() calls — wrapped each in try/finally
6. model-cache.ts used a process-global DB even for custom dbPath —
now opens/closes per-call via withModelCacheDb
7. createAgentSession leaked AuthStorage on construction failure —
added ownsAuthStorage cleanup in catch block
8. MnemopiBackend.removeDbFiles() now truly best-effort (catches errors)
9. TempDir retry window expanded from 4x10ms to 40x25ms
10. TempDir prefix convention: non-@ prefixes created dirs relative to
cwd instead of os.tmpdir() — all test temp dirs now use @ prefix
11. Shell-escaped interpolated paths in bash tool tests
12. git core.autocrlf false in autoresearch test repo init
All 522 previously-failing Windows tests now pass.
- Added session-domain modules and exports for session-entries, context, listing, loader, and migrations.
- Changed persistence to async append writes plus writeTextAtomic, removing sync line APIs.
- Added compaction-aware session context rebuild with dangling tool-call cleanup.
- Added resumable session resolution with status inference, id/stem/suffix matching, and backup recovery.
- Shared immutable model registries and auth storage via beforeAll/afterAll.
- Swapped fixed-delay settle sleeps for predicate polling and signals.
- Stubbed network/timers to drop wall-clock waits in registry and history tests.
- Added resetDisplay invalidation tests and startup-timing breakdown lines.
- Added token-aware query matching so highlights mirror `HistoryStorage.search` tokenization.
- Added token highlighting, compact relative timestamps, and selected-row styling in results.
- Added PageUp/PageDown and Home/End selection shortcuts in `HistorySearchComponent`.
- Added selector matchers for `tui.select.pageUp` and `tui.select.pageDown`.
- Changed empty-result messaging to distinguish `No history yet` from `No matching history`.
- Added tests for page/home/end navigation and token-highlighting result rendering.
- Enabled resume picker to preload sessions and toggle folder/all scope with Tab.
- Enabled resume flow to fall back to all-project sessions and switch cwd on resume.
- Added centralized applyCwdChange to refresh caches, commands, and UI after cwd updates.
- Updated session restoration to adopt restored session cwd and sessionDir when present.
- Added unit tests for renderSegmentTrack verifying per-segment coloring, active chip fill formatting, and active-index movement.
- Added tests for theme.getContrastFgAnsi to ensure selected foreground contrast remains clearly readable against RGB fills.
- Removed the OAuth selector keybinding test and its local auth-storage scaffolding, and documented the new model-tier/role-cycle chip-track behavior in the changelog.
Replaced raw Up/Down arrow matching in selector-style components with the shared tui.select navigation keybindings.
Added regression coverage for Ctrl+P/Ctrl+N selector remaps across the reported components.
Fixes#1535