Commit graph

877 commits

Author SHA1 Message Date
777genius
635321dd9a perf: drop per-acquire existsSync stat from file lock fast path
tryAcquire() ran fs.existsSync(dir) on every lock acquisition to lazily create the
lock directory. The dir almost always already exists (team dirs are created up
front), so that stat was wasted on every acquire — and the file-lock path churns
heavily during a launch (inbox writes, journals, task mutations all lock per write,
showing up as unlink/open/stat syscall load in the launch profile).

Attempt the openSync('wx') directly; only on ENOENT create the directory and retry
the acquire in the same call. Same locking semantics, same files, same first-acquire
latency for a missing dir — just one fewer stat per acquire in the common case.
2026-05-30 13:55:43 +03:00
777genius
c8d40be460 perf: cache negative team-affinity verdicts from a full head window
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.
2026-05-30 13:17:49 +03:00
777genius
126a485477 wip: team messages panel updates and runtime usage cache refinements
Checkpoint of in-progress work:
- renderer: team messages panel/composer, messagesPanelLogic, teamSlice,
  AnimatedHeightReveal plus their tests
- main: runtime process usage-stats caching (ignoreCachedMisses, bounded
  eviction), alive-run-id helpers, team watch-scope notify wiring

Note: the getTeamAgentRuntimeSnapshot rssBytes expectation in
TeamAgentLaunchMatrix.safe-e2e is environment-dependent and still red.
2026-05-30 12:54:11 +03:00
777genius
ccea3e015d perf: avoid opening bootstrap transcripts on cache hits
readRecentBootstrapTranscriptOutcome opened the session file and stat'd it
through the handle BEFORE checking the per-(file,mtime,size) outcome cache, so
every cache hit still paid a full open()+close(). During a tracked launch the
per-member lookup cache is bypassed, so the project-dir scan re-runs every poll
across every recent session file x every member, turning each cache hit into a
wasted open() syscall. The native sample of a 6-member mixed launch put __open
at ~51-54k; correcting the earlier attribution, this open-before-cache-check
(NOT the watcher rebuilds addressed in the previous commit) is the dominant
source -- removing the per-rebuild watcher churn left __open essentially flat.

Stat the path with fs.promises.stat (no fd) for the cache check and return the
cached outcome without opening. getParsedBootstrapTranscriptTail now opens the
file itself, lazily, only when its shared parse cache also misses (the file
genuinely changed since last parse), so a hit on either the per-member outcome
cache or the shared tail-parse cache avoids the open entirely. The tail read is
wrapped in try/finally to close the handle. Parsing/scan logic is byte-for-byte
unchanged; only the redundant open is removed. Bootstrap-transcript tests pass.
2026-05-30 12:23:48 +03:00
777genius
b3565a0d29 perf: skip stale session files when scanning for bootstrap transcripts
readBootstrapTranscriptOutcomesInProjectRoot iterated every .jsonl in the project
dir, opening + tail-reading each per member per bootstrap poll. A real project dir
(e.g. ~280 session files) made this the dominant file-open churn during launch (the
native sample showed ~56k open() syscalls).

A transcript last modified before the lookup window cannot contain a bootstrap line
at/after sinceMs (append-only logs: a line's timestamp <= its write time <= the file
mtime), so readRecentBootstrapTranscriptOutcome returns null for it. Skip those with
a cheap stat instead of opening them; a 5s slack absorbs clock skew between the line
timestamp source and the filesystem mtime. Behavior is unchanged (only files that
would have returned null are skipped); bootstrap-transcript detection tests still pass.
2026-05-30 11:16:18 +03:00
777genius
a4b9512c7c perf: keep positive transcript team-affinity cached as files grow
fileBelongsToTeam streams a transcript's head lines to decide if it belongs to a
team, cached by (mtime,size). During launch the team's own session transcripts
grow on every poll, invalidating the cache and forcing a re-stream + head re-parse
each time (profiled at ~7-8% main-thread JS after the earlier fixes).

A positive affinity is decided by early head lines that persist as an append-only
transcript grows, so a true result stays valid while the file only grows. Reuse a
cached true when size has not shrunk; a false result is still re-checked on any
change (a short file may grow head lines mentioning the team) and a shrink forces a
re-scan. Existing resolver tests still pass.
2026-05-30 10:15:07 +03:00
777genius
1b4838d422 perf: normalize bootstrap transcript lines once across members
isBootstrapTranscriptContextText and getBootstrapTranscriptSuccessSource each ran
text.replace(/\s+/g,' ').trim().toLowerCase() internally. During launch the
bootstrap scan checks every transcript line against every context member for every
member's poll, so the same line was re-normalized up to (members x contextMembers)
times per cycle. Profiling a 6-member mixed launch showed isBootstrapTranscriptContextText
at ~11% main-thread JS even after the shared-parse cache.

Precompute the normalized form once per parsed line (already cached) and pass it to
both detection helpers via a new optional precomputedNormalizedText parameter. The
value is identical to what the helpers computed internally, so detection is byte-for-byte
unchanged; the helpers stay backward compatible for callers that omit it.
2026-05-30 10:06:47 +03:00
777genius
f79ea145d7 perf: batch per-member task-interval resume into one locked pass
During launch the live-status loop resumes every alive member every audit cycle.
resumeActiveIntervalsForMember runs a synchronous file-lock + full read of every
task file, so for an N-member team with M task files it did N locked passes x M
readFileSync per cycle (e.g. 6 members x 20 task files), blocking the main event
loop. Profiling a 6-member mixed launch showed mutateTeamTasks/withFileLockSync as
a top main-thread cost (~14%).

Add resumeActiveIntervalsForMembers that applies the identical per-member resume
logic against a member set in a single locked pass, and use it in the live-status
loop. Same mutations, but one lock + task read per cycle instead of one per member.
Adds a test covering multi-member resume in one pass.
2026-05-30 10:02:01 +03:00
777genius
35b76f1354 perf: share bootstrap transcript tail parse across members
During launch, the bootstrap-wait loop polls each member and, per member, re-read
and re-JSON.parsed the same growing transcript tail (readRecentBootstrapTranscriptOutcome
was the top main-thread JS hotspot at ~21% during bootstrap, ~40% with its helpers).
The same file was parsed once per member per poll.

Memoize the parsed tail by (filePath, mtime, size) in a shared cache so the file is
read + parsed once per change and reused across all members. The per-member filter
and failure/success scan is byte-for-byte the same logic; only the redundant read +
JSON.parse is removed. Cache is bounded (LRU, same cap as the outcome cache) and
invalidated on mtime/size change, matching the existing outcome cache semantics.

Adds a test asserting the tail is parsed once and shared while per-member outcome
detection is unchanged.
2026-05-30 01:05:54 +03:00
777genius
5d63ecfe32 perf: scope team file watching to active and engaged teams
The main process watched every team directory under ~/.claude/teams (one shallow
chokidar target per team root, per team inboxes, and per task dir). On macOS this
falls back to kqueue, which needs one fd per watched file, so a workspace with
many teams kept ~1600 descriptors open and made startup and reconcile work scale
with the number of teams on disk.

Scope the team-root and task watching to teams that are running or currently
engaged in the UI. The teams root and every team's inboxes are still watched for
all teams, so cross-team message delivery, the lead inbox->stdin relay, and
notifications are unchanged. Idle teams are static, so dropping their team-root/
task watches is safe; opening a team (getData) or launching it re-adds it via an
immediate watch-scope refresh. The provider falls back to watching every team
when unset, and the EMFILE polling fallback is intentionally left unscoped so a
scope change can never look like a deletion.

