perf: skip ssh repos during pty hydration

This commit is contained in:
Neil
2026-05-31 09:55:19 -07:00
committed by GitHub
parent 06aa7f9e1f
commit 20d4bbd791
2 changed files with 8 additions and 2 deletions
@@ -182,7 +182,7 @@ describe('hydrateLocalPtyRegistryAtBoot', () => {
expect(entry!.paneKey).toBe('tab-1:1')
})
it('skips SSH sessions (repo with non-null connectionId)', async () => {
it('skips SSH repos before enumerating worktrees', async () => {
const { hydrate, listRegisteredPtys } = await loadFresh()
const ptyId = 'repo-ssh::/remote/Stingray@@feedface'
@@ -200,6 +200,7 @@ describe('hydrateLocalPtyRegistryAtBoot', () => {
// visible to the local process sampler. Mirrors the spawn-time gate
// around `registerPty` in `pty.ts`'s `pty:spawn` handler.
expect(listRegisteredPtys()).toHaveLength(0)
expect(listRepoWorktreesMock).not.toHaveBeenCalled()
})
it('registers a local session whose worktree is in the store with the daemon-published pid', async () => {
@@ -76,8 +76,13 @@ export async function hydrateLocalPtyRegistryAtBoot(store: Pick<Store, 'getRepos
const repoConnectionIdByWorktreeId = new Map<string, string | null>()
for (const repo of repos) {
const worktrees = await listRepoWorktrees(repo)
const connectionId = repo.connectionId ?? null
if (connectionId) {
// Why: SSH PTYs are never registered for local process sampling, so
// avoid startup SSH/git enumeration for repos we will skip anyway.
continue
}
const worktrees = await listRepoWorktrees(repo)
for (const wt of worktrees) {
const worktreeId = `${repo.id}::${wt.path}`
repoConnectionIdByWorktreeId.set(worktreeId, connectionId)