Skip to content

[Bug bounty] Windows fast path preserves stale launch-client attribution #272

Description

@ceodaradigu

Bounty eligibility

  • I have signed up at monk.io with this GitHub account
  • I have used the product (installed the plugin and completed the Codex MCP login)
  • I have starred this repo

Stage

connect

Coding agent

OpenAI Codex

Coding agent version

Codex desktop / codex-cli 0.146.0-alpha.3.1; Monk plugin v0.1.55

Repro steps

The native Windows launcher detects which supported host fired it and exports that value to a newly spawned companion as MONK_AGENT_LAUNCH_CLIENT. However, its healthy-process state fingerprint does not persist or compare the detected client.

  1. Start from current main/v0.1.55 (dbb6ce4) on Windows.
  2. Invoke scripts/start-monk-agent.ps1 from Codex (PLUGIN_ROOT set; no Cursor/Claude marker). The newly spawned companion inherits MONK_AGENT_LAUNCH_CLIENT=codex.
  3. Keep that companion healthy and invoke the same launcher from Cursor (CURSOR_PLUGIN_ROOT set; PLUGIN_ROOT absent).
  4. $Client is now cursor, but Test-BackgroundStateConfigured still returns true because it compares only agent path, auth/autospin values, and plugin version.
  5. The launcher takes its healthy fast path and exits without restarting the companion. The existing process continues to report codex.

I reproduced this with an isolated Windows regression harness using a temporary fake companion that records the inherited launch client and serves the exact protected-resource health document expected by the launcher. Against the unmodified launcher, changing only Codex to Cursor leaves one launch recorded with codex; the companion is not replaced.

Relevant current state comparison:

$Expected = @(
  "agent_path=$AgentPath",
  "auth_url=$AuthUrl",
  "auth_client_id=$AuthClientId",
  "auth_audience=$AuthAudience",
  "autospin_url=$AutospinUrl",
  "plugin_version=$PluginVersion"
)

The process environment is set only on spawn:

$env:MONK_AGENT_LAUNCH_CLIENT = $Client

Expected behavior

When the host client changes, the Windows launcher should restart a healthy companion once so the new process inherits the current MONK_AGENT_LAUNCH_CLIENT. A subsequent invocation from the same client should reuse it.

Actual behavior

A healthy companion is reused across host-client changes. Session metadata and telemetry remain attributed to whichever client originally started the process until unrelated configuration drift or a manual restart replaces it.

Severity (your guess)

minor

The companion remains available, but cross-client usage is attributed to the wrong integration, degrading client-level telemetry, diagnostics, and product decisions.

OS

Windows 11 Pro 10.0.26200; native Windows PowerShell 5.1 launcher

monkd version

Not involved; the defect is in the local companion reuse decision.

Target cloud

None

Integration (if relevant)

OpenAI Codex and Cursor sharing the native Windows companion

Duplicate check

Fresh open/closed searches covered MONK_AGENT_LAUNCH_CLIENT, launch client, wrong client, attribution, and background state.

No matching report was found.

Tested fix

A focused patch adds launch_client=$Client symmetrically to the state writer and exact-match reuse gate in all three generated PowerShell launcher copies. A Windows regression wired into install-e2e.yml verifies:

  • first Codex launch inherits codex;
  • unchanged Codex invocation reuses the companion;
  • changing to Cursor restarts exactly once and inherits cursor;
  • state persists launch_client=cursor;
  • all three shipped launcher copies remain byte-identical.

Local result:

launch_client_restart_status=pass launches=2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug-bountyFiled during the July 2026 Monk plugin bug bounty

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions