Skip to content

Windows: dreamer verify-diff git calls are not hidden, so one verify pass flashes dozens of console windows #804

Closed

Description

@butterbrodskiy

What happened?

On Windows, a dreamer verify pass flashes dozens of console windows that steal focus. This is the same symptom as #553, which was closed as fixed in 0.44.2, but one spawn site was missed.

Every child process in the plugin passes windowsHide: true except the promisified exec in the verify-diff helper:

packages/plugin/src/features/magic-context/dreamer/verify-diff.ts, lines 7 and 18-25

const exec = promisify(execFile);
...
async function git(root: string, args: string[]): Promise<string> {
    const { stdout } = await exec("git", args, {
        cwd: root,
        timeout: 10_000,
        maxBuffer: MAX_DIFF_BYTES,
        encoding: "utf8",
    });

On OpenCode 2 the plugin host is opencode serve --service, which has no console of its own (no conhost child). A console-subsystem child started from it therefore gets a brand new console window, which appears on the desktop and takes focus.

buildVerifyDiffEvidence spawns one git per memory timestamp (rev-list -1 --before), one per distinct base (diff -M --name-status), and two per mapped file (diff -M --no-ext-diff <base> head and <base> worktree). So a single verify pass is tens of git processes.

Observed

Log line right before a burst in my log:

[2026-10-27T22:01:15.697Z] [dreamer] verify gate: mode=incremental in_scope=47 skipped=36 reason=incremental verification (47 changed of 83 mapped)

47 memories and 83 mapped files is roughly 80 git spawns, so roughly 80 console windows within a few seconds. Verify also reruns during the day whenever the gate sees changed files (2026-10-27 had verify passes at 16:54, 17:56, 21:21 and 22:01 UTC), so the flashing repeats.

Why the guard missed it

#553 added a check that fails when a new spawn site omits the hidden-window flag. This site hides behind an alias, const exec = promisify(execFile), so a scan for execFile( / spawn( literals does not see it. On OpenCode 1 the plugin runs inside the user's terminal, so the child inherits the existing console, no window is created, and the bug is invisible in that setup.

Measured

Windows 11 x64, OpenCode 2.2.0, plugin 0.49.25, bun 1.4.4. From a console-less parent, execFile a probe that reports GetConsoleWindow() plus IsWindowVisible():

  • without windowsHide: {"consoleVisible":true,"hwnd":1904578}
  • with windowsHide: true: {"consoleVisible":null,"hwnd":0}

The already-running MC embedding worker in the same host is fine, its console is not visible, so the embedding fork path is not involved.

Fix

const { stdout } = await exec("git", args, {
    cwd: root,
    timeout: 10_000,
    maxBuffer: MAX_DIFF_BYTES,
    encoding: "utf8",
    windowsHide: true,
});

Worth hardening the guard at the same time: either also resolve promisified aliases of execFile/exec, or route every child process through one small helper that sets the flag, so an alias cannot slip past again.

Environment

  • Plugin: 0.49.25
  • OpenCode: 2.2.0
  • Client: OpenCode TUI (CLI)
  • Platform: windows x64

Activity

  1. magic-alfonso commented on Oct 29, 2026

    @magic-alfonso

    Fixed in v0.49.29, thanks @butterbrodskiy. The dreamer's verify step now runs its git commands with their window hidden on Windows, so a verify pass no longer flashes console windows. A test now checks every place Magic Context starts a process, including ones run through promisified helpers. Update with npx @cortexkit/magic-context@latest setup (or your usual update path) and restart OpenCode or Pi.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions