Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

Interceptor VerifyViewport.ts `stop` never detaches its CDP context, leaving a phantom cdp:app-<port> that `diagnose` reports as connected

Open dsather opened this issue 3 months ago • 1 comments

File: LifeOS/install/skills/Interceptor/Tools/VerifyViewport.ts lines 302–305 at ce046f26

VerifyViewport.ts stop kills Chrome but never detaches its CDP context, leaving a phantom context in the daemon

if (cmd === 'stop') {
  await sh('pkill', ['-f', USER_DATA_DIR])
  console.log('[VerifyViewport] stopped')
  return
}

ensure/check attach through interceptor macos cdp connect <port> + cdp attach, which registers a cdp:app-<port> context in the daemon. stop only kills the headless Chrome. The daemon keeps the context registered with the debug endpoint gone. Observed on 0.23.25 after a normal check → stop:

$ interceptor contexts
<test-profile-context>
cdp:app-9333            ← nothing listening on :9333 (lsof empty), still listed

$ interceptor diagnose
context cdp:app-9333: cdp app: connected      ← reported connected

$ interceptor tabs --context cdp:app-9333
error: context 'cdp:app-9333' not found

It stayed that way for ~2.5 hours until an explicit interceptor macos cdp detach --context cdp:app-9333.

Why it matters beyond untidiness:

  • interceptor contexts now shows two rows, so PreflightIsolation.sh's exit-6 remediation ("copy the live UUID from the list above into preferences.env") can steer an agent to pin the dead cdp:app-<port> id.
  • diagnose — the verb SKILL.md says to run first when anything is wedged — reports a dead context as live.
  • Whether aux contexts count toward the daemon's "multiple extensions connected" fail-fast is version-dependent; on 0.23.25 they did not, but the listing alone is enough to confuse the gate's text.

Suggested fix

Detach every CDP context on the tool's port before the kill; the attach path already contains the exact call (line 233), so it is a five-line reuse:

if (cmd === 'stop') {
  try {
    const { out } = await sh('interceptor', ['macos', 'cdp', 'status'])
    for (const c of parseCdpList(out)) {
      if (c.port === PORT && c.contextId) {
        await sh('interceptor', ['macos', 'cdp', 'detach', '--context', c.contextId])
      }
    }
  } catch { /* daemon down or nothing attached */ }
  await sh('pkill', ['-f', USER_DATA_DIR])
  console.log('[VerifyViewport] stopped')
  return
}

Verified: after the change, check → stop → interceptor contexts lists only the browser context.

Environment: macOS, Interceptor 0.23.25 signed-pkg install (CDP context ids in the cdp:app-<port> scheme), skill version 4.3.18.

dsather avatar Aug 28 '26 23:08 dsather

Landed: stop detaches every context on the port before the pkill. Next release. Thanks.

danielmiessler avatar Sep 03 '26 23:09 danielmiessler