Skip to content

loop: align agent transport with TUI/CLI socket-first discovery - #495

Merged
huichen merged 1 commit into
mainfrom
claude/loop-transport-discovery
Sep 4, 2026
Merged

huichen merged 1 commit into
mainfrom
claude/loop-transport-discovery

Conversation

@huichen

@huichen huichen commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

future loop run hardcoded its agent connection to TCP 127.0.0.1:50051, while the TUI/CLI clients discover the agent socket-first via the per-user local IPC boundary (see future_rpc::transport). This meant the loop control plane could not reach an agent started the default way (socket-only, no --grpc-addr), and required a separately-flagged TCP agent.

This PR routes the loop's agent client through the shared transport::connect_channel discovery so it behaves like every other client.

Changes

  • agent_addr() now defaults to the auto sentinel (local IPC) instead of 127.0.0.1:50051; FUTURE_LOOP_AGENT_ADDR still overrides with an explicit TCP address (tests keep using it to point at mock servers).
  • AgentClient::connect() reuses future_rpc::transport::connect_channel: explicit TCP first with local IPC fallback; auto selects local-only.
  • Test isolation: cli_root() and connect_failure_is_wrapped set FUTURE_AGENT_SOCKET to a tempdir so "unreachable agent" tests never fall back to an ambient dev-machine socket.
  • Docs: docs/loop-control-plane.md agent-service line now matches the zh doc (per-user local IPC by default).

Verification

  • cargo fmt -p future-loop --check ✅
  • cargo clippy -p future-loop --all-targets -- -D warnings ✅
  • cargo test -p future-loop ✅ (all green)
  • Manual: with nothing listening on 50051, future loop models still succeeds against the socket-only agent.

future loop run hardcoded TCP 127.0.0.1:50051, while the TUI/CLI
clients discover the agent socket-first via the per-user local IPC
boundary. Route AgentClient::connect through the shared
transport::connect_channel so the loop control plane connects to the
default agent (socket-only) instead of requiring an explicit
--grpc-addr agent.

- agent_addr() now defaults to the auto sentinel (local IPC) instead
  of 127.0.0.1:50051; FUTURE_LOOP_AGENT_ADDR still overrides with an
  explicit TCP address (tests keep using it for mock servers)
- connect() reuses future_rpc::transport::connect_channel: explicit
  TCP first with local fallback; auto selects local-only
- isolate FUTURE_AGENT_SOCKET in test cli_root() and the
  connect_failure_is_wrapped test so 'unreachable agent' cases never
  fall back to an ambient dev-machine socket
- docs/loop-control-plane.md: agent service line matches the zh doc
  (per-user local IPC by default)
@huichen
huichen enabled auto-merge (squash) September 4, 2026 10:02
@huichen
huichen merged commit f652698 into main Sep 4, 2026
12 checks passed
@huichen
huichen deleted the claude/loop-transport-discovery branch September 4, 2026 10:07
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