Repository navigation
Stop running every agent CLI from background version checks - #99
Open
jparker2006 wants to merge 2 commits into
Open
jparker2006 wants to merge 2 commits into
jparker2006 wants to merge 2 commits into
Conversation
The Claude version sync now runs only claude --version, and only once a VM connection is saved. Prewarms, sidebar preloads, and view wakes reuse the versions the last user action read instead of running the CLIs. Refs davidondrej#96
With davidondrej#97 a null lookup means no usable Codex; a bare "codex" could still reach one inside Codex.app through the OS PATH lookup. Sign-in now fails with the not-installed error, and the expiry check counts it as signed in. Refs davidondrej#96
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem.
startClaudeVersionSync(started fromroutes.tsfor every user) calledmacHarnessVersions()30 s after every launch and every 5 minutes. That runs--versionon codex, claude, opencode, fx, and openclaw, before sign-in, forever, though the sync only uses Claude's version and can only do anything for an account on a shared VM. When no standalone Codex CLI exists,findCliExecutable("codex")falls back to the binary inside/Applications/Codex.apporChatGPT.app, so this could make macOS trash a flagged Codex.app again within 5 minutes of the user restoring it. The same fullmacHarnessVersions()was also reached from automatic sandbox paths: spare prewarms, sidebar preloads, thread-view wakes, and OpenCode's login check.Repro. New
test/services/cloudroom-harness-versions.test.tsputs fakecodex,claude,opencode,fx, andopenclawon a tempPATH(plusCODEX_HOME). Each one touches a marker file when it runs. Onorigin/mainthe 4 background tests fail, and every one of them shows codex ran:A 5th test stubs
findCliExecutable("codex")to null, the way #97 makes it behave, with a fakecodexon PATH. Without the codex change,codex loginfalls back to the bare name and runs the fake.Fix.
startClaudeVersionSyncresolvesvm()first. That isteleportClient(), which only stats and reads the savedcloudroom.jsonand throws unless a VM connection is saved. Then it runs onlyclaude --version(versionOf(claudeBinary())). If you're signed out or sandbox-only, each tick is now one file stat and spawns nothing.routes.tsis unchanged: the per-tick check also covers an account that signs in later.lastMacHarnessVersions()returns what the last user-action read found ({}if nothing) and never spawns anything. Automatic sandbox paths use it.versionOfis exported, so a caller can run just the one binary it needs.startMacCodexLogin(codex login) andmacCodexLoginExpired(codex app-server) usedfindCliExecutable("codex") ?? "codex". With Never run the Codex inside Codex.app or ChatGPT.app #97, a null lookup means the only Codex is inside Codex.app or ChatGPT.app (including through a PATH symlink), so the bare"codex"would let the OS PATH lookup run that same binary. Now a null lookup means not installed: sign-in returns a finished run with the existing "Codex is not installed…" error and spawns nothing, and the expiry check returnsfalse(signed in), which is what it already did when the spawn failed. Both run only after a click: Connect / Sign in →POST /account/codex/loginorPOST /mac/codex-login. The polledGET /account/codexstatus never reachesmacCodexLoginExpired; it runs only whenaction === "login".Audit of
macHarnessVersions()callers (sandboxes.ts):macOpencodeLogin(~180)start()→syncLogins), every warm/preload (beforeWake), the onboarding agent step (GET /mac/agents). Also on Connect.opencode --version, never codex/claude/fx/openclawSandboxDirectory.connectionwake (~676), no triggerthread_typingthread_viewuseCloudThreadWakefires 500 ms after any cloud thread is shown, including on launch with a restored route and on every window refocus. Opening the terminal uses it too.lastMacHarnessVersions()preloadOne(~763)lastMacHarnessVersions()warm(~837)app_launch(start()),app_activity(10 s account poll while visible),composer(onboarding project pick)lastMacHarnessVersions()Tests.
cd gui/apps/server && npx vitest run --config vitest.config.ts test/services/cloudroom-harness-versions.test.ts: 5 passed. Before the fix, all 5 fail (output above).npx vitest run --config vitest.config.ts test/services/cloudroom-{harness-versions,sandboxes,account,onboarding,pi,claude-token}.test.ts test/services/cloudroom.test.ts: 7 files, 52 tests passed.npx tsc --noEmit(server): clean.npx vitest run --config vitest.config.ts --maxWorkers=2): 2725 passed, 22 failed in 13 files. The same 22 fail onorigin/mainin this sandbox (identical failure set), mostly because the plugin SDKdistisn't built (@get-bb/plugin-sdk/... dist is not built), plus marketplace and plugin fixtures. None of them touch cloudroom code.What users may notice. Prewarmed spares, sidebar-preloaded sandboxes, and passive view wakes now send the Mac's harness versions only after a user action in the same app session has read them. Until then they send
{}, the same thing a Mac with no CLIs sends. The wake that sends work still reads and sends real versions, so a thread started fresh still matches the Mac. Two cases can lag: an existing thread woken only by viewing it, and a brand-new thread landing on a spare. Both may keep the cloud's current version until a later work wake.Not covered here (reported, not edited; outside this PR's files): other background agent-CLI runs I found during the audit.
refreshMacMcp→macMcpServers()runscodex mcp list --jsononce a minute from the 1.5 sCloudroomServicetimer (uploadMacConfig). That happens when you're signed in with sandboxes and the account has cloud MCP servers. Same Codex.app risk as cloudroom identifies Codex as Malware #96, unlessfindCliExecutablestops resolving into app bundles.downloadCloudLogins→macClaudeSignedIn()runsclaude auth status --jsonfromsyncLoginsat launch.macOpencodeLoginstill runsopencode --version, and for OpenCode 2opencode auth export, from the automatic paths above. No.appbundle is involved, but it is still a background run.macOS-only behavior (the
Codex.appfallback path, Gatekeeper) is not exercised here: the tests run on Linux with fakes onPATH.Refs #96