[Bug]: Auto balance silently skips machines whose provider instance id differs
What happens
With Auto balance on, a new thread never moves to another machine when the composer's provider instance has a different instance id on the other machines. There is no message explaining why. The thread stays on (or asks for) the primary machine.
Cause
The candidate filter in the composer (xW in _chat-*.js, desktop 0.1.11) keeps an environment only when it has a provider with exactly the same instanceId as the active one:
d.get(e.environmentId)?.some(n => (m === null || n.instanceId === m) && n.driver === h && ...)
Instance ids are free-form and set per machine. In our setup the same Claude account is claudeAgent_dd_empire on the Mac and claudeDdEmpire on the servers (created at different times). Same driver, same account, same display name, but every server is filtered out. With the Mac weight at 0, no candidate remains.
Suggested fix
- When no environment matches the instance id, fall back to the same driver with the same display name (or let the user map instances across machines).
- At minimum, say why a machine is not eligible in the Auto balance warning ("No provider named X on machine Y").
Workaround: add a provider instance with the identical id on every machine.
I tried to reproduce this on the current build and could not.
Commit 74d73ac23f (origin/main). I did not run the full app across two paired machines. Instead I tested the real useDraftEnvironmentRouting hook in the browser test harness (apps/web/src/components/chat/useDraftEnvironmentRouting.browser.test.tsx). Setup: two connected environments (machine-a, machine-b), both with an enabled, installed, authenticated provider of the same driver and display name, with instance id 'codex' on machine-a and 'codexTeam' on machine-b. The active composer instance is 'codex' and machine-a has weight 0 (Manual only). Clicking Send runs refreshBeforeSend. Result: the draft stays on machine-a, because the candidate list is empty and machine-b is filtered out by provider.instanceId === activeProviderInstanceId (lines 130-131). The new test fails with 'Matcher did not succeed in time' while waiting for machine-b; the other 11 tests in the file pass. Command: vp test run src/components/chat/useDraftEnvironmentRouting.browser.test.tsx in apps/web.
Closing as not planned. If it still happens for you, reply with the exact steps and the version you are on and it will be looked at again.