Skip to content

supervisor: gate wraps ANY cbm_mcp_handle_tool embedder — test binaries recurse into spawn chains #845

Closed

Description

@DeusData

Discovered during the #828 distill (2026-07-04). The #827 index supervisor's gate in handle_index_repository wraps unconditionally (unless --index-worker/CBM_INDEX_SUPERVISOR=0), and the worker spawn resolves the CURRENT binary (self) — correct for the MCP server/CLI, wrong for any other embedder of cbm_mcp_handle_tool.

Observed: tests/repro's runner indexes via cbm_mcp_handle_tool → the supervisor spawns ' cli --index-worker index_repository ...' → the test binary ignores argv, selects suites via the inherited CBM_REPRO_ONLY env (or runs ALL suites when unset) → re-indexes → spawns grandchildren recursively. 11+ min idle process chains observed; the main test-runner escapes only by accident (argv-based suite selection). These recursive spawn trees during test runs also multiply kernel VM-map load (see the 2026-07-04 host panics).

Fix shape (product, not just tests): main() of the real binary marks itself as a supervisor-capable host (e.g. cbm_index_supervisor_mark_host()); the gate wraps ONLY when marked. Embedders/tests then run in-process by default. Belt+suspenders: export CBM_INDEX_SUPERVISOR=0 in the repro/test harness mains. Needs a RED reproduction first (tiny embedder that calls handle_tool and asserts no child spawn) per reproduce-first policy.

Activity

  1. added
    bugSomething isn't working
    stability/performanceServer crashes, OOM, hangs, high CPU/memory
    priority/highNeeds near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker.
    on Jul 4, 2026
  2. added a commit that references this issue on Jul 4, 2026
    fbd7287
  3. DeusData commented on Jul 4, 2026

    @DeusData
    OwnerAuthor

    Fixed on main via #851 (merge 37c00d1). Both bugs landed reproduce-first: (1) the supervisor gate now wraps only a process that called cbm_index_supervisor_mark_host() (the real binary's main), so embedders of cbm_mcp_handle_tool — including the test runner — index in-process and can no longer trigger the recursive ' cli --index-worker' spawn chains; (2) the CLI worker now starts the parent-death watchdog, so a worker whose supervisor dies exits instead of orphaning. This also removes a recursive-spawn contributor to the local build kernel-panics observed 2026-07-04. Guard tests: index_supervisor_gate_requires_marked_host_issue845 + test_worker_watchdog.sh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority/highNeeds near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker.stability/performanceServer crashes, OOM, hangs, high CPU/memory

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions