Skip to content

fix(threads): offer linked workers for a project's new thread - #295

Merged
nixuuu merged 1 commit into
devfrom
fix/new-thread-linked-workers
Nov 6, 2026
Merged

nixuuu merged 1 commit into
devfrom
fix/new-thread-linked-workers

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 6, 2026

Copy link
Copy Markdown
Member

Root cause

A shared project (#168) is one overview row with every linked computer's workspaces. The routed overview merged them only in GetOverview and in updates from the partner. When this computer republished its own row of a shared project, the overview stream sent it with local workspaces only. Triggers include coreBroadcastWorkers on any worker change, renames, projectsChanged after a config sync and origin refreshes. Web and mobile upsert by id, so the merged row lost the partner's workspaces. A project that lives only on a linked computer then had workspaces: [], and the new-thread picker showed "No worker" and "… is not on any worker yet".

I reproduced it with two linked gateways. A's WatchOverview emitted the shared project with workspaces: [] right after A republished it.

Fix

  • apps/gateway/src/api/routed-overview.ts: every update of a shared project goes out with all computers' workspaces, whether it came from this computer or a partner. A burst (for example, a worker change republishing every project) reads the overview once, 50 ms coalescing. If that read fails, the local row still goes out. Mobile is fixed by the same change.
  • WorkerPicker.svelte:
    • linked workers stay listed until the gateway capabilities load (before, they were briefly hidden);
    • workers on an unreachable computer are greyed out and disabled, with the presence reason, as on mobile;
    • the empty state says "'s workers are not connected." when the project has workspaces. "not on any worker yet" now appears only when it is true.
  • docs/linked-computers.md: notes the merged stream updates.

Verification

  • New tests/integration/linked-new-thread.test.ts (two linked gateways, separate databases):
    • A's overview stream keeps B's workspace after A republishes the shared project. This test fails without the fix.
    • B's worker is in A's overview and online.
    • A thread created from A on B's worker lives on B, in B's project.
  • Passed, each file run on its own: linked-projects, config-sync-projects, worktrees, worktree-automation and the db schema test.
  • Clean: bun install, gen:check, typecheck, lint, format:check and the web build.
  • check:tmp: 1517 pass, 3 fail. All 3 failures are in files dev (feat(worktrees): list worktrees git already has #294) changed while the run was in progress; all 3 pass when rerun on the rebased branch.
  • Browser, against three linked test gateways and a vite dev BFF:
    • wrk-ai only on "Mac-Studio-of-the-team": the picker shows that worker and the composer is ready (light, desktop);
    • pinpoint on two computers: grouped "This computer" / "Mac-Studio-of-the-team";
    • an offline "Mac mini": its worker is greyed out and disabled with "Offline since …" (dark, iPhone 12 Pro width).

Not in scope

New worktrees on a linked computer's checkout stay refused on purpose (docs/worktrees.md, "Połączone komputery", stage 1). Supporting them needs gateway capability negotiation and is a separate feature.

Copy audit (docs/copy.md §8)

  • New: "{project}'s workers are not connected." It is short and factual, and it replaces a false claim. No other text changed.

Fixes: #168

A shared project is one row in the overview with every linked computer's
workspaces. Only the initial read and the partner's updates were merged:
when this computer republished its own row (a worker change, a rename, a
config sync), the overview stream sent it with local workspaces only. The
client replaced the merged row, so a project that lives only on a linked
computer showed "No worker" in the new-thread picker.

The routed overview stream now sends every update of a shared project
with all computers' workspaces, reading the overview once per burst and
falling back to the local row if that fails. The web picker keeps linked
workers listed until the gateway capabilities load, greys out workers on
an unreachable computer, and says the project's workers are not connected
instead of "not on any worker yet" when the project has workspaces.

Fixes: #168
@nixuuu
nixuuu merged commit 1533650 into dev Nov 6, 2026
9 checks passed
@nixuuu
nixuuu deleted the fix/new-thread-linked-workers branch November 6, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant