#5846 · Logged background children omit Windows console suppression
Verdict: PARTIALLY REPRODUCED · Root-cause confidence: medium
1. TL;DR
The report describes an unwanted terminal window during Windows background-daemon startup. Trusted main does launch logged child processes without explicitly requesting hidden Windows consoles, and a real-child diagnostic confirmed that omission twice in clean checkouts. The installer has a separate WMI launch step that requests a hidden show state but does not set a detached-process creation flag. This investigation ran on Linux, so it cannot establish the reported Windows Terminal behavior or validate a platform-specific repair. No pull request was opened: the required full reproduction and before/after Windows regression proof are missing.
2. Claims vs findings
| Claim being tested | Status | Evidence |
|---|---|---|
| The logged-child launcher omits a hidden-console request. | Verified | The diagnostic forwarded four real spawns per checkout and observed windowsHide: absent for both process names with and without IPC. |
| The installer already requests a hidden launcher process. | Verified in source | spawnDaemon passes windowsHide: true and detached: true. That is a different spawn from the managed daemon child. |
| The WMI relaunch relies on a hidden show state rather than a detached creation flag. | Verified in source | START_DETACHED_PROCESS_SCRIPT supplies ShowWindow = [uint16]0; no CreateFlags property is present. |
| Windows Terminal displays a persistent console across the listed launch methods. | Unverified | No Windows desktop or default-terminal-host configuration was available. No console screenshot was captured. |
| Particular WMI creation flags are accepted or rejected, and a two-part change eliminates every window. | Unverified | No PowerShell, WMI, Windows logon, Task Scheduler, or downstream worker visibility test was run. No issue-supplied code was executed. |
3. Environment
- Repository: public
get-bb/bb, freshly fetched trustedorigin/mainat the full commit above. - Execution platform: Linux x86_64; Node.js
v22.19.0; pnpm9.15.0; packagebb-appversion0.46.1. - Two detached clean worktrees at the identical base commit, named
base-firstandbase-secondunder a temporary investigation directory. - No development server, ports, live BB instance, enrollment, provider account, or existing runtime data used. Each diagnostic run made a fresh temporary log directory and removed it afterward.
- Windows execution was unavailable; neither Wine nor PowerShell was installed. This is not a Windows visual reproduction.
4. Minimal reproduction
This diagnostic observes the actual Node spawn boundary while forwarding every call to the original spawn implementation. It does not simulate Windows or replace the child with a fake. Save the complete script below as launch-probe.mjs outside the checkout.
- Create a clean trusted base and prepare it using normal repository orchestration:
git clone https://github.com/get-bb/bb.git bb-investigation cd bb-investigation git fetch origin main git worktree add --detach ../base-first e0f6fda5a02332bd4eb44183542a57f34f3263d7 cd ../base-first pnpm install --frozen-lockfile --prefer-offline pnpm exec turbo run build
- Run the diagnostic using Node's built-in TypeScript stripping. No additional dependency is required:
node --experimental-strip-types ../launch-probe.mjs . result=$? printf 'diagnostic_exit=%s\n' "$result"
- Expected diagnostic contract: every background launch explicitly requests
windowsHide: true; captured logs and IPC still work; diagnostic exit is zero. Actual on trusted main, verbatim stdout:{"platform":"linux","node":"v22.19.0"} {"logName":"host-daemon","ipc":false,"windowsHide":"absent","stdio":["ignore","file","file"],"exitCode":0,"logsCaptured":true,"ipcDelivered":null} {"logName":"host-daemon","ipc":true,"windowsHide":"absent","stdio":["ignore","file","file","ipc"],"exitCode":0,"logsCaptured":true,"ipcDelivered":true} {"logName":"server","ipc":false,"windowsHide":"absent","stdio":["ignore","file","file"],"exitCode":0,"logsCaptured":true,"ipcDelivered":null} {"logName":"server","ipc":true,"windowsHide":"absent","stdio":["ignore","file","file","ipc"],"exitCode":0,"logsCaptured":true,"ipcDelivered":true} Hidden-console launch request missing: 4/4 Windows console visibility: NOT TESTED (launch options only) diagnostic_exit=1The diagnostic's exit1marks the missing launch option. All four real children exited0, wrote both log streams, and delivered IPC where requested. This is a launch-option finding, not proof that Windows opened a window. The script emits no environment values or local paths.
Complete diagnostic source
import assert from "node:assert/strict";
import childProcess from "node:child_process";
import { once } from "node:events";
import { mkdtempSync, readFileSync, rmSync } from "node:fs";
import { syncBuiltinESMExports } from "node:module";
import { tmpdir } from "node:os";
import { join, resolve } from "node:path";
import { pathToFileURL } from "node:url";
const checkout = resolve(process.argv[2] ?? ".");
const scratch = mkdtempSync(join(tmpdir(), "bb-5846-launch-"));
const observed = [];
const originalSpawn = childProcess.spawn;
childProcess.spawn = function (command, args, options) {
observed.push({
windowsHide: options.windowsHide ?? "absent",
stdio: options.stdio.map((entry) =>
typeof entry === "number" ? "file" : entry,
),
});
return originalSpawn(command, args, options);
};
syncBuiltinESMExports();
try {
const { spawnLoggedProcess } = await import(
pathToFileURL(join(checkout, "packages/bb-app/src/logged-process.ts")).href
);
console.log(JSON.stringify({ platform: process.platform, node: process.version }));
for (const logName of ["host-daemon", "server"]) {
for (const ipc of [false, true]) {
const logDir = join(scratch, logName, String(ipc));
const child = spawnLoggedProcess({
command: process.execPath,
args: [
"-e",
'console.log("child-ready"); console.error("stderr-ready"); if (process.send) process.send("ipc-ready", () => process.disconnect());',
],
env: {},
ipc,
logDir,
logName,
});
const completion = once(child, "close");
const timer = setTimeout(() => child.kill(), 5000);
let exitCode;
let message = null;
try {
if (ipc) [message] = await once(child, "message");
[exitCode] = await completion;
} finally {
clearTimeout(timer);
}
assert.equal(exitCode, 0);
if (ipc) assert.equal(message, "ipc-ready");
const log = readFileSync(join(logDir, logName + "-stdio.log"), "utf8");
assert.equal(log, "child-ready\nstderr-ready\n");
console.log(JSON.stringify({
logName,
ipc,
...observed.at(-1),
exitCode,
logsCaptured: true,
ipcDelivered: ipc ? message === "ipc-ready" : null,
}));
}
}
const missing = observed.filter((entry) => entry.windowsHide !== true).length;
console.log("Hidden-console launch request missing: " + missing + "/" + observed.length);
console.log("Windows console visibility: NOT TESTED (launch options only)");
process.exitCode = missing > 0 ? 1 : 0;
} finally {
childProcess.spawn = originalSpawn;
syncBuiltinESMExports();
rmSync(scratch, { recursive: true, force: true });
}
The symptom is visual, but this environment could not display or capture it. There is deliberately no substitute or fabricated screenshot. The next required visual evidence is a real Windows desktop capture before launch, during startup, and while the daemon remains connected.
5. Root cause
Verified implementation gap: spawnLoggedProcess opens log-file descriptors and passes only the working directory, environment, and stdio configuration to Node's spawn API:
return spawn(args.command, args.args, {
cwd: process.cwd(),
env: args.env,
stdio: args.ipc === true ? ["ignore", fd, fd, "ipc"] : ["ignore", fd, fd],
});
The installer invokes the launcher with supervision enabled, as seen in runDaemon. The launcher's startDaemon closure creates the managed daemon via spawnNamedManagedProcess, which delegates to this helper. The restart loop calls the same daemon-start closure again. Thus the omission exists at the actual managed-child boundary, including supervised restarts, rather than merely in an unused utility.
Separate earlier boundary: installer spawnDaemon already requests hidden detached launch for its own child. The top-level WMI creation script and its caller request a hidden show state for the created process and windowsHide: true for PowerShell itself. These are different process boundaries; suppressing one does not establish what the other requests. The logon command also uses a PowerShell hidden-window request.
Inference, not observed Windows behavior: missing console suppression on a newly launched managed child is consistent with the reported visible-console symptom. Whether the default Windows terminal host disregards the WMI show-state request, whether a new console is allocated in each launch path, and which process owns any visible window remain unverified. Root-cause confidence for the full user-visible defect is therefore medium; confidence in the missing spawn option is high.
History inspection associated the logged-process helper with the existing terminal-backpressure/log-redirection work. The current tests exercise redirected streams and failure behavior, but do not test real Windows console visibility.
6. Proposed fix and safety gate
The smallest candidate at the observed gap is to make the logged-child launch explicitly request hidden Windows console behavior while preserving file stdio and optional IPC. This is a proposal derived from the trusted helper, not an applied patch. First establish an OS-level regression on Windows that launches from a console-free parent and verifies the resulting process/window state. Exercise daemon startup, supervised restart, and the independent top-level WMI/logon path with Windows Terminal as default.
Evaluate any WMI process-creation change in a separate real Windows experiment; the reported flag-acceptance results were not verified here. Preserve child lifetime after the launcher exits, logging, IPC, daemon readiness, and normal stop behavior. Do not assume that a passing Linux option diagnostic proves any of these Windows lifecycle outcomes.
No automated fix or PR: the autopilot requires a REPRODUCED bug on trusted main plus a focused regression that fails before and passes after a production fix. This investigation only supports PARTIALLY REPRODUCED. No production file, test file, branch, or public protocol was changed.
7. Verification
The same agent repeated the diagnostic in a second clean worktree; this was not independent verification. The second checkout had no node_modules and no instrumentation added to tracked source. Node's built-in type stripping loaded the helper directly, so dependencies were unnecessary for this second launch-boundary check.
git worktree add --detach ../base-second e0f6fda5a02332bd4eb44183542a57f34f3263d7 git -C ../base-second status --short node --experimental-strip-types ../launch-probe.mjs ../base-second result=$? printf 'diagnostic_exit=%s\n' "$result"
git status --short was empty. The second run's stdout was byte-for-byte identical to the first output above, with the same diagnostic exit 1, four successful real children, captured streams, and working IPC. Each run used newly created scratch storage. No ports were used. Both trusted checkouts passed git diff --check and remained unchanged.
Correction/limit retained after verification: these results establish only missing launch suppression, not visible Windows console creation. The final verdict remains partial; no Windows flag or workaround was upgraded to a verified finding.
| Relevant check in first trusted checkout | Result |
|---|---|
pnpm install --frozen-lockfile --prefer-offline | Passed. Existing pre-build executable-link warnings were emitted; the later build completed. |
pnpm exec turbo run build | Passed: 67 tasks successful. An existing desktop CommonJS/import.meta warning was emitted. |
pnpm exec turbo run test --filter=bb-app -- test/logged-process.test.ts | Passed: 5 tests, 1 file. |
pnpm exec turbo run test --filter=@bb/server -- test/app/install-machine-windows.test.ts | Passed: 6 tests, 1 file. This is a Linux run of installer tests, not execution of Windows service registration. |
8. Pull requests and related issues
Issue timeline cross-reference metadata and the open-PR search returned no linked open pull request at investigation time. No linked branch or pull-request code was checked out or executed. A small search of nearby Windows daemon issues did not establish a duplicate of the console-visibility claim.
9. Evidence and trust boundary
The exact repeatable diagnostic and its output are embedded above. Raw local evidence and install/build/test output remain outside the public reports repository, in accordance with that repository's artifact policy. No raw transcripts, reproduction directory, runtime data, account information, or local machine path is published.
The issue included suggested changes, external links, and executable examples. They were treated as untrusted claims only: none was executed or fetched. All executed target code came from the recorded trusted main commit, plus the diagnostic authored from that source. No dependency was added. GitHub metadata was used for classification and duplicate/PR checks. The report and its medium-confidence verdict were checked against the second clean run before publication.