🚨 SLOP COP 🚨 · new-issue-autopilot
#6312 · Desktop broker discovery across filesystem boundaries
Trusted base: 3540a699e29034b53da32bb7efa6f5b4055209eb.
Verdict: PARTIALLY REPRODUCED · Root-cause confidence: high for the filesystem-discovery mechanism.
1. TL;DR
The desktop broker client cannot register a window when its local filesystem has no broker descriptor, even when the host daemon's broker is reachable. A real daemon broker and the production desktop client reproduce this with separate temporary directories on Linux. Copying the private descriptor into a searched desktop directory makes the existing client register on its next retry, without restarting it. The reported native Windows/WSL2 arrangement, mirrored networking, Electron UI, CDP, and page screenshots were not available here, so the complete platform report is only partially reproduced. Main also searches other local machine directories, not just the two initial locations described by the reporter; all those candidates still require a desktop-local descriptor.
2. Claims vs findings
| Claim | Status | Evidence |
|---|---|---|
| A descriptor present only in the daemon's filesystem does not let the desktop register. | Verified in an isolated Linux analogue | Two clean checkouts: authenticated loopback connection succeeds, but the production instance-list operation returns {"instances":[]}. |
| The daemon writes the private descriptor into its data directory. | Verified | Production broker creation and source lines 250–268; the probe copies that generated file, not a fabricated descriptor. |
| Only two filesystem locations are searched. | Refuted on this main commit | After the initial locations, the client enumerates local .bb-machines directories and validates candidates with server proof. This does not discover a descriptor absent from every local candidate. |
| Copying the descriptor recovers registration without restarting the desktop. | Verified for the production client | Both control runs observe one registered synthetic window after copying the file and allowing the existing retry timer to run. |
| Windows/WSL2 mirrored networking and the desktop CDP endpoint are working. | Unverified | No native Windows/WSL2 or Electron session was used. Linux loopback reachability alone does not verify these platform claims. |
| Browser automation can navigate and capture after copying. | Unverified | The probe stops at the broker registration boundary; no page or automation backend is driven. |
3. Environment
- Public repository
get-bb/bb, trustedorigin/mainat the full base SHA above; a final fetch returned the same SHA. - Linux x86_64, gVisor kernel
4.19.0-gvisor; Nodev22.19.0; pnpm9.15.0. - Two separate clean clones at that exact commit, named
baseandverifyunder a disposable investigation directory. Dependency installs and generated build outputs are separate. - Each probe allocates a fresh temporary root with separate
daemon-dataanddesktop-homesubdirectories. The production broker binds a fresh OS-assigned loopback port. No fixed server port, real user data, provider, browser profile, or production runtime is used. - The desktop registry collaborator supplies one synthetic window. The daemon broker, descriptor creation, descriptor reader, client retry, authentication, WebSocket transport, registration handling, and instance-list request are production code.
- The selected HTTPS origin is an inert test origin; the injected proof callback is never called in the no-descriptor case. This is not a test of an authenticated live HTTP server.
4. Minimal reproduction
- Create a clean clone and install/build trusted main at the pinned commit:
git clone https://github.com/get-bb/bb.git bb-6312 cd bb-6312 git checkout --detach 3540a699e29034b53da32bb7efa6f5b4055209eb pnpm install --frozen-lockfile --prefer-offline pnpm exec turbo run build
The first cold build in each checkout hit an existing SDK/plugin build-order error: the GitHub plugin could not yet resolve the SDK's built host entry. Retrying the same Turbo build after the SDK completed passed in both checkouts:71 successful, 71 total. No repository fix or dependency change was made. - Save the complete script below as
apps/desktop/test/issue-6312-repro.mjs. Run the expected-behavior assertion:node --conditions=source --import tsx apps/desktop/test/issue-6312-repro.mjs --expect-registration
Expected for cross-filesystem discovery: the synthetic desktop window registers without a copied file. Actual on unchanged production code: exit1, with the following relevant output:Authenticated loopback WebSocket reachable: true Separated filesystem result: {"instances":[]} Proof requests without a desktop-local descriptor: 0 AssertionError [ERR_ASSERTION]: A reachable daemon in a separate filesystem should register the desktop windowThe assertion failure is the intended regression signal, not an install or import failure. - Run the diagnostic/control mode:
node --conditions=source --import tsx apps/desktop/test/issue-6312-repro.mjs
Actual exit0in both checkouts:Authenticated loopback WebSocket reachable: true Separated filesystem result: {"instances":[]} Proof requests without a desktop-local descriptor: 0 After private descriptor copy, without client restart: {"instances":[{"instanceId":"instance_repro","generation":"generation_repro","label":"Isolated probe window"}]} PASS: isolated discovery failure and copy recovery reproducedThis mode first confirms the failure, copies only the synthetic private descriptor, then confirms recovery. It never prints or publishes the generated credential and removes its temporary data infinally.
Complete reproduction script
The test is embedded here so reproduction does not depend on a separately published executable artifact. It extends coverage beyond existing tests by exercising an actually reachable production daemon with no desktop-local descriptor; it adds no production export or hook.
import assert from "node:assert/strict";
import { once } from "node:events";
import { chmod, copyFile, mkdir, mkdtemp, rm } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { setTimeout as delay } from "node:timers/promises";
import { WebSocket } from "ws";
import { startDesktopBrowserBroker } from "../../host-daemon/src/desktop-browser-broker.ts";
import { createDesktopBrowserBrokerClient } from "../src/desktop-browser-broker-client.ts";
const root = await mkdtemp(join(tmpdir(), "bb-6312-probe-"));
const serverUrl = "https://desktop-repro.invalid";
const desktopHome = join(root, "desktop-home");
const daemonData = join(root, "daemon-data");
const instance = {
instanceId: "instance_repro",
generation: "generation_repro",
label: "Isolated probe window",
};
let hostId = null;
let proofRequests = 0;
let client;
let directSocket;
const daemon = await startDesktopBrowserBroker({
dataDir: daemonData,
hostId: "host_repro",
serverUrl,
onChanged: () => undefined,
});
daemon.setConnected(true);
try {
directSocket = new WebSocket(daemon.descriptor.url, {
headers: { authorization: `Bearer ${daemon.descriptor.token}` },
});
await once(directSocket, "open");
console.log("Authenticated loopback WebSocket reachable: true");
const closed = once(directSocket, "close");
directSocket.close();
await closed;
client = createDesktopBrowserBrokerClient({
dataDir: join(desktopHome, ".bb"),
homeDir: desktopHome,
getServerUrl: () => serverUrl,
broker: {
setHostId: (value) => { hostId = value; },
setServerOrigin: () => undefined,
listInstances: () => [instance],
subscribeInstances: () => () => undefined,
subscribe: () => () => undefined,
},
fetchImpl: async (_input, init) => {
proofRequests += 1;
const request = JSON.parse(init.body);
return Response.json(daemon.prove(request.challenge));
},
});
await delay(2500);
const absent = await daemon.request({ type: "desktop.browser.list_instances" });
console.log("Separated filesystem result:", JSON.stringify(absent));
console.log("Proof requests without a desktop-local descriptor:", proofRequests);
assert.deepEqual(absent, { instances: [] });
assert.equal(hostId, null);
assert.equal(proofRequests, 0);
if (process.argv.includes("--expect-registration")) {
assert.deepEqual(absent, { instances: [instance] },
"A reachable daemon in a separate filesystem should register the desktop window");
}
const localDirectory = join(desktopHome, ".bb-machines", "desktop-repro.invalid");
await mkdir(localDirectory, { recursive: true, mode: 0o700 });
const descriptorName = "desktop-browser-broker.json";
const localDescriptor = join(localDirectory, descriptorName);
await copyFile(join(daemonData, descriptorName), localDescriptor);
await chmod(localDescriptor, 0o600);
const deadline = Date.now() + 7000;
let recovered;
do {
recovered = await daemon.request({ type: "desktop.browser.list_instances" });
if (recovered.instances.length === 1) break;
await delay(25);
} while (Date.now() < deadline);
assert.deepEqual(recovered, { instances: [instance] });
assert.equal(hostId, "host_repro");
console.log("After private descriptor copy, without client restart:", JSON.stringify(recovered));
console.log("PASS: isolated discovery failure and copy recovery reproduced");
} finally {
client?.stop();
directSocket?.terminate();
await daemon.close();
await rm(root, { recursive: true, force: true });
}
5. Root cause
The broker descriptor is a local capability bootstrap: it contains the loopback endpoint and its authentication key. The daemon writes it privately under its own data directory. The desktop main process supplies its own data directory and its own operating-system home directory to the client. When those filesystem namespaces differ, a network connection to the server does not supply that local capability.
- Daemon: loopback endpoint and private descriptor.
const descriptorPath = join( options.dataDir, DESKTOP_BROWSER_BROKER_DESCRIPTOR_FILE, ); await writeFile(temporaryPath, JSON.stringify(descriptor), { mode: 0o600, flag: "wx", }); await rename(temporaryPath, descriptorPath); - Main process: desktop-local directories and selected origin.
- Client discovery and proof: every candidate must first pass
readBrokerDescriptor(dataDir). The HTTP challenge is generated only after that read. With no candidate file, no proof request occurs and no WebSocket is opened.const descriptor = await readBrokerDescriptor(dataDir); signal.throwIfAborted(); const challenge = randomBytes(32).toString("hex"); - Client connection and retry: registration starts only after discovery succeeds; retries cannot manufacture a missing credential.
- Daemon instance list flattens registered peers. No desktop registration therefore means an empty list.
- Server proof operation routes a challenge to a known host, rather than returning a descriptor or its secret.
The deeper issue is a mismatch between the local-capability discovery design and a desktop/daemon pair sharing networking but not filesystem storage. The existing alias-proof path validates locally available capabilities; it is not remote descriptor discovery. The isolated results establish that mechanism, not the availability or behavior of native Windows filesystem integration.
6. Proposed fix and safety gate
First choose a supported cross-OS discovery design and its trust model. An authenticated network bootstrap would need explicit capability scoping, endpoint identity, credential handling, and daemon compatibility review. Filesystem-based WSL discovery would instead need a supported distro/user/data-directory mapping and Windows/WSL ownership and permission validation. Do not simply expose or broadly copy the bearer credential.
Next experiment: repeat the inline probe with a native Windows desktop, a WSL-hosted daemon, and a reviewed descriptor-discovery mechanism; then verify native tab listing, automation navigation/capture, restart credential rotation, and rejection of untrusted descriptors. The Linux reproduction cannot validate those security and platform properties.
No automatic fix PR: the report is PARTIALLY REPRODUCED, not a complete native reproduction eligible for this rule's simple-fix path. Selecting a cross-OS discovery or credential-bootstrap design also requires an architecture/security decision, explicitly outside the simple-fix allowance. No production edit, fix branch, or application push was made. There is no before/after fixed test result to claim.
7. Related issues and pull requests
No linked open pull request was identified from the issue's closing references or cross-reference timeline. A repository PR search produced an unrelated result whose closing-issue list was empty; it was not checked out or executed. No duplicate was established. This report is narrowly about descriptor discovery, not general native-platform support.
8. Verification
The same agent repeated the reproduction in a second clean checkout at the exact recorded base. This is a second clean run, not independent verification. The second checkout had its own dependency installation and generated build outputs, and was clean before copying in the authored probe. Each invocation used a fresh temporary root and newly assigned broker port.
| Check | First checkout | Second clean checkout |
|---|---|---|
| Trusted production SHA | 3540a699e29034b53da32bb7efa6f5b4055209eb | |
pnpm install --frozen-lockfile --prefer-offline | Passed | Passed |
pnpm exec turbo run build | Passed on retry: 71 tasks | Passed on retry: 71 tasks |
Probe with --expect-registration | Expected assertion failure, exit 1 | Same expected assertion failure, exit 1 |
| Probe default mode: missing file then copy recovery | Passed, exit 0 | Passed, exit 0 |
| Existing desktop client/descriptor suites | 2 files / 10 tests passed | Not redundantly rerun |
No report correction was required after the second run. The wording remains limited to isolated Linux discovery; native Windows/WSL and browser rendering are unverified. The existing suites cover candidate proof validity, challenge replay, timeout cancellation, same-origin registration, and descriptor trust, but do not cover the no-local-descriptor/separate-filesystem case.
9. Appendix
Relevant existing verification command
pnpm exec turbo run test --filter=@bb/desktop -- test/desktop-browser-broker-client.test.ts test/desktop-browser-broker-descriptor.test.ts Test Files 2 passed (2) Tests 10 passed (10)
Build caveat
The first cold full builds both failed because the GitHub plugin tried to bundle @get-bb/plugin-sdk/host before its distribution entry existed. The SDK completed during that run. The identical second build succeeded; no code or install changes were needed. The successful builds also emitted existing import.meta bundling warnings. These are not reproduction failures and were not changed.
Evidence hygiene and cleanup
The inline output omits assertion stack paths and reproduces the actual observable values. No descriptor contents, generated credential values, real host identity, user runtime, home paths, or private machine information are published. Raw command logs and the authored probe are retained only in the disposable investigation workspace/local backup, not as public repository artifacts. Each probe closes its socket and daemon and removes its generated filesystem tree in finally. No full development app or production process was started.
Trust boundary
Issue content was used only as claims to test. No issue-supplied command, patch, script, linked executable, branch, or external URL was run or fetched. The reproduction was authored from the trusted repository implementation, with no added dependency. Metadata and source permalinks were checked at the recorded base.
> AGENT GENERATED