Skip to content

chore(link): remove the desktop link feature - #5570

Merged
pedrofrxncx merged 2 commits into
mainfrom
chore/remove-desktop-link
Aug 2, 2026
Merged

pedrofrxncx merged 2 commits into
mainfrom
chore/remove-desktop-link

Conversation

@pedrofrxncx

@pedrofrxncx pedrofrxncx commented Aug 2, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Removes the desktop link end to end — 150 files, −26,162 lines. Local CLI runs now happen entirely inside the Tauri desktop app (apps/native, which owns its own Rust local-api and never touches this path), so the link daemon, its tunnel transport, and the cluster-side dispatch route that fed it are all dead weight.

Its own PR so it can be reverted independently of the Go-daemon teardown (#5569).

Deleted: apps/api/src/link-daemon/ (42 files), apps/api/src/links/ (17), apps/api/src/tools/links/, api/routes/links/, the deco link CLI + its store/registry/TUI, auth/dev-link-session.ts, packages/sandbox/server/{daemon-spawn,daemon-asset}.ts, packages/sandbox/server/provider/desktop/, the link resilience scenarios + compose service, and 7 e2e specs.

Rewritten: app.ts, dispatch-run.ts, thread-gate-workflow.ts, routes.ts, background-tool-workflow.ts, resolve-provider.ts, lifecycle.ts, cli.ts, dev.ts.

Four judgment calls to check

1. user-desktop survives as a readable legacy value. It's persisted in virtual_mcps.metadata.sandboxMap (migration 092 normalized desktop/remote-user into it), so resolveProvider maps it to the hosted provider instead of throwing. Old rows keep parsing and stay deletable; nothing new is ever written with it. No migration, no destructive write — that was the explicit call over dropping the rows.

2. CLI harnesses lose their only host — but cluster behavior is unchanged. resolveHarnessExecutionSite used to route (claude-code|codex, user-desktop) to the desktop daemon and already threw not implemented for every agent-sandbox target (cloud-CLI was never wired). With the desktop branch gone it collapses to assertHarnessRunsInCluster, which throws for the same CLI harnesses and lets decopilot through. Anything that worked on agent-sandbox before still works identically.

3. deco dev is kept, not deleted. Link was an opt-in flag there (--local-sandbox-provider), not a dependency — deleting the file would have taken the local dev loop with it. Only the auto-spawn/toxiproxy/session wiring is gone.

4. useCurrentLink is kept, and is now explicitly native-only. It looks like link code but isn't: the Tauri app intercepts POST /api/:org/tools/LINK_CURRENT_GET in Rust (crates/local-api/src/routes/intercept/link_current.rs) to report locally-detected CLI harnesses. Deleting it would have broken the desktop agent picker. It now calls the route directly (the tool is deliberately gone from StudioToolIO — the contract is owned by the Rust interceptor, not the registry) and short-circuits to offline on web. Same reasoning kept link-bearer-auth.ts: desktop-session-bridge.ts is the native app's system-browser auth and only borrows resolveLinkBearer.

Test coverage this removes — please weigh in

7 e2e specs are deleted. Four (link-control, link-dispatch-pull, link-ingest, link-tunnel) are pure link. The other six are the problem: harness-conformance, chat-locked-thread, decopilot-thread-queue, decopilot-unified-control-plane, decopilot-messages, decopilot-fence-queueing are all structurally built on the desktop path — they pin threads to sandbox_provider_kind = 'user-desktop' and spin a fake tunnel daemon — but several also covered hosted dispatch-queue, fence, and control-plane behavior incidentally.

I deleted rather than re-pointed them: re-pinning to agent-sandbox is not mechanical (the CLI-pinned ones can't be, per #2 above), and I can't run Playwright here to verify a rewrite. Hosted-path equivalents are follow-up work — the changed logic is still covered by unit tests, but not end to end.

Testing

  • bun test: 2868 pass, 39 fail — and all 39 fail identically on main (DB-dependent integration tests with no local Postgres). Diffed baseline-vs-branch to confirm zero new failures. One test genuinely broke and is fixed: the DBOS workflow source guard, re-baselined via apps/api/scripts/update-workflow-source-snapshot.ts after editing thread-gate-workflow.
  • Inverted rather than appended, per the checklist: 4 resolve-provider cases now assert the hosted fallback, SANDBOX_DELETE's desktop case asserts legacy teardown through hosted, and resolveHarnessExecutionSite's table became assertHarnessRunsInCluster's.
  • bun run check clean in all 5 workspaces (apps/web's ~20 react-resizable-panels errors are pre-existing dependency drift). bun run lint 0 errors.
  • knip clean. It caught the orphan tail and all of it is gone: stopLink/superviseLink + the link service block (~11k chars), cli/lib/port-wait.ts and cli/open-url.ts (link-TUI-only; ensure-services has its own private waitForPort), the @decocms/tunnel dep, 5 now-unused e2e deps, and 3 orphaned e2e fixtures. Narrowed buildHarnessWorkspaceInput and resolveEffectiveVirtualMcpForHarness to module-private. Only pre-existing vite remains.
  • Kept plugins/ban-e2e-app-imports.js's allowlist in sync with packages/e2e/package.json, per CLAUDE.md's both-places rule.

Not verified

The web UI changes compile but I could not exercise them in a browser — use-current-link's native gating in particular changes what the desktop agent picker and the chat empty states render. Worth a manual pass in the Tauri app before merge.

Conflicts

Overlaps #5569 on packages/shared/src/tools/tool-io.ts (both regenerate it) and registry-metadata.ts. Whichever lands second needs a regenerate.


Summary by cubic

Removed the desktop link feature end-to-end and routed all execution to the hosted cluster. The Tauri app (apps/native) continues to handle local runs via its Rust local-api, so no cluster link or tunnel is needed.

  • Refactors

    • Deleted link daemon, tunnel transport, link API routes, and deco link CLI; removed @decocms/tunnel.
    • Collapsed dispatch/workflows to hosted: resolveHarnessExecutionSite → assertHarnessRunsInCluster; removed the thread gate timeout and desktop-only background subtask delivery; inlined { cwd: null } in dispatch-run.
    • Normalized provider kind: legacy user-desktop now resolves to hosted kind + provider; removed linkStatusProbe and tunnel dispatch wiring.
    • CLI/dev cleanup: removed --local-sandbox-provider and --hot flags from parser/help/completions; dev store no longer tracks ToxiProxy/Sandbox; deleted scripts/smoke-link.ts, dev ToxiProxy helpers, and port-wait utilities.
    • Kept useCurrentLink as native-only; it calls the Rust interceptor for LINK_CURRENT_GET and short-circuits to offline on web.
    • Tests/CI: removed desktop-path e2e specs; updated DBOS workflow snapshot; inverted the ban-e2e allowlist; knip cleanup drops the orphan vite devDependency.
  • Migration

    • No DB migration. Legacy user-desktop values remain readable and now map to hosted (kind normalized); no new writes.
    • Breaking changes: deco link and link-related dev flags are removed. Verify desktop agent picker/empty states in the Tauri app before merge.

Written for commit 1c66406. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 150 files

You’re at about 99% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact [email protected].

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread apps/api/src/cli.ts Resolved
Comment thread apps/api/src/cli/commands/dev.ts Resolved
CI:
- knip: drop the `vite` devDependency orphaned with the link daemon
- unit: realign the ban-e2e-app-imports test with the narrowed allowlist,
  and invert it — the dropped packages must now be rejected

Review (cubic):
- P1 resolve-provider: normalize the resolved KIND alongside the provider.
  `user-desktop` bound the hosted provider but still reported itself, so a
  caller persisting that kind recorded a sandboxMap row with no runner.
  Inverted the two tests that asserted the mismatch.
- P2 remove the desktop-only background subtask delivery path:
  THREAD_SUBTASK_DELIVER, deliverBackgroundSubtaskResult, and the orphaned
  createDesktopSubtaskDispatcher (its only caller was the deleted daemon).
- P3 remove the dead `--local-sandbox-provider` / `--hot` CLI flags from the
  parser, help, shell completion and every dev script, so they error instead
  of silently doing nothing; setDevMode's link-only services go with them.
- P3 inline `{ cwd: null }` in dispatch-run — buildHarnessWorkspaceInput's
  repo branch was unreachable once hosted runs stopped mounting /repo.
- P3 drop the timeout contract from the thread gate; nothing set timeoutMs
  or runTimeoutMs and no abort signal was ever constructed.

Also deletes smoke-link.ts, which probed the removed /api/links/me route.
@pedrofrxncx
pedrofrxncx merged commit 6fcec06 into main Aug 2, 2026
26 checks passed
@pedrofrxncx
pedrofrxncx deleted the chore/remove-desktop-link branch August 2, 2026 22:29
decocms Bot pushed a commit that referenced this pull request Aug 2, 2026
PR: #5570 chore(link): remove the desktop link feature
Bump type: patch

- decocms (apps/api/package.json): 4.160.1 -> 4.160.2
- @decocms/native (apps/native/package.json): 4.160.1 -> 4.160.2
- @decocms/e2e (packages/e2e/package.json): 1.27.1 -> 1.27.2
- @decocms/harness (packages/harness/package.json): 2.8.2 -> 2.8.3
- @decocms/sandbox (packages/sandbox/package.json): 1.35.2 -> 1.35.3
- @decocms/shared (packages/shared/package.json): 0.13.1 -> 0.13.2
- deploy/helm/sandbox-env (chart 0.10.2) (deploy/helm/sandbox-env/values.yaml deploy/helm/sandbox-env/Chart.yaml): image.tag/appVersion -> 1.35.3

Deploy-Scope: both
viktormarinho added a commit that referenced this pull request Aug 3, 2026
…harnesses

`assertHarnessRunsInCluster` throws for claude-code/codex at the dispatch
gate, and `dispatchRunAndWait` throws again on any non-decopilot id — so the
factories the barrel registered could never be reached by a lookup. Local CLI
runs happen in the Tauri app's Rust harness crate; cloud-CLI is unimplemented.

Also removes `buildSandboxDaemon()` from the server bundler: it built
packages/sandbox's daemon bundle + typegen tarball on every API build for
host/runner.ts's text-import, and that file no longer exists (#5570). The
sandbox image workflow runs its own `bun run --cwd=packages/sandbox build`,
so the image is unaffected.
viktormarinho added a commit that referenced this pull request Aug 3, 2026
… on the package (#5573)

* chore(harness): drop the unreachable cluster registration of the CLI harnesses

`assertHarnessRunsInCluster` throws for claude-code/codex at the dispatch
gate, and `dispatchRunAndWait` throws again on any non-decopilot id — so the
factories the barrel registered could never be reached by a lookup. Local CLI
runs happen in the Tauri app's Rust harness crate; cloud-CLI is unimplemented.

Also removes `buildSandboxDaemon()` from the server bundler: it built
packages/sandbox's daemon bundle + typegen tarball on every API build for
host/runner.ts's text-import, and that file no longer exists (#5570). The
sandbox image workflow runs its own `bun run --cwd=packages/sandbox build`,
so the image is unaffected.

* chore(harness): drop the source-text assertions from the registration test

Asserting a file's source does not contain a symbol tests the deletion, not
the behavior. The registry lookup is already covered by the gate's own tests.

* chore(harness): delete the TypeScript CLI harnesses, now that nothing hosts them

#5575 deleted the TS sandbox daemon, which was the last runtime that
registered `claudeCodeHarnessFactory`/`codexHarnessFactory`; the preceding
commit dropped the cluster's unreachable registration. That left the whole TS
CLI harness implementation with zero production consumers — the live one is
Rust (`apps/native/crates/harness`), which is a port, not a consumer.

Deleted: packages/harness/src/{codex,claude-code/index,resolve-executable,
model/index}, cli-session-error, cli-stream-metadata, the ./claude-code and
./codex export subpaths, and the ai-sdk-provider-{claude-code,codex-cli} deps.

Kept: claude-code/model/agent-tiers.ts + chat-tier.ts (apps/web and apps/api
import `resolveAgentTier` to build the model picker), and cli-harness.ts's
`cliProviderName` (the read side of CLI session resume).

Knip could not see any of this: packages/harness's exports map has a "./*"
glob, so every src file looks like a public entrypoint.

- cli-import-boundary.test.ts deleted: it read claude-code/index.ts and
  codex/index.ts off disk, so it fails ENOENT once they are gone.
- cli-harness.test.ts covered only `isCliHarness`, which was dead. Repointed
  to `cliProviderName` — the surviving export, and a cross-language contract
  with the Rust crate that had no test at all.
- cli-message-prep.ts lost `prepCliMessages` (CLI-only) and kept
  `extractUserText` (decopilot). Renamed to extract-user-text.ts so the
  filename stops describing code that is gone.

* docs(harness): correct the README for a package with one harness

The overview still advertised Claude Code and Codex harnesses, a codex usage
example, and "portable between the API and sandbox daemon" as the boundary
rationale — all three are gone. Restates the real one: apps/web and
packages/sandbox are lint-barred from apps/api/src, so the contracts the three
share have to live outside the API.

* chore(harness): enumerate the exports map so knip can see this package

packages/harness's exports ended in "./*": ["./src/*.ts", "./src/*/index.ts"],
so every file under src/ looked like a public entry point and knip could never
report anything here as unused. That is how ~2k lines of dead CLI harness code
stayed invisible until it was grepped by hand.

Replaces the glob with the 56 subpaths actually imported (plus "."), generated
from the real import specifiers across apps/ and packages/ and verified to
resolve. No consumer changes: bun run check passes in all 15 workspaces.

Knip now reports on this package, and immediately found two things the glob was
hiding:
- no-background-tasks-prompt.ts — a system-prompt fragment whose own doc says
  "shared across CLI harnesses (claude-code, codex)"; orphaned when those were
  deleted. Removed.
- THOUGHT_SIGNATURE_SEPARATOR — used only inside its own module. Narrowed to
  module-private.

No guard test: a missing entry is already a compile error (TS2307) on
bun run check. Documented in the README, since that message reads as "file
missing" when the file is merely unexported.
viktormarinho added a commit that referenced this pull request Aug 3, 2026
…arness registry

Final step of the harness-package teardown (#5573 deleted the dead TS CLI
harnesses; #5577 moved the wire contracts to @decocms/shared/harness). After
those, the package was 9.5k lines consumed by apps/api alone — its stated
reason to exist (portability into the desktop daemon's bundle) died with the
link daemon (#5570) and the TS sandbox daemon (#5575).

The move:
- packages/harness/src → apps/api/src/harnesses/lib (git mv, history kept).
  58 api files rewritten from "@decocms/harness/X" to "@/harnesses/lib/X".
  All the lib's deps were already in apps/api's manifest; the workspace
  package, its README, tsconfig and dependency edges are gone.
- The leaf discipline survives as a directory rule: ban-cross-tree-imports
  now applies its harness clauses (no @/ imports, no @/core/studio-context,
  no @aws-sdk/*) to apps/api/src/harnesses/lib/, and no-cross-tree.test.ts
  moved with the tree and still guards it. The engine stays a leaf; only the
  package wrapper is gone.

The registry collapse (spec §5.4, executed at last):
- InProcessSandboxClient absorbs localDispatch and hard-wires
  decopilotHarnessFactory — the registry it consulted was a Map with one
  entry, populated by an import side effect. registry.ts, localDispatch, the
  orphaned lib barrel and their registration tests are deleted; the client's
  tests now assert the real factory's contract (eager CLI guard, lazy stream)
  instead of stubbing a seam.
- apps/api/src/harnesses/index.ts keeps one side effect: registering the
  cluster environment builder the factory requires.

Fallout knip caught once the package boundary stopped hiding it:
- buildRepoEnvironmentPrompt: dead (nothing builds that prompt block). Deleted.
- CHAT_MODES: only its derived type is consumed. Narrowed to module-private.

DBOS workflow-source snapshot re-baselined (import-specifier text is hashed;
apps/api/scripts/update-workflow-source-snapshot.ts, 8 hashes).

Infra: sandbox-daemon.yml change filter, release-changes test fixtures, root
README workspace table, bundle-server-script comment.
viktormarinho added a commit that referenced this pull request Aug 3, 2026
…arness registry (#5578)

Final step of the harness-package teardown (#5573 deleted the dead TS CLI
harnesses; #5577 moved the wire contracts to @decocms/shared/harness). After
those, the package was 9.5k lines consumed by apps/api alone — its stated
reason to exist (portability into the desktop daemon's bundle) died with the
link daemon (#5570) and the TS sandbox daemon (#5575).

The move:
- packages/harness/src → apps/api/src/harnesses/lib (git mv, history kept).
  58 api files rewritten from "@decocms/harness/X" to "@/harnesses/lib/X".
  All the lib's deps were already in apps/api's manifest; the workspace
  package, its README, tsconfig and dependency edges are gone.
- The leaf discipline survives as a directory rule: ban-cross-tree-imports
  now applies its harness clauses (no @/ imports, no @/core/studio-context,
  no @aws-sdk/*) to apps/api/src/harnesses/lib/, and no-cross-tree.test.ts
  moved with the tree and still guards it. The engine stays a leaf; only the
  package wrapper is gone.

The registry collapse (spec §5.4, executed at last):
- InProcessSandboxClient absorbs localDispatch and hard-wires
  decopilotHarnessFactory — the registry it consulted was a Map with one
  entry, populated by an import side effect. registry.ts, localDispatch, the
  orphaned lib barrel and their registration tests are deleted; the client's
  tests now assert the real factory's contract (eager CLI guard, lazy stream)
  instead of stubbing a seam.
- apps/api/src/harnesses/index.ts keeps one side effect: registering the
  cluster environment builder the factory requires.

Fallout knip caught once the package boundary stopped hiding it:
- buildRepoEnvironmentPrompt: dead (nothing builds that prompt block). Deleted.
- CHAT_MODES: only its derived type is consumed. Narrowed to module-private.

DBOS workflow-source snapshot re-baselined (import-specifier text is hashed;
apps/api/scripts/update-workflow-source-snapshot.ts, 8 hashes).

Infra: sandbox-daemon.yml change filter, release-changes test fixtures, root
README workspace table, bundle-server-script comment.
viktormarinho added a commit that referenced this pull request Aug 3, 2026
The desktop link (#5570) was the tunnel's only consumer; the package (3.4k
lines: NATS WebSocket tunnel client/server, subject tokens, backoff plumbing)
has had zero manifest dependents and zero code imports since. It was never
published (no publish workflow).

Remaining mentions were fixture data: release-changes.test.ts path fixtures
(removed) and ban-e2e-app-imports.test.ts, which uses @decocms/tunnel/subject
as an example of a DENIED unlisted package — that test keeps passing, a
deleted package is guaranteed unlisted. Root README workspace row removed;
check:readmes now validates 13 workspaces.
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