The best way to control Claude Code, Codex and more from any computer or phone
fix(mobile): hide threads from switched-off environments (#16886)
Charlie J committed
Oct 7, 2026 at 18:06 UTC
8d564a3e5c77d283994119eca82881f8c37a4a4d
2 files changed
+25
-1
packages/client-runtime/src/state/threadShell.test.ts
+24
@@ -103,6 +103,30 @@ describe("v2 thread shell lists", () => {
103
registry.dispose();
104
});
105
106
+ it("leaves switched-off environments out of navigation", () => {
107
+ const { registry, threads, catalogValueAtom } = makeHarness([
108
+ environmentId,
109
+ remoteEnvironmentId,
110
+ ]);
111
+ const dispose = registry.mount(threads.navigationThreadShellsAtom);
112
+ const environmentsOf = () =>
113
+ new Set(registry.get(threads.navigationThreadShellsAtom).map((t) => t.environmentId));
114
+ expect(environmentsOf()).toEqual(new Set([environmentId, remoteEnvironmentId]));
115
+
116
+ const setRemoteEnabled = (enabled: boolean) => {
117
+ const catalog = registry.get(catalogValueAtom);
118
+ const entries = new Map(catalog.entries);
119
+ entries.set(remoteEnvironmentId, { ...entries.get(remoteEnvironmentId)!, enabled });
120
+ registry.set(catalogValueAtom, { ...catalog, entries });
121
+ };
122
+ setRemoteEnabled(false);
123
+ expect(environmentsOf()).toEqual(new Set([environmentId]));
124
+ setRemoteEnabled(true);
125
+ expect(environmentsOf()).toEqual(new Set([environmentId, remoteEnvironmentId]));
126
+ dispose();
127
+ registry.dispose();
128
+ });
129
+
130
it("shares point and list values without retaining an atom for every listed thread", () => {
131
const harness = makeHarness();
132
const snapshot = {
packages/client-runtime/src/state/threadShell.ts
+1
-1
@@ -202,7 +202,7 @@ export function createEnvironmentThreadShellAtoms(input: {
202
let previousNavigationShells: ReadonlyArray<EnvironmentThreadShell> = [];
203
const navigationThreadShellsAtom = Atom.make((get) => {
204
const next: EnvironmentThreadShell[] = [];
205
- for (const environmentId of get(input.catalogValueAtom).entries.keys()) {
205
+ for (const environmentId of enabledEnvironmentIds(get(input.catalogValueAtom))) {
206
for (const thread of get(environmentThreadsAtom(environmentId))) {
207
if (thread.archivedAt !== null || thread.lineage.relationshipToParent === "subagent")
208
continue;