Skip to content

refactor(v1): collapse interception to PrimeTunnel and server|elastic - #2504

Closed
hallerite wants to merge 1 commit into
chore/declare-direct-depsfrom
chore/collapse-interception-tunnel
Closed

refactor(v1): collapse interception to PrimeTunnel and server|elastic#2504
hallerite wants to merge 1 commit into
chore/declare-direct-depsfrom
chore/collapse-interception-tunnel

Conversation

@hallerite

@hallerite hallerite commented Sep 2, 2026

Copy link
Copy Markdown
Member

Stacked on #2503 (which is stacked on #2496).

The interception layer carried a generic plugin system with one used implementation. The tunnel/ package was a discriminated TunnelConfig union, a Tunnel ABC generic over its config, bind_host/bind_port hooks, and a custom bring-your-own-endpoint tunnel. Nothing selects it: no config, doc, skill or test in verifiers sets interception.tunnel, prime-rl and the env repos never touch it, and the default ElasticInterceptionPool hard-pins PrimeTunnelConfig() regardless. StaticInterceptionPool existed for the same bring-your-own case and has no consumer either.

After this PR

  • verifiers/v1/interception/tunnel.py is one module: PrimeTunnel (no config, no base class) and TUNNEL_LIMITER. mcp/launch.py keeps importing PrimeTunnel from the same path.
  • InterceptionServerConfig has no tunnel field. The server always binds an ephemeral loopback port; when a consumer is remote it exposes that port through a prime tunnel, exactly as the only reachable configuration did before.
  • InterceptionConfig is server | elastic. --interception.type static and any interception.tunnel.* flag now fail validation instead of selecting dead code.

Removed: PrimeTunnelConfig, BaseTunnelConfig, Tunnel, CustomTunnel, CustomTunnelConfig, TunnelConfig, make_tunnel, StaticInterceptionPool, StaticInterceptionPoolConfig. None is exported from verifiers.v1 and none is referenced in prime-rl, prime-envs or community-environments. TunnelError is unchanged.

Checks run: ruff check, ruff format --check, ty check verifiers, pytest tests/v1 -m "not e2e" (82 passed), plus a direct check that {"type": "server"} and {"type": "elastic"} validate, static and a tunnel field are rejected, the EnvConfig default is still elastic, and a non-tunnelled server binds loopback.

🤖 Generated with Claude Code

Note

Remove static interception pool and collapse tunnel to PrimeTunnel

  • Removes StaticInterceptionPool and StaticInterceptionPoolConfig from the interception config union, factory, and public exports; only server and elastic types remain
  • InterceptionServer no longer carries a configurable tunnel field; it constructs a PrimeTunnel directly when requires_tunnel is true, otherwise runs with no tunnel
  • InterceptionServer.start always binds an ephemeral port on the server host; remote exposure publishes that port through PrimeTunnel, non-remote returns a loopback URL
  • ElasticInterceptionPool._server no longer passes an explicit prime tunnel config to new elastic servers; they use the default server config while retaining pool-level tunnel requirement and state secrets
  • Risk: callers that set InterceptionServerConfig.tunnel or instantiate the static interception type will break; the tunnel field and StaticInterceptionPoolConfig discriminator are removed from server.py and pool.py

Macroscope summarized 15302bf.

The tunnel layer was a discriminated union with an ABC, a generic config
base, bind_host/bind_port hooks and a `custom` bring-your-own-endpoint
implementation that nothing selects: no config, doc, skill, test, or
downstream repo sets `interception.tunnel`, and the default elastic pool
hard-pins prime anyway. StaticInterceptionPool existed for the same
bring-your-own case and has no consumer either.

- verifiers/v1/interception/tunnel/ package -> tunnel.py: PrimeTunnel and
  TUNNEL_LIMITER only; PrimeTunnelConfig, BaseTunnelConfig, Tunnel,
  CustomTunnel(+Config), TunnelConfig, make_tunnel are gone
- InterceptionServerConfig loses its `tunnel` field; the server always
  binds an ephemeral loopback port and exposes it through a prime tunnel
  when a consumer is remote
- StaticInterceptionPool(+Config) removed; InterceptionConfig is
  server | elastic
- docstrings in interception/base.py and the runtimes updated to match

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@hallerite hallerite closed this Sep 2, 2026
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