fix(gateway): derive the backend caller for internal agent controls on the server (#201845)

* fix(gateway): derive the backend caller for internal agent controls on the server

The `agent` request preflight unlocked the internal runtime handoff
controls (suppressPromptPersistence, sessionEffects "internal",
expectedExistingSessionId, exec follow-up and progress provenance) for any
connection whose connect frame declared client mode "backend". The mode is
chosen by the client, so a remote write-scoped device could declare it and
start a turn whose prompt is never written to the transcript.

The preflight now also requires a server-derived fact: an in-process
synthetic client, or a connection the handshake attested as a non-remote
gateway-client backend (the same isLocalBackendClient rule that already
gates the agent runtime identity token). The connect session records that
as internal.localBackendClient, which is never accepted from wire params.

Every producer of those inputs runs in-process or over loopback, so they
are still admitted. A remote backend-mode connection now gets the same
refusal a cli client gets for these inputs; its ordinary turns are
unchanged.

The shared handler test helpers model a local backend client, and the
server-level test covers a remote write-scoped device in both modes.

* test(gateway): connect local backend tests as gateway-client and cover declared backend mode

The server-derived backend fact also requires client id gateway-client,
so a local backend-mode client with another id no longer unlocks the
internal agent controls. Two tests did exactly that and sent
expectedExistingSessionId as client id "test": the removed-worktree
product test (refused with "expectedExistingSessionId is reserved for
backend callers." instead of reaching the worktree check) and the live
cron placement test. Both now connect as gateway-client, like the real
in-Gateway callers.

The preflight unit test gains a declared-backend caller (mode backend,
no server fact). Every reserved input (exec completion, restart and
progress refresh provenance, prompt suppression, internal session
effects, expected session, exec approval follow-up key, swarm collector
fields) is now refused for it, for a cli client and for no client, and
still admitted for a local backend where the bare request allows it.

The remote write-scoped server test restores the Gateway config in
finally so its trusted proxy setting does not leak into later cases.