The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
Isolate Kilo runtime from the shared adoption provider (#1095)
Dee5ff6c2edce03
diff --git a/cli/e2e/lean.e2e.ts b/cli/e2e/lean.e2e.tsindex a60d02725..65e3aaa97 100644--- a/cli/e2e/lean.e2e.ts+++ b/cli/e2e/lean.e2e.ts@@ -130,6 +130,10 @@ describe('harnessd\'s master and services lean', () => {// service with MODULE_NOT_FOUND until the master itself restarted. The lean bundle is only ever an// optimisation.const d = await fresh()+ // Core readiness deliberately precedes service readiness. This case removes a RUNNING+ // bundle, not one a freshly spawned service is still importing for the first time.+ await until('the services to finish importing the test bundle',+ () => SERVICES.every(name => d.log().includes(`[service ${name}] connected to the core`)) || null, 30_000, 100)const ours = /\[harnessd\] services run from (\S+), as this master does/.exec(d.log())![1]rmSync(dirname(ours), { recursive: true })const search = servicePids(d).get('search')!diff --git a/cli/scripts/handoff-2026-10-08/mutate-kilo.py b/cli/scripts/handoff-2026-10-08/mutate-kilo.pynew file mode 100644index 000000000..ccec88673--- /dev/null+++ b/cli/scripts/handoff-2026-10-08/mutate-kilo.py@@ -0,0 +1,42 @@+"""Check Kilo's shared adoption wiring and independent runtime entry; restore each mutation."""+import os+from pathlib import Path+import subprocess+import sys++cli = Path(sys.argv[1]).resolve()+golden = 'src/engines/otherAdoption.golden.spec.ts'+index = 'src/lib/sessionSearch/externals/index.ts'+mutations = [+ ('Kilo reads OpenCode store', index,+ "code.opencodeProvider({ engine: 'kilo', dbPath: paths.kiloDb })",+ "code.opencodeProvider({ engine: 'kilo', dbPath: paths.opencodeDb })", golden),+ ('Kilo claims OpenCode owners', index,+ "code.opencodeProvider({ engine: 'kilo', dbPath: paths.kiloDb })",+ "code.opencodeProvider({ engine: 'opencode', dbPath: paths.kiloDb })", golden),+ ('Kilo runtime depends on adoption again', 'src/engines/kilo/inProcess.ts',+ "export { KiloReader, readKiloMessages } from './reader.js'",+ "export { KiloReader, readKiloMessages } from './reader.js'\nexport { opencodeProvider } from '../../lib/sessionSearch/externals/opencode.js'",+ 'src/engines/inProcess.spec.ts'),+]+env = {**os.environ, 'TZ': 'UTC', 'TMPDIR': '/tmp'}+env.pop('TMUX', None)+env.pop('TMUX_PANE', None)+command = ['node', 'node_modules/vitest/vitest.mjs', 'run', '--maxWorkers=1']+baseline = subprocess.run([*command, *sorted({item[4] for item in mutations})], cwd=cli, env=env,+ capture_output=True, text=True, timeout=90)+if baseline.returncode:+ sys.exit('Baseline did not pass; no mutations run.\n' + baseline.stdout[-5000:] + baseline.stderr[-5000:])+for name, path, old, new, spec in mutations:+ target = cli / path+ source = target.read_text()+ assert source.count(old) == 1, (name, source.count(old))+ try:+ target.write_text(source.replace(old, new))+ result = subprocess.run([*command, spec], cwd=cli, env=env, capture_output=True, text=True, timeout=90)+ caught = result.returncode != 0 and 'AssertionError' in result.stdout + result.stderr+ print(f'{name}: {"caught by assertion" if caught else "NOT PROVEN"}', flush=True)+ if not caught:+ sys.exit(result.stdout[-5000:] + result.stderr[-5000:])+ finally:+ target.write_text(source)diff --git a/cli/src/engines/__fixtures__/other-adoption.golden.json b/cli/src/engines/__fixtures__/other-adoption.golden.jsonindex d177f72a7..6609a6ddd 100644--- a/cli/src/engines/__fixtures__/other-adoption.golden.json+++ b/cli/src/engines/__fixtures__/other-adoption.golden.json@@ -414,5 +414,49 @@false,null]- ]+ ],+ "Kilo alone": {+ "sessions": [+ {+ "sessionId": "ses_kiloperson",+ "engine": "kilo",+ "cwd": "/work/kilo",+ "origin": "terminal",+ "title": "Fix the build",+ "mtime": 1789898410000,+ "transcriptPath": null,+ "readHistory": [+ {+ "type": "user_message",+ "payload": {+ "content": "please fix the build"+ }+ },+ {+ "type": "text_delta",+ "payload": {+ "content": "Done."+ }+ },+ {+ "type": "done",+ "payload": {+ "result": "success"+ }+ }+ ]+ }+ ],+ "owners": [+ {+ "sessionId": "ses_kiloperson",+ "pid": 105,+ "record": "<root>/home/.local/share/kilo/kilo.db#ses_kiloperson",+ "fromArgs": true+ }+ ],+ "busy": [+ false+ ]+ }}diff --git a/cli/src/engines/inProcess.spec.ts b/cli/src/engines/inProcess.spec.tsindex 472cd420c..6988cf77a 100644--- a/cli/src/engines/inProcess.spec.ts+++ b/cli/src/engines/inProcess.spec.ts@@ -94,6 +94,18 @@ async function fresh(screens: 'counted' | 'broken') {}describe('the core\'s side', () => {+ it('loads Kilo runtime code when the shared adoption reader cannot load', async () => {+ vi.doMock('../lib/sessionSearch/externals/opencode.js', () => { throw new Error('adoption chunk unavailable') })+ try {+ const { inProcess } = await fresh('counted')+ expect(await inProcess.loadEngine('opencode')).toBeNull()+ const kilo = await inProcess.loadEngine('kilo')+ expect(kilo).not.toBeNull()+ expect(kilo).toHaveProperty('KiloReader')+ expect(inProcess.engineNow('kilo', 'a pane was read')).toHaveProperty('createRuntimeProfileReader')+ } finally { vi.doUnmock('../lib/sessionSearch/externals/opencode.js') }+ })+it('names the twelve engines besides Claude Code, Codex and the terminal', () => {expect(ENGINES.filter(isOtherEngine)).toEqual(ENGINES.filter((engine) => !['claude', 'codex', 'terminal'].includes(engine)))expect(OTHER_ENGINES).toHaveLength(12)diff --git a/cli/src/engines/kilo/inProcess.ts b/cli/src/engines/kilo/inProcess.tsindex a59841226..978b134f4 100644--- a/cli/src/engines/kilo/inProcess.ts+++ b/cli/src/engines/kilo/inProcess.ts@@ -6,7 +6,4 @@export { KiloReader, readKiloMessages } from './reader.js'export { kiloMessagesToEvents, lastKiloTurnText, windowKiloMessages } from './normalizer.js'export { kiloFooterModelId, parseKiloModelsOutput } from './runtimeProfile.js'-// Its adoption reader, which Kilo shares with OpenCode: their stores are one shape.-export { opencodeProvider } from '../../lib/sessionSearch/externals/opencode.js'-export { createRuntimeProfileReader } from './profileReader.js'diff --git a/cli/src/engines/otherAdoption.golden.spec.ts b/cli/src/engines/otherAdoption.golden.spec.tsindex afc72d87c..96ff474d9 100644--- a/cli/src/engines/otherAdoption.golden.spec.ts+++ b/cli/src/engines/otherAdoption.golden.spec.ts@@ -313,6 +313,22 @@ describe('what the core\'s adoption finds of the other engines\' conversations',check('owners', owners)}, 60_000)+ it('keeps Kilo history and ownership in its own store when it is the only reader asked', async () => {+ const provider = m.index.externalProviders(m.index.externalPaths(process.env)).find(row => row.engine === 'kilo')!+ const sessions = await new m.external.ExternalSessions({ providers: [provider], excluded: [], log: () => {} }).scan()+ const owners = await provider.owners!({+ list: async () => [+ { pid: 105, ppid: 1, executable: 'kilo', args: `kilo -s ${ID.kilo}` },+ { pid: 104, ppid: 1, executable: 'opencode', args: `opencode -s ${ID.opencode}` },+ ],+ openFiles: async () => new Map(), openFilesOf: async () => new Map(), alive: () => true,+ })+ check('Kilo alone', {+ sessions: await Promise.all(sessions.map(async session => ({ ...session, readHistory: await session.readHistory?.() }))),+ owners, busy: await Promise.all(owners.map(owner => provider.busy!(owner))),+ })+ })+it('has a recorded outcome for every case, and no other', () => {if (RECORD) returnexpect(Object.keys(recorded).sort()).toEqual(Object.keys(golden).sort())diff --git a/cli/src/lib/sessionSearch/externals/index.spec.ts b/cli/src/lib/sessionSearch/externals/index.spec.tsindex 045858cc0..ac17df6c5 100644--- a/cli/src/lib/sessionSearch/externals/index.spec.ts+++ b/cli/src/lib/sessionSearch/externals/index.spec.ts@@ -66,10 +66,10 @@ describe('the other engines\' readers, loaded on first use', () => {await cursor.owners!(none)await cursor.busy!({ pid: 1, record: '' })expect(vi.mocked(loadEngine).mock.calls).toEqual([['cursor']])- // Kilo's reader is OpenCode's, loaded with Kilo's code; Claude Code's and Codex's are declared, and load nothing.+ // Kilo explicitly asks OpenCode's shared store reader; its own runtime entry stays independent.vi.mocked(loadEngine).mockClear()for (const engine of ['kilo', 'claude', 'codex']) await providers.find((provider) => provider.engine === engine)!.owners!(none)- expect(vi.mocked(loadEngine).mock.calls).toEqual([['kilo']])+ expect(vi.mocked(loadEngine).mock.calls).toEqual([['opencode']])})it('lists nothing and holds nothing open for an engine whose code could not be loaded', async () => {diff --git a/cli/src/lib/sessionSearch/externals/index.ts b/cli/src/lib/sessionSearch/externals/index.tsindex 60ed5db07..45b693faa 100644--- a/cli/src/lib/sessionSearch/externals/index.ts+++ b/cli/src/lib/sessionSearch/externals/index.ts@@ -109,7 +109,8 @@ export function externalProviders(paths: ExternalPaths = externalPaths()): Exterloaded('grok', 'grok', (code) => code.grokProvider({ home: paths.grokHome })),loaded('copilot', 'copilot', (code) => code.copilotProvider({ home: paths.copilotHome })),loaded('opencode', 'opencode', (code) => code.opencodeProvider({ engine: 'opencode', dbPath: paths.opencodeDb })),- loaded('kilo', 'kilo', (code) => code.opencodeProvider({ engine: 'kilo', dbPath: paths.kiloDb })),+ // These stores share a reader. Loading it must not make Kilo's runtime entry depend on OpenCode.+ loaded('kilo', 'opencode', (code) => code.opencodeProvider({ engine: 'kilo', dbPath: paths.kiloDb })),loaded('hermes', 'hermes', (code) => code.hermesProvider({ root: paths.hermesRoot })),loaded('devin', 'devin', (code) => code.devinProvider({ home: paths.devinHome })),loaded('pi', 'pi', (code) => code.piProvider({ agentDir: paths.piAgentDir, ...(paths.piSessionDir ? { sessionDir: paths.piSessionDir } : {}) })),diff --git a/docs/research/2026-10-09-kilo-adoption-boundary.md b/docs/research/2026-10-09-kilo-adoption-boundary.mdnew file mode 100644index 000000000..dadc9025f--- /dev/null+++ b/docs/research/2026-10-09-kilo-adoption-boundary.md@@ -0,0 +1,14 @@+# Kilo adoption boundary++Before changing module dependencies, the adoption golden was re-recorded from+main `47d2f5a6b` with pinned Linux platform, clock, UTC, private homes and `/tmp`.+The existing outcomes were unchanged. An additional case records Kilo alone:+its own SQLite store, complete history, exact process ownership and busy answer,+while an OpenCode process is present. Four golden specs pass.++This is the separate former-code recording commit. The subsequent move will+remove the adoption-provider re-export from Kilo's runtime entry and explicitly+ask OpenCode's module for the shared store reader, as allowed by the handoff.+Kilo's native runtime module will no longer import the adoption reader or the+OpenCode runtime code that reader reaches. The fixtures must pass unchanged,+and redirecting Kilo to the OpenCode store must fail their assertions.