From 84d246b9f048b0ac5bbefda2311ba92c51f1daa4 Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 3 Oct 2026 01:01:41 -0700 Subject: [PATCH] fix(jcode): register in main's remote-installer guard, drop our duplicate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rebasing onto 853 commits of main surfaced two things the earlier branch had hidden. main already owns a guard for the issue-#7253 bug class (`remote-hook-service-registry-coverage.test.ts`). This branch had added a second, near-identical one — a parallel implementation of a test that already existed, which is what AGENTS.md's reuse rule is about. Deleted ours and registered jcode in main's, which is the one that has kept pace with every agent added since. Also fixes a missing separator in the mobile icon map. `pnpm tc` does not cover `mobile/`, so only the session-route closure suite caught it. Co-authored-by: czzczz --- .../components/mobile-agent-icon-assets.ts | 2 +- ...mote-hook-installer-registry-guard.test.ts | 68 ------------------- ...ote-hook-service-registry-coverage.test.ts | 4 +- src/main/jcode/hook-gate-script.test.ts | 3 +- src/main/jcode/hook-service.test.ts | 3 +- src/shared/jcode-session-files.test.ts | 3 +- 6 files changed, 10 insertions(+), 73 deletions(-) delete mode 100644 src/main/agent-hooks/remote-hook-installer-registry-guard.test.ts diff --git a/mobile/src/components/mobile-agent-icon-assets.ts b/mobile/src/components/mobile-agent-icon-assets.ts index 0638eb17211..fdab7f7959e 100644 --- a/mobile/src/components/mobile-agent-icon-assets.ts +++ b/mobile/src/components/mobile-agent-icon-assets.ts @@ -46,6 +46,6 @@ export const MOBILE_AGENT_ICON_ASSETS: Partial ({ - app: { - getPath: () => '/tmp/orca-user-data' - } -})) - -import { claudeHookService } from '../claude/hook-service' -import { openClaudeHookService } from '../openclaude/hook-service' -import { codexHookService } from '../codex/hook-service' -import { geminiHookService } from '../gemini/hook-service' -import { antigravityHookService } from '../antigravity/hook-service' -import { ampHookService } from '../amp/hook-service' -import { cursorHookService } from '../cursor/hook-service' -import { droidHookService } from '../droid/hook-service' -import { commandCodeHookService } from '../command-code/hook-service' -import { grokHookService } from '../grok/hook-service' -import { copilotHookService } from '../copilot/hook-service' -import { hermesHookService } from '../hermes/hook-service' -import { devinHookService } from '../devin/hook-service' -import { kimiHookService } from '../kimi/hook-service' -import { museHookService } from '../muse/hook-service' -import { jcodeHookService } from '../jcode/hook-service' -import { MANAGED_AGENT_HOOK_INSTALLERS } from './managed-agent-hook-controls' -import { REMOTE_MANAGED_HOOK_INSTALLER_AGENTS } from './remote-managed-hook-installers' - -// Why: Droid (and Copilot) each shipped a working installRemote but were never -// registered in REMOTE_MANAGED_HOOK_INSTALLERS, so their status silently never -// appeared over SSH (issue #7253). Guard the whole bug class, not one agent: -// every locally-managed hook service that implements installRemote MUST be -// wired into the remote installer. -describe('remote hook installer registry guard', () => { - it('registers every managed agent that implements installRemote in the remote installer (issue #7253)', () => { - const servicesByAgent = new Map([ - ['claude', claudeHookService], - ['openclaude', openClaudeHookService], - ['codex', codexHookService], - ['gemini', geminiHookService], - ['antigravity', antigravityHookService], - ['amp', ampHookService], - ['cursor', cursorHookService], - ['droid', droidHookService], - ['command-code', commandCodeHookService], - ['grok', grokHookService], - ['copilot', copilotHookService], - ['hermes', hermesHookService], - ['devin', devinHookService], - ['kimi', kimiHookService], - ['muse', museHookService], - ['jcode', jcodeHookService] - ]) - - // Guard against a service silently missing from the map above as new agents land. - for (const [agent] of MANAGED_AGENT_HOOK_INSTALLERS) { - expect(servicesByAgent.has(agent)).toBe(true) - } - - const registered = new Set(REMOTE_MANAGED_HOOK_INSTALLER_AGENTS) - const missing: string[] = [] - for (const [agent, service] of servicesByAgent) { - if (typeof service.installRemote === 'function' && !registered.has(agent)) { - missing.push(agent) - } - } - expect(missing).toEqual([]) - }) -}) diff --git a/src/main/agent-hooks/remote-hook-service-registry-coverage.test.ts b/src/main/agent-hooks/remote-hook-service-registry-coverage.test.ts index 1fb3dc75ee8..57d8610bbc2 100644 --- a/src/main/agent-hooks/remote-hook-service-registry-coverage.test.ts +++ b/src/main/agent-hooks/remote-hook-service-registry-coverage.test.ts @@ -26,6 +26,7 @@ import { openClaudeHookService } from '../openclaude/hook-service' import { qwenCodeHookService } from '../qwen-code/hook-service' import { qoderCnHookService, qoderHookService } from '../qoder/hook-service' import { zcodeHookService } from '../zcode/hook-service' +import { jcodeHookService } from '../jcode/hook-service' import { MANAGED_AGENT_HOOK_INSTALLERS } from './managed-agent-hook-controls' import { REMOTE_MANAGED_HOOK_INSTALLER_AGENTS } from './remote-managed-hook-installers' @@ -59,7 +60,8 @@ describe('remote hook service registry coverage', () => { ['qwen-code', qwenCodeHookService], ['codebuddy', codebuddyHookService], ['zcode', zcodeHookService], - ['dsh', dshHookService] + ['dsh', dshHookService], + ['jcode', jcodeHookService] ]) // Guard against a service silently missing from the map above as new agents land. diff --git a/src/main/jcode/hook-gate-script.test.ts b/src/main/jcode/hook-gate-script.test.ts index 3378a4d83d3..d630c65f7ac 100644 --- a/src/main/jcode/hook-gate-script.test.ts +++ b/src/main/jcode/hook-gate-script.test.ts @@ -6,7 +6,8 @@ import { dirname, join } from 'node:path' const { homedirMock } = vi.hoisted(() => ({ homedirMock: vi.fn<() => string>() })) vi.mock('os', async () => { - const actual = await vi.importActual('os') // eslint-disable-line @typescript-eslint/consistent-type-imports -- vi.importActual requires inline import() + // oxlint-disable-next-line typescript/consistent-type-imports -- vi.importActual needs the inline import() to type the real module + const actual = await vi.importActual('os') return { ...actual, homedir: homedirMock } }) diff --git a/src/main/jcode/hook-service.test.ts b/src/main/jcode/hook-service.test.ts index b883411a635..3a87aa4ef6a 100644 --- a/src/main/jcode/hook-service.test.ts +++ b/src/main/jcode/hook-service.test.ts @@ -8,7 +8,8 @@ const { homedirMock } = vi.hoisted(() => ({ })) vi.mock('os', async () => { - const actual = await vi.importActual('os') // eslint-disable-line @typescript-eslint/consistent-type-imports -- vi.importActual requires inline import() + // oxlint-disable-next-line typescript/consistent-type-imports -- vi.importActual needs the inline import() to type the real module + const actual = await vi.importActual('os') return { ...actual, homedir: homedirMock } }) diff --git a/src/shared/jcode-session-files.test.ts b/src/shared/jcode-session-files.test.ts index a38568bb062..c3ffbb3c02d 100644 --- a/src/shared/jcode-session-files.test.ts +++ b/src/shared/jcode-session-files.test.ts @@ -8,7 +8,8 @@ const { homedirMock } = vi.hoisted(() => ({ })) vi.mock('os', async () => { - const actual = await vi.importActual('os') // eslint-disable-line @typescript-eslint/consistent-type-imports -- vi.importActual requires inline import() + // oxlint-disable-next-line typescript/consistent-type-imports -- vi.importActual needs the inline import() to type the real module + const actual = await vi.importActual('os') return { ...actual, homedir: homedirMock } })