Commit graph

877 commits

Author SHA1 Message Date
777genius
91ccd75ddf fix(team-runtime): ignore stale launch advisories 2026-05-31 22:21:01 +03:00
777genius
f5f22e50fb perf(team): persist task projection cache 2026-05-31 16:54:24 +03:00
777genius
9ffdb6468b perf(main): extend launch summary cache window 2026-05-31 12:57:31 +03:00
777genius
9c29b0f8f1 perf(main): refresh message feed cache in background 2026-05-31 12:44:39 +03:00
777genius
6bb8d87bc7 perf(main): reuse cached runtime process table 2026-05-31 12:24:29 +03:00
777genius
47cea728b0 perf(main): short-circuit runtime command matching 2026-05-31 11:18:03 +03:00
777genius
c85b0d94ce perf(main): cache task activity file reads 2026-05-31 11:11:01 +03:00
777genius
2866b10bbc perf(main): cache no-op task activity sync 2026-05-31 10:59:45 +03:00
777genius
dc3001f713 perf(main): reuse team task snapshots for UI reads 2026-05-31 10:22:11 +03:00
777genius
cb60fca258 perf(main): reuse runtime process rows across refreshes 2026-05-31 10:02:43 +03:00
777genius
4457c6f61b perf(main): cache team inbox reads 2026-05-31 09:44:12 +03:00
777genius
9924e447c8 fix(team): treat stale observe refresh marker as recoverable 2026-05-31 09:31:26 +03:00
777genius
8df2a8797b Merge remote-tracking branch 'origin/perf/team-page-lag-optimization' into HEAD
# Conflicts:
#	src/main/services/team/TeamProvisioningService.ts
#	src/renderer/components/sidebar/GlobalTaskList.tsx
#	src/renderer/components/sidebar/SidebarTaskItem.tsx
2026-05-31 09:15:26 +03:00
777genius
fdc61d55cb perf(main): cache bootstrap transcript success checks 2026-05-31 07:49:57 +03:00
777genius
228ebd6454 perf(main): cache runtime command arg matches 2026-05-31 07:47:16 +03:00
777genius
5a3e59f765 perf(main): cache bootstrap transcript context checks 2026-05-31 07:45:48 +03:00
777genius
66ab83a7ce perf(main): avoid cli arg cache copies 2026-05-31 06:13:44 +03:00
777genius
a0faab56aa perf(main): reuse normalized bootstrap success inputs 2026-05-31 06:12:57 +03:00
777genius
0e82c1bdbd perf(main): trim repeated runtime hot loop work 2026-05-31 06:05:25 +03:00
iliya
a7a732e226 fix(team): guard runtime process row cache invalidation 2026-05-31 01:39:39 +03:00
777genius
b688800d57 perf(main): cache live runtime process table reads 2026-05-31 01:24:48 +03:00
iliya
0296c68a4d fix(ci): resolve validate lint errors 2026-05-31 01:22:47 +03:00
777genius
601d02fd45 perf(main): cache live runtime process table reads 2026-05-31 01:17:53 +03:00
777genius
21ef4e406e Merge remote-tracking branch 'origin/perf/team-page-lag-optimization' into perf/team-page-lag-optimization 2026-05-31 00:27:03 +03:00
777genius
ab8ed5e378 perf(main): reduce bootstrap transcript context scans 2026-05-31 00:26:02 +03:00
iliya
76299a4e44 fix(team): align runtime telemetry tests with process rows 2026-05-31 00:14:16 +03:00
777genius
e90886316f perf(main): cache runtime resource telemetry 2026-05-30 23:59:56 +03:00
777genius
172ddad18a perf(main): reuse task snapshots for projections 2026-05-30 23:30:39 +03:00
777genius
b32cc59b46 perf(main): avoid repeated lead session tail scans 2026-05-30 23:21:42 +03:00
777genius
4b5a49e6e8 perf(main): share lead session tail reads 2026-05-30 23:19:15 +03:00
777genius
f4f42e2ca4 perf(main): avoid full team scans for global tasks 2026-05-30 23:14:42 +03:00
777genius
c2ab7a7ff4 perf(main): skip unchanged task resume locks 2026-05-30 22:47:52 +03:00
777genius
1f46a14a79 perf(main): trim runtime process liveness scans 2026-05-30 22:14:52 +03:00
777genius
4575255c28 perf(main): skip redundant task interval resume scans 2026-05-30 22:07:24 +03:00
777genius
e7d7b3014e perf(main): reduce runtime launch metadata work 2026-05-30 21:52:36 +03:00
777genius
d59865f300 perf(team): reduce runtime telemetry polling 2026-05-30 20:03:45 +03:00
777genius
b13ee56359 perf(team): cap global task projections earlier 2026-05-30 18:57:45 +03:00
777genius
304d0a5ef1 perf(team): avoid redundant task cache clone 2026-05-30 18:48:43 +03:00
777genius
a06423a574 fix(team): preserve live overlay in worker message pages 2026-05-30 18:44:12 +03:00
777genius
180bdb7575 perf(team): cache transcript affinity verdicts 2026-05-30 18:39:16 +03:00
777genius
1ebeba8f6e fix: satisfy lint after performance fixes 2026-05-30 17:43:08 +03:00
777genius
3b7b5dfd75 fix: preserve file lock acquire errors 2026-05-30 17:08:29 +03:00
777genius
8cb44cd793 perf: replace readline with a chunked line generator in team JSONL readers
readline.createInterface runs an expensive Unicode line-break regex + extra
stream/string-decoder machinery per chunk. The main transcript parser (parseJsonlStream)
already uses a buffer + manual newline split; these per-team readers still used readline.