Measured on a 162-team workspace: open team fds 1600 -> 730, with team-root
watching restored the moment a team is opened or goes live.
2026-05-30 00:25:55 +03:00
777genius
b4b9175287 perf: reuse team summary for comment notification init 2026-05-29 15:43:24 +03:00
777genius
2303346e9c perf: avoid duplicate bootstrap transcript parsing 2026-05-29 14:42:42 +03:00
777genius
f0514a7d17 perf: skip unverifiable runtime process scans 2026-05-29 14:38:01 +03:00
777genius
9be096f864 perf: cache persisted bootstrap outcome lookups 2026-05-29 14:19:04 +03:00
777genius
d0c6fdd28c perf: extend persisted runtime probe cache 2026-05-29 14:04:28 +03:00
777genius
dd71420314 perf: extend persisted spawn status cache 2026-05-29 13:10:41 +03:00
777genius
35a9b05637 perf: cache persisted spawn status reads 2026-05-29 13:06:26 +03:00
777genius
fa242d9ff6 perf: cache bootstrap transcript outcomes 2026-05-29 12:58:15 +03:00
777genius
0b97985474 perf: cache team transcript affinity checks 2026-05-29 12:46:29 +03:00
777genius
3b0c2ed24b perf: cache runtime usage telemetry 2026-05-29 12:29:37 +03:00
777genius
7d21f9bd76 perf: avoid stale runtime pid sampling 2026-05-29 12:26:15 +03:00
infiniti
0cbba46083
fix(team): speed up provider runtime preflight 2026-05-27 23:54:10 +03:00
777genius
77e08af03f fix(team): propagate managed runtime settings env 2026-05-27 18:56:24 +03:00
777genius
7cc1a59bbc fix(team): preserve mixed provider runtime settings 2026-05-27 18:22:10 +03:00
infiniti
ebcc0e717f
fix(team): reconcile provisioned-but-not-alive bootstrap state 2026-05-27 12:16:41 +03:00
777genius
abce029ef6 ci: reduce lead relay state regex complexity 2026-05-27 00:54:25 +03:00
Илия
3849c01955
fix(provenance): classify synthetic user turns
* fix(provenance): classify synthetic user turns

* fix(provenance): keep assistant display rendering intact

* fix(provenance): preserve source tool result rows
2026-05-26 23:51:17 +03:00
777genius
c79b7d4234 fix(team): suppress unverified relay state claims 2026-05-26 23:44:40 +03:00
777genius
f237318c29 fix(agent-teams): surface OpenCode runtime permissions 2026-05-26 19:46:24 +03:00
777genius
58a0eb603d build(runtime): require Node 24 toolchain 2026-05-26 19:44:23 +03:00
777genius
e88d3a1e98 feat(team): open persisted attachments in editor 2026-05-25 21:30:56 +03:00
777genius
63e16d1043 fix(workspace-trust): canonicalize git worktree trust roots 2026-05-25 21:30:56 +03:00
777genius
c033a0cb87 fix(team): persist incomplete launch state before cleanup 2026-05-25 14:53:05 +03:00
infiniti
2cee9cabaf
fix(opencode): harden local runtime bridge support 2026-05-25 14:31:57 +03:00
infiniti
2b3a184bef
fix(opencode): recover empty bridge output sends
* fix(opencode): handle empty readiness bridge output

* fix(opencode): retry read-only bridge no-output

* fix(opencode): recover empty bridge output sends

---------

Co-authored-by: iliya <iliyazelenkog@gmail.com>
2026-05-25 00:41:54 +03:00
infiniti
50f876f863
fix(opencode): retry read-only bridge no-output
* fix(opencode): handle empty readiness bridge output

* fix(opencode): retry read-only bridge no-output

---------

Co-authored-by: iliya <iliyazelenkog@gmail.com>
2026-05-24 23:22:34 +03:00
777genius
776957b607 fix(team): keep runtime adapter lead activity idle 2026-05-24 20:43:11 +03:00
777genius
4a4c67fcb9 fix(team): reconcile bootstrap runtime snapshots 2026-05-24 17:02:36 +03:00
777genius
7aa87f2278 fix(team): heal stale confirmed bootstrap diagnostics
- Carry bootstrap run ids from bootstrap-state into member evidence and compare them with current run identity.

