Skip to content

fix(web-ui): avoid repeated idle remote capability probes - #3717

Merged
bobleer merged 6 commits into
openBitFun:mainfrom
bobleer:bob/fix-idle-remote-probes
Nov 3, 2026
Merged

bobleer merged 6 commits into
openBitFun:mainfrom
bobleer:bob/fix-idle-remote-probes

Conversation

@bobleer

@bobleer bobleer commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Remote workspace catalog updates repeatedly forced ACP requirement probes even when the connection and workspace binding were unchanged. Each round could launch multiple login shells. Reuse probes within an activation, refresh on real connection/configuration changes or explicit requests, and prevent probe-completion events from starting another probe.

Fixes #3712

Type and Areas

Type: bug fix / performance

Areas: Web UI, SSH workspace restoration, ACP requirements and workspace menus, editor polling lifecycle.

Behavior and lifecycle review

  • Ordinary metadata updates continue checking liveness and recovering disconnected workspaces, but reuse unchanged directory bindings and capability probes. Explicit workspace selection still activates the host workspace; concurrent binding/activation updates are queued.
  • Configuration changes refresh currently used connected sources, including retrying a previously failed probe. Closed sources are not probed. Concurrent forced probes coalesce; invalidation, reconnect and device switches retire stale cache writes.
  • Restore results recheck workspace membership/binding and connection revision before activation/publication. Closing, rebinding or explicitly disconnecting during a pending check cannot reactivate the old workspace. Reconnect retries stop after the connection is no longer used.
  • Ready connections start monitoring independently of other slow or failed workspace restores. One non-overlapping 30-second heartbeat per used connection keeps its deadline across metadata updates. Last-workspace closure, unused-browser dismissal and provider teardown retire monitoring; browser reopening and return from Peer mode resume it. Peer-owned browser connections never resume on the controller.
  • A heartbeat that observed transport loss immediately invalidates the old probe, even if another entry point restores the connection before reconciliation. Explicit reconnect retires old heartbeat completions.
  • Workspace menus probe missing snapshots on open, but completion notifications only consume the resulting snapshot. A real API/event integration test covers the empty-snapshot feedback loop. Superseded menu loads cannot overwrite newer results; fallback refresh state is scoped to the device activation.
  • Editor polling retains its existing direct-workspace cadence (about one second, including SSH/container files) and Peer cadence (15 seconds). Hidden windows pause timers and check immediately on return/focus. Mode changes and disposal clear both warmup and repeating timers. External terminal/tool edits remain discoverable without frontend events.
  • Git/file-tree polling, unfinished dispatch-job discovery and permission/event delivery, configured scheduled work, MCP recovery, and SSH protocol keepalives retain their existing behavior.

Verification

  • 21 focused Vitest files, 2570 tests passed, including SSH/ACP/menu lifecycle cases and the editor owner's required disk-sync/Markdown suites. These cover three simulated idle hours, multiple/shared connections, partial failure and delayed activation, close/rebind/disconnect races, config invalidation after failure or closure, stale request success/failure, Peer round trips and equal IDs on different devices, hidden/focus transitions and timer teardown.
  • pnpm run check:web — passed (TypeScript and appearance/theme contracts).
  • ESLint on every changed production TypeScript file — passed.
  • git diff --check — passed.
  • Rebased onto upstream main bd8f0473d5 without conflicts; its intervening Windows-material changes do not modify these paths.

Focused command:

pnpm --dir src/web-ui exec vitest run src/features/ssh-remote/SSHRemoteProvider.test.tsx src/features/ssh-remote/remoteWorkspaceReconnect.test.ts src/infrastructure/api/service-api/ACPClientAPI.test.ts src/app/components/NavPanel/sections/workspaces/workspaceAcpMenuClients.test.ts src/app/components/NavPanel/sections/workspaces/workspaceAcpMenuClients.integration.test.ts src/app/components/NavPanel/sections/workspaces/WorkspaceItemSessionBatchManagement.test.ts src/tools/editor/utils/fileSyncPolling.test.ts src/tools/editor/components/CodeEditor.test.tsx src/tools/editor/services/MonacoModelManager.test.ts src/tools/editor/services/EditorDocument.test.ts src/tools/editor/utils/diskFileVersion.test.ts src/tools/editor/components/MarkdownEditor.test.tsx src/tools/editor/meditor/components/MEditor.test.tsx src/tools/editor/meditor/extensions/SoftBreakExtension.test.ts src/tools/editor/meditor/utils/tiptapMarkdown.test.ts src/tools/editor/meditor/utils/tiptapMarkdown.roundtrip.test.ts src/tools/editor/meditor/utils/embeddedSource.test.ts src/tools/editor/meditor/utils/markdownFrontmatter.test.ts src/tools/editor/meditor/utils/loadLocalImages.test.ts src/infrastructure/markdown/rehypeSourceRange.test.ts src/infrastructure/markdown/MarkdownRenderer.test.tsx --maxWorkers=3

Reviewer Notes

AI-assisted implementation. Tests execute production frontend code with simulated timers/host IO; SSH/container ownership and Peer switching are fixture coverage, not live SSH, Docker, WSL, Remote Control or Detached Dispatch verification. The report's exact count of 1698 shell launches has not been independently reproduced. No persisted or wire shapes change. Already submitted host operations finish under their existing host deadlines; retired UI work does not publish results or start further activation/probing.

Latest upstream main and open/draft PRs were checked before implementation and again during review. The relevant startup-performance, remote-skill and session-workspace event work does not cover this trigger chain. Tools installed outside OpenBitFun remain discoverable through explicit requirement refresh or reconnection.

Checklist

  • Focused change; no secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification and its limitations are recorded above.
  • Owning verification guides are updated.

@bobleer
bobleer force-pushed the bob/fix-idle-remote-probes branch from 4919e68 to 7a3d51c Compare November 3, 2026 09:11
@bobleer
bobleer merged commit 4c775d4 into openBitFun:main Nov 3, 2026
9 checks passed
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.

[Bug]: 远端环境探测无缓存:单连接 3 小时内发起 1698 次 bash -lc,平均每 20~40 秒重跑一轮

1 participant