Add readJsonlLines(): an async generator that yields a JSONL file's lines via a chunked
utf8 stream read + a plain '\n' split (drop-in for 'for await (const line of rl)'), so the
consumers' loop bodies are unchanged. Stream is utf8-decoded before splitting, so multi-byte
chars across chunk boundaries are safe; trailing CR (CRLF) is stripped; empty lines and a
final newline-less line are yielded, matching readline; breaking out of the loop destroys
the stream via the generator's finally.

Adopt it in MemberStatsComputer, TaskBoundaryParser, and FileContentResolver (file-history
scan). Behavior-identical (their existing tests pass: 18 + 6 + 12) plus 6 new tests for the
generator (CRLF, empty lines, no-trailing-newline, early break, multi-byte chunk boundary).

Note: session-browser readline paths (jsonl metadata extractor, metadataExtraction,
SessionContentFilter) are off the launch path and left as-is for now.
2026-05-30 15:58:09 +03:00
777genius
127d31ba88 perf: cache unchanged team task reads 2026-05-30 15:51:15 +03:00
777genius
61e2678a5d perf: cache team transcript head metadata 2026-05-30 15:26:09 +03:00
777genius
0a750a9fa8 perf: share a frozen team-summary snapshot instead of cloning on every listTeams
listTeams() deep-cloned ALL team summaries via structuredClone on every call -- even
cache hits and concurrent in-flight awaiters. A heap allocation sample of a launch
put this (listTeams -> cloneTeamSummaries -> structuredClone) as the single largest
memory allocator, driving heap churn + GC pressure during launch (this stand has ~158
teams, and listTeams is called constantly: startup, notification init, task projection,
IPC polls, provisioning).

Build ONE deep-frozen, independent snapshot per uncached load and hand the same
reference to the cache entry, in-flight awaiters, and every later reader. The single
cloneTeamSummaries keeps it independent of any cached config the loader returns;
freezing lets all readers share it safely. Audited every listTeams consumer -- all
iterate / map / filter / serialize, none mutate -- and the freeze turns any stray
future mutation into a loud error rather than silent cross-caller corruption.

TeamConfigReader 26/26 (added a frozen + same-reference regression test), and the
listTeams consumers (TeamDataService 116, CrossTeamService 26) all pass under frozen
summaries.
2026-05-30 15:25:26 +03:00
777genius
58dfac8377 fix: preserve runtime rss fallback when process table misses roots 2026-05-30 15:16:03 +03:00
777genius
f0797e2c12 perf: replace readline with a bounded chunked read in the affinity head scan
fileBelongsToTeam streamed the head window via createReadStream + readline. readline's
line iterator runs an expensive Unicode line-break regex and stream/string-decoder
machinery per chunk, which showed up as a top main-thread cost during launch (the line-
split regex alone was ~5.7% in the warm launch profile).

Replace it with a bounded chunked fs.read + a plain '\n' split. JSONL is strictly
newline-delimited and each line is trim()'d (so a trailing CR from CRLF is dropped),
so a '\n' split is cheaper and more correct (it will not split on a bare CR or a
Unicode line/paragraph separator inside a JSON string value, which readline would). A
StringDecoder preserves multi-byte UTF-8 sequences that straddle a chunk boundary.

Byte-identical semantics to the old loop: inspect up to TEAM_AFFINITY_SCAN_LINES
non-empty lines, first match wins via early break, and a final line is honored even
without a trailing newline. Reads in 64KB chunks so a team decided in its first lines
is not penalized by a huge file. Adds tests for CRLF endings + no-trailing-newline,
a multi-byte char straddling the 64KB boundary, and the 40-line window bound (21 pass).
2026-05-30 14:54:58 +03:00
777genius
5c1d2e8d92 perf: memoize bootstrap failure-reason per parsed line across members
readRecentBootstrapTranscriptOutcome ran extractBootstrapFailureReason (regex +
optional JSON.parse + ~40 substring scans per call) for every candidate line, once
per team member: an anonymous transcript line (no agentName) passes the per-member
filter for ALL members, so an N-member team re-extracted the same line's failure
reason N times per scan -- a top main-thread cost in the warm launch profile (~5.4%
with isBootstrapInstructionPrompt).

Memoize the result on the shared parsed-tail line (parsedBootstrapTranscriptTailCache
already reuses the same line objects across members and re-scans while the file is
unchanged). The compute stays LAZY inside the newest-first candidate loop, so each
line is extracted at most once across all members AND lines past the first match are
never extracted -- preserving the early-break that an eager precompute would lose.
The memo is keyed implicitly by the line's cache entry (filePath + mtime + size); a
file change re-parses into fresh line objects, so it cannot drift from the line text.

Pure-function memoization: byte-identical input (candidate.text === parsedLine.text)
-> identical output, so failure/success/null outcomes and reasons are unchanged.
Bootstrap-transcript outcome tests pass (306), no behavior change.
2026-05-30 14:34:57 +03:00
777genius
776298b0e3 perf: reuse caller stat in fileBelongsToTeam, drop duplicate fs.stat
On the live resolution path collectRootJsonlSessionIds already stat()s each root
jsonl for its mtime-window filter, then fileBelongsToTeam stat()ed the very same
file again for its cache validation -- two fs.stat syscalls (plus two Stats
allocations) per file, every poll. fileBelongsToTeam now takes an optional
precomputed stat and the mtime-filter caller passes the stat it already has, so the
file is statted once. Measured 20 files -> 20 stat calls on the mtime path (was ~40).

Using a single stat snapshot is also slightly more consistent than two reads that
could straddle a concurrent write. The other call site (subagent scan) passes no
stat and is unchanged (fileBelongsToTeam stats it itself). Adds a regression test
that a caller-supplied stat is the one recorded in the affinity cache.
2026-05-30 14:11:58 +03:00