Skip to content

test(mcp): assert the spawned child env carries no host session markers or host MCP config (slice of #1082) #1189

Closed as not planned

Description

@HugoXK

Slice of #1082 (itself the remainder of #963). The child-env row only, and it is a test-only slice.

The host worker spawns a child process (detached run / host MCP path). Today nothing asserts that the child env is clean, so a host session marker or a host MCP config path leaking into it would only be noticed by hand.

What changes

  • one offline test that captures the child env actually handed to the spawn call and asserts:
    • no host session markers (the session/env keys the host passes to our own process, named explicitly in the test, not by a blanket "no env at all" assertion);
    • no host MCP config path (*_MCP_CONFIG-style keys and any host config path the child would otherwise inherit);
  • if the test finds a real leak, the fix lands in the same PR, and the test is written first.

Acceptance

  • the test runs offline, no container, no network;
  • teeth, since this is test-only: deleting the scrub (or reinstating the leaking key) turns the test red; report the failing id from that probe and confirm the probe is reverted, never committed;
  • the assertion names the exact keys it forbids, so a future host key does not silently pass;
  • Partial: #1082, Partial: #963; changelog fragment only if behaviour changes.

Evidence the PR must carry

  • the teeth probe: command, the red id it produced, and the reverted tree grep;
  • green run of the new test file at the tip with the exact command;
  • the per-file diff.

Sequencing: the test can be written and run now on a local branch; the PR opens when a queue slot frees (the Lead says when), so a review seat never has three AD PRs at once.

Activity

  1. self-assigned this
    on Nov 20, 2026
  2. added
    area:pluginsHost plugins and installers: Claude Code, Codex, DSH, OpenCode, MCP server
    on Nov 20, 2026
  3. HugoXK commented on Nov 20, 2026

    @HugoXK
    CollaboratorAuthor

    Closing this as already shipped — I opened it on a false premise and the premise is what needed checking, not the code.

    Evidence, read at f5017f93:

    • tests/test_host_env_scrub.py exists (added by 23979b73, PR #1088), 272 lines, and already pins the spawn boundary rather than only the helper: test_launch_hands_the_child_a_scrubbed_environment (asserts DSH_SESSION_ID and MCP_SERVERS absent from the env handed to runstore.launch), test_launch_keeps_the_host_config_dirs_and_drops_the_session, test_launch_re_scrubs_a_caller_supplied_env, test_scrub_drops_host_markers_and_keeps_what_the_run_needs, plus test_every_session_marker_is_dropped parametrized over every SESSION_MARKERS entry and test_the_worker_and_the_detached_run_share_one_list so the two lists cannot drift.
    • The transitive chain is pinned, not assumed: bypassing scrub_host_env in runstore.launch turns three of those launch-boundary rows red.
    • #1082's own comment at 2026-11-20T05:12:58Z already recorded both the write-dir and child-env rows as shipped (#1087, #1088); I read the acceptance text and opened this slice without reading that thread. My error, not a review finding.

    No work lost: nothing was pushed, no branch reached the remote, and the PR in review (#1186) stays frozen at 4015bb8f.

    Partial: #1082 / Partial: #963 are already carried by the PRs that shipped these rows, so nothing here needs to stay open.

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

Metadata

Metadata

Assignees

Labels

area:pluginsHost plugins and installers: Claude Code, Codex, DSH, OpenCode, MCP serverenhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions