fileBelongsToTeam only cached POSITIVE affinity durably; a negative verdict was re-decided on any change, so during a launch every non-matching transcript in the project dir that grew (mtime+size change from an active session) was re-streamed (createReadStream+readline) and re-parsed (up to 40 head lines) on every bootstrap poll. A live atlas-hq-5 launch profile put this whole subsystem (readline streaming + fileBelongsToTeam + line/team matching) at ~31% of main-thread JS, the single largest launch cost. A team's first 40 head lines are immutable for an append-only transcript, so a `false` decided from a FULL inspected window (>= TEAM_AFFINITY_SCAN_LINES) stays valid while the file only grows. Track headWindowFull on the cache entry and short- circuit such negatives the same way positives are short-circuited (size >= cached). Short files (partial window) are still re-scanned on growth, so a team mention that later lands inside the head window is still detected. A shrink/rewrite (size < cached) forces a re-scan, identical to the positive path. Behavior-preserving for affinity correctness (no new false negatives); only removes redundant re-streams. Adds regression tests for both the durable-negative and the short-file-flips-to-true cases. |
||
|---|---|---|
| .. | ||
| agent-graph | ||
| features | ||
| fixtures | ||
| main | ||
| mocks | ||
| preload | ||
| renderer | ||
| scripts | ||
| shared | ||
| setup.ts | ||