Commit Graph

5 Commits

Author SHA1 Message Date
Channing Conger
e0de12a126 Make gRPC code-mode yield tests deterministic (#38321)
## What changed

- Use a never-resolving promise when verifying that a session continues to
  enforce its yield limit after terminating a cell.
- Use `yield_control()` to create the yielded cell in the notification-draining
  test instead of relying on timer scheduling.

GitOrigin-RevId: 01cdaa94e5b8b5c89c6fa98c4bbdb28a690678e0
2026-08-13 07:26:27 +00:00
Channing Conger
5104cb649e Support gRPC code-mode hosts in app server (#38288)
## What changed

- Accept root `http://` and `https://` URLs in `--code-mode-host` and use the
  shared gRPC session provider for those endpoints.
- Keep `ws://` and `wss://` URLs on the existing WebSocket transport.
- Reject paths, queries, fragments, and credentials where unsupported, without
  exposing gRPC URL credentials in command-line validation errors.

## Testing

- Cover argument parsing and transport selection for both remote protocols.
- Exercise a gRPC host shared across app-server threads and verify credential
  rejection does not disclose usernames or passwords.

GitOrigin-RevId: b6516a85cf76db5c4cea620f89ef866d8af30cf0
2026-08-13 01:32:42 +00:00
Channing Conger
bde723ae7d Reconnect gRPC code-mode sessions after host restarts (#38257)
## What changed

- Reopen a cached code-mode session when its gRPC host stops, while
  serializing concurrent reconnection attempts and coordinating shutdown.
- Scope cell IDs to the new host generation so callbacks remain consistent
  and stale `wait` or `terminate` requests are rejected.
- Accept both `unix://` and `unix:` endpoints for gRPC hosts on Unix systems.

## Testing

- Cover host restart recovery, concurrent execution after reconnection,
  generation-aware callbacks and cell operations, stale cell rejection, and
  Unix socket execution.

GitOrigin-RevId: 548e168fdcef7f7d54bd32262e614886bf7bdd32
2026-08-12 22:00:20 +00:00
Channing Conger
ba2fb48319 Forward gRPC code-mode callbacks to session delegates (#38072)
## What changed

- Subscribe each gRPC code-mode session to nested tool calls and forward tool and notification callbacks to its delegate.
- Complete tool calls through the host while bounding oversized results and errors.
- Track callback ownership and cancellation so completed cells drain notifications, terminated cells cancel them, and shutdown revokes outstanding work.
- Validate callback identifiers, cell ownership, enabled tools, and pending callback limits without serializing independent callbacks or sessions.

## Testing

- Add integration and state tests for callback forwarding, completion ordering, cancellation, malformed callbacks, delegate panics, oversized results, and concurrent work.

GitOrigin-RevId: 005afbb90eea0eb77d746b930a1a96ca6dfcd4e7
2026-08-11 20:40:26 +00:00
Channing Conger
1e557a554e Add gRPC-backed code-mode sessions (#38041)
## What changed

- Add `GrpcCodeModeSessionProvider` for opening code-mode sessions over HTTP/2 or an existing `tonic` channel.
- Support execution, waiting, termination, per-session limits, cell-closure callbacks, and graceful shutdown over the gRPC protocol.
- Bound transport waits and error messages, validate host identifiers and responses, and clean up abandoned executions and observers.

## Testing

- Add end-to-end TCP tests covering session persistence, cancellation, concurrent waits, shutdown, cell cleanup, and independent yield limits.
- Add unit coverage for protocol conversion, deadlines, and session lifecycle state.

GitOrigin-RevId: d4729ce608ad4b42a99744b07e1f230e46cb24ec
2026-08-11 17:31:11 +00:00