Commit Graph

14 Commits

Author SHA1 Message Date
Joep Joosten 12f79c0aeb cloud_api_client: Use the platform TLS verifier for the cloud websocket (#63686)
# Objective

Fixes #63683

Behind a corporate TLS-inspecting proxy (e.g. Zscaler) whose root CA is
installed in the OS trust store, the Zed Cloud websocket fails
permanently with `invalid peer certificate: UnknownIssuer`, while every
other connection in Zed works.

`crates/cloud_api_client/src/websocket/native.rs` calls
`yawc::WebSocket::connect` without a TLS connector. yawc's default
connector trusts only the bundled `webpki-roots`, so it never consults
the platform trust store. Everything else in Zed (the reqwest HTTP
client and the collab websocket in `crates/client`) uses
`http_client_tls::tls_config()`, which is built on
`rustls-platform-verifier`.

## Solution

Pass a `tokio_rustls::TlsConnector` built from
`http_client_tls::tls_config()` to yawc via
`WebSocketBuilder::with_connector`, so the cloud websocket verifies
certificates exactly like the collab websocket does
(`client_async_tls_with_connector_and_config(...,
Some(Arc::new(http_client_tls::tls_config()).into()), ...)`).

`cloud_api_client` gains two non-wasm dependencies: `http_client_tls`
(workspace crate) and `tokio-rustls` (same `0.26` line yawc and `client`
already use, no default features).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01Ub1SNsrgWjTA6iAKanKfwt

## Testing

- `cargo check -p cloud_api_client` and `cargo fmt --check` on macOS
(arm64).
- Reproduced the bug and validated the approach with a standalone rustls
probe against `cloud.zed.dev` / `collab.zed.dev` from behind Zscaler:
- `webpki_roots::TLS_SERVER_ROOTS` only (yawc's default):
`InvalidCertificate(UnknownIssuer)` – identical to the error in the Zed
log
- `ClientConfig::with_platform_verifier()` (what `tls_config()`
returns): connects fine
- Reviewers behind a TLS-inspecting proxy can confirm by watching
`~/Library/Logs/Zed/Zed.log` for `cloud websocket connect failed:
invalid peer certificate: UnknownIssuer` before and after.
- I could not test on Windows or Linux, but the change only routes the
cloud websocket through the same `tls_config()` those platforms already
use for all other HTTPS traffic.

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Fixed the Zed Cloud connection failing with `UnknownIssuer` behind
corporate TLS-inspecting proxies whose root CA is installed in the
system trust store.

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Finn Evers <finn@zed.dev>
2026-09-29 10:23:00 +00:00
Finn Evers aec7395e30 Fix cargo shear warnings (#64340)
Also updates CI to always run this - that way we ensure that disabling
or enabling tests does not become stale at some point and thus can
safely add this.

Release Notes:

- N/A
- [GPUI] N/A
2026-09-17 08:49:31 +00:00
Lukas Wirth 5896274168 gpui: Replace shared asset futures with owning cache entries (#63934)
## Summary

Replace GPUI's shared asset futures with owning cache entries. The
mutex-backed waiter collection in futures::future::Shared can contend
between a worker and the browser main thread, where blocking waits are
forbidden.

- Keep loading on the background executor, with one foreground task
publishing the cached result and notifying interested views.
- Deduplicate loads and view registrations; cancel pending work on
eviction without allowing completion to update a replacement entry.
- Change App::fetch_asset to return Option<A::Output>, remove
ImageLoadingTask, and make ImageCacheItem an opaque owning entry.
- Migrate the retain-all image cache and image gallery LRU example.
Repository-wide search found no further callers requiring migration.

Results become visible after the foreground completion task publishes
them. Entries expose neither cloneable nor awaitable task handles.

Release Notes:

- N/A
2026-09-09 09:30:38 +00:00
Remco Smits 770aac345c cloud_api_client: Add yield point to prevent background task hangs (#63105)
Follow-up: https://github.com/zed-industries/zed/pull/62874

# Objective

After having Zed open for a while I'm getting some foreground and
background hang warnings, like this one.

```
2026-08-19T11:25:45+02:00 INFO [zed::reliability::hang_detection::logging] New foreground hang detected: Tasks(s) that ran too long 215.24375ms          - crates/cloud_api_client/src/websocket/native.rs:34:23
```

## Solution

My solution is to add yield points so a single task doesn't block the
executor thread for too long.

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A
2026-08-31 05:45:47 +00:00
Lukas Wirth 875042b698 cloud_api_client: Implement Wasm support (#61328)
Release Notes:

- N/A or Added/Fixed/Improved ...

---------

Co-authored-by: Gaauwe Rombouts <mail@grombouts.nl>
2026-07-21 13:20:31 +00:00
Tom Houlé 74180d86fe cloud_api_client: Add a few helpers for response handling (#58346)
This centralizes some repeated logic across `cloud_api_client`, to map
generic request failures (`ConnectionFailed`, 401s) to errors and read
response bodies, handling failures there too.

Closes CLO-759.

Release Notes:

- N/A
2026-06-03 09:18:14 +00:00
Lukas Wirth c5a2807492 Remove smol as a dependency from a bunch of crates (#53603)
We aren't making use of it in these crates and it unblocks some
web-related work

Release Notes:

- N/A or Added/Fixed/Improved ...
2026-04-24 10:29:51 +00:00
Agus Zubiaga 98c17ca160 language_models: Refactor deps and extract cloud (#53270)
- `language_model` no longer depends on provider-specific crates such as
`anthropic` and `open_ai` (inverted dependency)
- `language_model_core` was extracted from `language_model` which
contains the types for the provider-specific crates to convert to/from.
- `gpui::SharedString` has been extracted into its own crate (still
exposed by `gpui`), so `language_model_core` and provider API crates
don't have to depend on `gpui`.
- Removes some unnecessary `&'static str` | `SharedString` -> `String`
-> `SharedString` conversions across the codebase.
- Extracts the core logic of the cloud `LanguageModelProvider` into its
own crate with simpler dependencies.


Release Notes:

- N/A

---------

Co-authored-by: John Tur <john-tur@outlook.com>
2026-04-07 12:28:19 -03:00
Marshall Bowers 42202edee9 Sign out upon receiving an Unauthorized response when acquiring an LLM token (#49673)
This PR makes it so the user gets signed out upon receiving an
Unauthorized response when acquiring an LLM token.

This is a re-landing of #49661.

Closes CLO-324.

Release Notes:

- N/A
2026-02-19 22:13:38 -05:00
Marshall Bowers 94b9628d42 Revert "Sign out upon receiving an Unauthorized response when acquiring an LLM token (#49661) (#49669)
This PR reverts #49661, as the Collab tests are failing (but were not
caught in CI).

This reverts commit 2f9350bb6b.

Release Notes:

- N/A
2026-02-19 23:54:03 +00:00
Marshall Bowers 2f9350bb6b Sign out upon receiving an Unauthorized response when acquiring an LLM token (#49661)
This PR makes it so the user gets signed out upon receiving an
Unauthorized response when acquiring an LLM token.

Closes CLO-324.

Release Notes:

- N/A
2026-02-19 22:23:40 +00:00
Julia Ryan ef5b8c6fed Remove workspace-hack (#40216)
We've been considering removing workspace-hack for a couple reasons:
- Lukas ran into a situation where its build script seemed to be causing
spurious rebuilds. This seems more likely to be a cargo bug than an
issue with workspace-hack itself (given that it has an empty build
script), but we don't necessarily want to take the time to hunt that
down right now.
- Marshall mentioned hakari interacts poorly with automated crate
updates (in our case provided by rennovate) because you'd need to have
`cargo hakari generate && cargo hakari manage-deps` after their changes
and we prefer to not have actions that make commits.

Currently removing workspace-hack causes our workspace to grow from
~1700 to ~2000 crates being built (depending on platform), which is
mainly a problem when you're building the whole workspace or running
tests across the the normal and remote binaries (which is where
feature-unification nets us the most sharing). It doesn't impact
incremental times noticeably when you're just iterating on `-p zed`, and
we'll hopefully get these savings back in the future when
rust-lang/cargo#14774 (which re-implements the functionality of hakari)
is finished.

Release Notes:

- N/A
2025-10-17 18:58:14 +00:00
Richard Feldman 1907b16fe6 Establish WebSocket connection to Cloud (#35734)
This PR adds a new WebSocket connection to Cloud.

This connection will be used to push down notifications from the server
to the client.

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <git@maxdeviant.com>
2025-08-07 01:28:41 +00:00
Marshall Bowers bc6bb42745 Add cloud_api_client and cloud_api_types crates (#35357)
This PR adds two new crates for interacting with Cloud:

- `cloud_api_client` - The client that will be used to talk to Cloud.
- `cloud_api_types` - The types for the Cloud API that are shared
between Zed and Cloud.

Release Notes:

- N/A
2025-07-30 18:57:51 +00:00