- Allow small confirmation clock skew for delayed Anthropic app acceptance without accepting stale rapid relaunch evidence.

- Clean confirmed bootstrap members that only have stale persisted runtime pid diagnostics.

- Cover process-table unavailable, post-stop stale pid and mixed launch reconcile cases.
2026-05-24 15:57:50 +03:00
777genius
f6b2bc4cec fix(team): reject failed opencode session handles 2026-05-24 12:21:58 +03:00
777genius
95652c8990 refactor(team): extract provisioning service policies 2026-05-24 11:37:37 +03:00
777genius
cbf5356fdc fix(runtime): prefer shell node for GUI launches 2026-05-24 01:00:03 +03:00
777genius
b9cbdde502 fix(team): include runtime logs in launch failure artifacts
Refs: 777genius/agent-teams-ai#140
2026-05-23 23:33:54 +03:00
777genius
2be35c74ec fix(startup): repair deferred runtime refresh paths 2026-05-23 17:08:13 +03:00
777genius
34a1b86b21 perf(startup): defer noncritical startup probes 2026-05-23 15:04:05 +03:00
777genius
1b836530e7 fix(team): reconcile cleanup bootstrap evidence 2026-05-22 21:04:49 +03:00
777genius
511dd5d7a6 fix(team): coalesce lead stream fragments 2026-05-22 21:00:20 +03:00
777genius
97b4d86749 fix(opencode): run bridge commands portably 2026-05-22 16:49:23 +03:00
777genius
587c974c63 fix(team): harden packaged mcp runtime 2026-05-22 16:49:02 +03:00
777genius
7b99a3713b feat(opencode): surface runtime diagnostics and approvals 2026-05-22 15:43:15 +03:00
777genius
5551eea482 fix(runtime): harden local launch plumbing 2026-05-22 15:42:51 +03:00
777genius
169e34ce7c fix(team): recover process table launch failures 2026-05-22 13:34:39 +03:00
777genius
c26a1d727a fix(lint): simplify release validation patterns 2026-05-22 01:24:23 +03:00
777genius
ad984a859b fix(ci): stabilize runtime release checks 2026-05-22 00:55:29 +03:00
777genius
a386e30667 fix(team): harden launch diagnostics and MCP shutdown 2026-05-22 00:20:47 +03:00
777genius
13b14762bc fix(runtime): bound binary path discovery 2026-05-22 00:17:54 +03:00
777genius
3c427ac617 feat(runtime): support anthropic compatible endpoints 2026-05-22 00:16:52 +03:00
777genius
9ad4269ebc feat(runtime): harden MCP launch orchestration 2026-05-21 19:03:47 +03:00
777genius
6fd75c6704 chore: commit remaining workspace updates 2026-05-21 16:43:00 +03:00
777genius
ec7b1dbd18 fix(opencode): detect nvm runtime installs 2026-05-21 13:38:40 +03:00
777genius
1ff1e6ca07 fix(lint): satisfy opencode launch validation 2026-05-21 02:01:29 +03:00
777genius
16a003416d feat: harden opencode and team runtime flows 2026-05-21 01:10:48 +03:00
777genius
635d13d804 fix(opencode): harden default model resolution 2026-05-20 23:02:13 +03:00
777genius
fd50f736b8 fix(opencode): harden local provider launches 2026-05-20 22:49:42 +03:00
777genius
c3b6d2dea8 feat(opencode): support local model readiness 2026-05-20 13:03:24 +03:00
777genius
860074da15 fix(team): stabilize Claude live runtime launches 2026-05-20 02:43:28 +03:00
777genius
3d0ee71d09 fix(team): stabilize provider live smoke 2026-05-20 01:32:39 +03:00
777genius
933e580d03 fix(opencode): preserve command preflight context 2026-05-19 23:19:34 +03:00
777genius
d5894c029d feat(team): improve runtime bootstrap controls 2026-05-19 22:39:13 +03:00
777genius
568c0f237e fix(team): trim bootstrap stderr breadcrumb 2026-05-19 21:23:44 +03:00
777genius
8b97f5c016 test: cover bootstrap submitted diagnostics 2026-05-19 20:55:13 +03:00
777genius
7dbabc1a85 fix: extend deterministic bootstrap timeout budget 2026-05-19 20:11:55 +03:00
777genius
e22589f6c4 fix: support twenty-member deterministic bootstrap 2026-05-19 20:00:59 +03:00
777genius
bf3011624d fix: harden team launch bootstrap provisioning 2026-05-19 19:43:02 +03:00
777genius
85959b6954 feat(runtime): improve provider readiness diagnostics 2026-05-19 16:19:38 +03:00
777genius
2d06442ce0 feat(graph): refine runtime lanes and model compatibility 2026-05-19 14:24:30 +03:00
infiniti
dc04cbfad7
fix(opencode): retry empty readiness bridge stdout
Co-authored-by: iliya <iliyazelenkog@gmail.com>
2026-05-19 12:33:13 +03:00
777genius
dffc527424 fix(ci): restore dev validation checks 2026-05-19 02:49:45 +03:00
777genius
85b767e247 fix: harden opencode runtime recovery 2026-05-19 01:27:34 +03:00
777genius
9cd5144e1a fix(codex): retry binary discovery after shell env loads 2026-05-19 00:09:26 +03:00
777genius
3eacf81603 fix(opencode): recover capability snapshot launch retries 2026-05-18 22:19:43 +03:00
777genius
2b50def03e fix(opencode): preserve packaged runtime env 2026-05-18 21:48:06 +03:00
777genius
55dfc5db14 fix(opencode): classify session refresh diagnostics 2026-05-18 17:58:55 +03:00
777genius
20a8e69c4c chore: save remaining workspace updates 2026-05-18 15:58:05 +03:00
777genius
7c5832bd7e fix(opencode): avoid busy preflight warnings after compatibility 2026-05-18 15:50:38 +03:00
777genius
6e4f8ff8c4 fix: stabilize opencode mcp transport refresh
Keep OpenCode app MCP transport evidence durable, refresh stale sessions without consuming normal delivery attempts, and keep recoverable runtime diagnostics out of member card errors.

