Files
OpenHands/src/utils
Tim O'Farrellandopenhands 2d494a4767 feat: execute git-info probe commands over bash-events WebSocket (#646)
Replace per-poll REST calls in useLocalGitInfo with a persistent
WebSocket connection to /sockets/bash-events.

Previously, useQuery's refetchInterval:10_000 caused
AgentServerRuntimeService.executeCommand to fire individual HTTP
requests on every tick (find + 2 git commands × up to 3 candidate
dirs) to probe the workspace for git metadata.

Changes:
- websocket-url.ts: export buildBashWebSocketUrl() using the same
  host/pathPrefix extraction as the conversation-events URL builder
- use-bash-command-runner.ts: new hook that maintains a persistent WS
  connection to /sockets/bash-events and exposes runCommand(command,
  cwd, timeout) → Promise. Commands queued during CONNECTING are
  flushed on open; all in-flight commands are rejected on
  close/error/unmount.
- use-local-git-info.ts: swap AgentServerRuntimeService.executeCommand
  for useBashCommandRunner; keep refetchInterval:10_000 so branch
  changes (e.g. git checkout) are still reflected without a full
  refresh, but each probe now reuses the open socket rather than
  opening new HTTP connections.

Co-authored-by: openhands <openhands@all-hands.dev>
2026-05-25 08:50:55 -06:00
..