Skip to content

feat(agent): let a custom provider skip TLS certificate verification - #1610

Merged
huichen merged 4 commits into
mainfrom
pr/huichen
Nov 14, 2026
Merged

huichen merged 4 commits into
mainfrom
pr/huichen

Conversation

@huichen

@huichen huichen commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

What and why

A custom provider's endpoint often runs on a self-hosted gateway that serves HTTPS with a self-signed certificate, or one issued by a private CA the platform trust store does not know. The transport is still worth encrypting, so certificate verification becomes an opt-in per provider instead of an all-or-nothing app-wide decision.

The flag travels with the provider, not with the app: skipTlsVerify sits in models.json next to baseUrl, crosses the RPC wire contract on ProviderUpsert.skip_tls_verify and ThinkingLevelProbe.skip_tls_verify, and reaches the desktop custom-provider dialog, the remote-desktop provider panel, the mobile provider page and future models probe --insecure.

Verification is applied per request in post_model_body by choosing between two clients built together, so a streaming call neither rebuilds a client (losing connection pooling) nor latches a flag on the shared client (leaking it to every other provider).

Presence is three-way on purpose: Some(true) writes the key, Some(false) removes it, None leaves the stored value untouched — an older client that cannot express the flag cannot silently re-enable verification on a self-signed endpoint. The TUI and the CLI wizard send None for that reason.

Commits

  • feat(agent): let a custom provider skip TLS certificate verification — the feature: per-provider skipTlsVerify in models.json, on the RPC wire, and in the desktop, remote-desktop, mobile, CLI and TUI surfaces.
  • fix(desktop): pass skipTlsVerify in the provider wrapper test — the desktop crate's #[cfg(test)] module still built the host input structs without the new field, which broke cargo build --tests -p futureos. Test-only; no product code.

Verification

Local, in a detached worktree at the branch tip, rustc pinned to 1.99.1 (rust-toolchain.toml), ulimit -n 8192:

  • cargo fmt --all -- --check — clean
  • cargo check -p future-rpc -p future-agent -p future-host -p future-cli -p future-tui --all-targets — clean (52s)
  • cargo clippy on the same five crates, --all-targets -- -D warnings — clean (36s)
  • REGENERATE_PROTO=1 cargo build in packages/rpc — src/generated/proto.rs regenerates byte-identical, so the wire code is not stale
  • cargo test -p future-agent --lib -- tls_verify providers — 104 passed
  • cargo test -p future-host --lib agent_providers — 64 passed
  • cargo test -p future-rpc — passed
  • desktop: tsc --noEmit clean, eslint on the changed sources clean, vitest on CustomProviderDialog.skipTlsVerify + CustomProviderDialog.validation + RemoteProvidersPanel — 89 passed
  • mobile: tsc --noEmit clean, eslint on the changed sources clean, jest ProvidersSettings — 31 passed
  • @future-os/remote-protocol: typecheck, check:generated and vitest — 63 passed

Full --lib suites for future-agent/future-host were not re-run locally; CI covers them.

User-visible changes

  • New per-provider security setting, default off. Before: every model request verified the TLS chain and host name, and a provider whose endpoint presented a self-signed certificate simply could not be used over HTTPS. After: a custom provider carries a skipTlsVerify switch (desktop custom-provider dialog, remote-desktop provider panel, mobile provider page) that turns verification off for that provider's requests only; an unsaved endpoint can be probed with future models probe --insecure. The default stays "verify", and other providers are unaffected. Revert b625c0db2.
  • Wire contract addition. ProviderUpsert.skip_tls_verify (field 11) and ThinkingLevelProbe.skip_tls_verify (field 7) are new optional bool fields; absent means "leave as stored", so existing clients and hosts keep working unchanged.

Notes

No migration, no change to stored settings for providers that do not enable the flag, and no change to how built-in providers authenticate.

A self-hosted OpenAI-compatible endpoint often serves HTTPS with a
self-signed certificate, or one no public CA issued. The connection is
still worth encrypting, so verification needs to be optional per provider
rather than all-or-nothing for the whole app.

The flag travels with the provider, not with the app: a custom provider's
endpoint belongs to whoever configured it, so `skipTlsVerify` lives in
`models.json` beside `baseUrl`, crosses the remote wire contract in
`ProviderUpsert` and `ThinkingLevelProbe`, and reaches the desktop dialog,
the remote-desktop provider panel and the mobile provider page.

The TLS decision is applied per request in `post_model_body` by selecting
between two clients built together — not by rebuilding a client for every
streaming call (that would drop connection pooling) and not by latching a
flag on the shared client (that would leak to every other provider).

Presence is three-way, which is what keeps an older client from silently
re-enabling verification: `Some(true)` writes the key, `Some(false)`
removes it, and `None` leaves the stored value alone. The TUI and the CLI
wizard send `None` for that reason, and `future models probe --insecure`
covers an endpoint that is not saved yet.
@huichen
huichen enabled auto-merge (squash) November 14, 2026 11:22
`b625c0db2` made `skip_tls_verify` a field of host's
`UpsertCustomProviderInput` and `ThinkingLevelProbeInput`, and the
`command_wrappers_delegate_to_the_agent` test still built both structs
without it. The product code compiled, so only the all-targets build the
`Rust macOS test / desktop` job runs (`cargo check -p futureos
--all-targets`) failed with two E0063s.

Both initializations are the test's own request, not the editor form, so
they state `None` — the field's "nothing to say" value, which leaves any
stored flag alone. The test keeps asserting exactly what it did, and the
three-way presence contract stays in place.
@huichen
huichen merged commit d59c53b into main Nov 14, 2026
76 of 78 checks passed
@huichen
huichen deleted the pr/huichen branch November 14, 2026 12:25
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