Cover stable MCP restart/fallback, forced session refresh, resolved_behavior_changed recovery, and renderer diagnostics with regression and safe e2e tests.
2026-05-18 13:08:34 +03:00
777genius
5e0d552cb9 fix(opencode): improve runtime preflight diagnostics 2026-05-18 11:11:45 +03:00
777genius
d25c65381f fix(runtime): keep opencode liveness in sync 2026-05-18 02:59:24 +03:00
777genius
4a8cec9dc2 chore: checkpoint frontend workspace updates 2026-05-18 01:57:16 +03:00
777genius
4ec745268b feat: add telemetry identity and runtime status 2026-05-17 20:26:34 +03:00
777genius
445932e45b feat(team): improve runtime provider workflows 2026-05-17 19:11:26 +03:00
777genius
e333d09d9c fix: harden task change review flows 2026-05-17 14:18:54 +03:00
777genius
be558927ea fix(team): complete teammate permission responses 2026-05-17 01:30:19 +03:00
infiniti
b1cccf6e3c
fix(team): respond to teammate permission requests 2026-05-17 01:18:48 +03:00
777genius
71ad9e53e7 test(opencode): cover local mcp fallback with http 2026-05-16 23:56:43 +03:00
777genius
bfadfc95ee fix(opencode): preserve explicit mcp fallback env 2026-05-16 22:49:43 +03:00
777genius
2c393bc78f fix(opencode): preserve local mcp fallback 2026-05-16 22:30:11 +03:00
iliya
429dfe5528 fix(opencode): default to http mcp bridge 2026-05-16 21:31:47 +03:00
777genius
e6b9490c44 fix(opencode): widen Windows pidusage cache window 2026-05-16 13:09:33 +03:00
777genius
8fde8cefbf fix(opencode): harden Windows live preflight cleanup 2026-05-16 12:45:33 +03:00