* perf(sessions): defer transcript index rebuilds to the reconcile worker
Transcript replace, exact rewrite, text repair, and message-cut no longer
rebuild the full FTS/active-event projection inside their synchronous
write transactions. They mark the projection dirty and schedule the
existing chunked worker-owned reconcile after commit via the post-commit
publication seam; search already hides needs_rebuild sessions and
mirror-facts falls back to raw rows while the projection lags. Doctor
import and canonical repair keep synchronous reconciliation. A/B probe:
compaction replace of a 60k-event transcript blocked the event loop
3197ms before, 764ms after, with the projection converging off-thread.
* test(sessions): await projection convergence before proving turn cursors
Replace now defers the projection rebuild, so the ordered-turn setup must
wait for the reconcile worker before committed cursors are provable; the
invalidation fallback for unproven cursors keeps its own coverage.
* perf(sessions): size-gate synchronous transcript index rebuilds
Small transcripts (<=4k events and <=4MiB) keep the original synchronous
in-transaction rebuild (~250ms bound, no reader dirty window); only large
transcripts defer to the reconcile worker where the FTS retokenization
cost would stall the event loop. Probe: 60k-event replace stalls 639ms
(deferred) vs 3197ms before; 2k-event replace is 95ms with search
current immediately.
* test(sessions): settle deferred reconcile before teardown and history reads
Oversized chat.history fixtures take the deferred rebuild path, so the
shared transcript seeding helper awaits projection convergence, and the
archive-worker suite settles the reconcile worker before removing its
temp dir (Windows cannot unlink the still-open agent DB).
* fix(test): satisfy agent database options in archive-worker teardown
* fix(sessions): resolve reconcile only after the worker thread exits
The reconcile promise previously settled via fire-and-forget terminate,
letting waiters delete the database file while the worker thread still
held its SQLite handle open (Windows unlink fails with EBUSY). Settle
now finishes through worker.terminate()'s exit promise on every path.
* perf(plugins): reuse one plugin metadata snapshot per CLI process
Built CLI measurements with the same fs shim and isolated state copy:\n- status --json: 174.3k -> 52.8k fs calls; 4.33-4.41s -> 2.63-3.94s\n- agents list --json: 50.7k -> 38.3k fs calls; 2.32-2.93s -> 2.20-2.28s
* style(config): use type-only snapshot imports
* fix(cli): scope plugin snapshot adoption to inventory reads
* test(cli): align snapshot harnesses with adoption
* fix(systemd): honor effective drop-in configuration
Read one coherent manager-loaded service snapshot while retaining the managed base definition for repairs. Track drop-in ownership, surface pending daemon reloads, and keep update and doctor rewrites from adopting operator-owned values.
Closes#128929
* fix(systemd): expose reload status in service snapshot
* test(systemd): cover Linux doctor ownership
* fix(auto-reply): bail on length before scanning the streamed buffer for a silent-reply prefix
isSilentReplyPrefixText ran trimStart() plus two full toUpperCase() passes
over its input before the first length-sensitive test. Its hot caller
startTypingOnText is invoked per streamed partial with the accumulated reply
text, making the check O(n) per delta and O(n^2) per reply.
Hoist tokenUpper and reject candidates longer than the token first. Unicode
upper-casing never shortens a string, so trimmed.length > tokenUpper.length
already implies tokenUpper.startsWith(normalized) is false. Also folds the
duplicate toUpperCase().
* refactor(auto-reply): condense silent-prefix invariant
Co-authored-by: Tran Quang <randytran8800@gmail.com>
---------
Co-authored-by: Peter Steinberger <steipete@gmail.com>