Skip to content

Enable Zeta edit predictions with custom URL without authentication#43236

Merged
agu-z merged 8 commits intozed-industries:mainfrom
DominicBurkart:dominic.burkart/zeta-works-while-signed-out-if-ZED_PREDICT_EDITS_URL-set
Dec 15, 2025
Merged

Enable Zeta edit predictions with custom URL without authentication#43236
agu-z merged 8 commits intozed-industries:mainfrom
DominicBurkart:dominic.burkart/zeta-works-while-signed-out-if-ZED_PREDICT_EDITS_URL-set

Conversation

@DominicBurkart
Copy link
Contributor

@DominicBurkart DominicBurkart commented Nov 21, 2025

Enables using Zeta edit predictions with a custom ZED_PREDICT_EDITS_URL without requiring authentication to Zed servers. This is useful for:

  • Development and testing workflows
  • Self-hosted Zeta instances
  • Custom AI model endpoints

Prior context on this usage of ZED_PREDICT_EDITS_URL: #30418

Release Notes:

  • Improved self-hosted zeta UX. Users no longer have to log into Zed to use custom or self-hosted zeta backends.

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Nov 21, 2025
@zed-industries-bot
Copy link
Contributor

zed-industries-bot commented Nov 21, 2025

Warnings
⚠️

This PR is missing release notes.

Please add a "Release Notes" section that describes the change:

Release Notes:

- Added/Fixed/Improved ...

If your change is not user-facing, you can use "N/A" for the entry:

Release Notes:

- N/A

Generated by 🚫 dangerJS against 615fcb5

@SomeoneToIgnore SomeoneToIgnore added the area:ai Improvement related to Agent Panel, Edit Prediction, Copilot, or other AI features label Nov 21, 2025
@DominicBurkart DominicBurkart force-pushed the dominic.burkart/zeta-works-while-signed-out-if-ZED_PREDICT_EDITS_URL-set branch 3 times, most recently from d4c2153 to 23146f9 Compare November 21, 2025 12:43
Copy link

@nicky-isaacs-awoo nicky-isaacs-awoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but very much not an expert

@DominicBurkart DominicBurkart force-pushed the dominic.burkart/zeta-works-while-signed-out-if-ZED_PREDICT_EDITS_URL-set branch 2 times, most recently from d1ba30f to 23146f9 Compare November 25, 2025 14:00
@DominicBurkart DominicBurkart force-pushed the dominic.burkart/zeta-works-while-signed-out-if-ZED_PREDICT_EDITS_URL-set branch 3 times, most recently from 3181b85 to f524378 Compare December 2, 2025 14:16
@DominicBurkart DominicBurkart force-pushed the dominic.burkart/zeta-works-while-signed-out-if-ZED_PREDICT_EDITS_URL-set branch 2 times, most recently from 6d8b52a to d1e6672 Compare December 11, 2025 12:37
@DominicBurkart DominicBurkart marked this pull request as ready for review December 11, 2025 12:41
Add tests to verify authentication behavior with custom URLs:
- test_unauthenticated_without_custom_url_blocks_prediction: verifies
  that without authentication and without a custom URL, prediction fails
- test_unauthenticated_with_custom_url_allows_prediction: verifies that
  with a custom URL set via ZED_PREDICT_EDITS_URL, prediction should
  proceed even without authentication

These tests establish the expected behavior: when using custom URLs,
authentication should be optional (use if available, proceed without).
When ZED_PREDICT_EDITS_URL is set (custom URL), authentication is now
optional - the prediction will use authentication if available, and
proceed without it if not available.

When no custom URL is set (standard Zed infrastructure), authentication
remains required to maintain the existing behavior.

Changes:
- Token acquisition uses .ok() for custom URLs (converts error to None)
- Authorization header only added when token is present
- Token refresh only attempted when we had a token to begin with
@DominicBurkart DominicBurkart force-pushed the dominic.burkart/zeta-works-while-signed-out-if-ZED_PREDICT_EDITS_URL-set branch from d1e6672 to 0e41202 Compare December 11, 2025 12:53
Add test-only infrastructure to allow testing custom URL auth behavior
without requiring environment variable manipulation:

- Add TEST_FORCE_CUSTOM_URL_MODE AtomicBool with #[cfg(test)]
- Add has_custom_url() helper that checks test override first
- Combine auth tests into single test_authentication_behavior function
  for sequential execution (avoids concurrency issues)
- Remove #[ignore] from custom URL test - now runs in CI

The test-only code has zero impact on production builds.
@agu-z agu-z moved this from Community PRs to In progress in Quality Week – December 2025 Dec 15, 2025
Comment on lines +1700 to +1702
let url = client
.http_client()
.build_zed_llm_url("/predict_edits/raw", &[])?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Raw requests are only used by staff for experimentation, and the payload struct doesn't match, so we shouldn't use PREDICT_EDITS_URL

@agu-z
Copy link
Contributor

agu-z commented Dec 15, 2025

@DominicBurkart Thank you for your contribution! Merging after some tweaks

@agu-z agu-z enabled auto-merge (squash) December 15, 2025 17:18
@agu-z agu-z force-pushed the dominic.burkart/zeta-works-while-signed-out-if-ZED_PREDICT_EDITS_URL-set branch from 308638a to 615fcb5 Compare December 15, 2025 17:33
@agu-z agu-z merged commit 0d891bd into zed-industries:main Dec 15, 2025
23 checks passed
@github-project-automation github-project-automation bot moved this from In progress to Done in Quality Week – December 2025 Dec 15, 2025
CherryWorm pushed a commit to CherryWorm/zed that referenced this pull request Dec 16, 2025
…ed-industries#43236)

Enables using Zeta edit predictions with a custom
`ZED_PREDICT_EDITS_URL` without requiring authentication to Zed servers.
This is useful for:

- Development and testing workflows
- Self-hosted Zeta instances
- Custom AI model endpoints

Prior context on this usage of `ZED_PREDICT_EDITS_URL`:
zed-industries#30418

Release Notes:
- Improved self-hosted zeta UX. Users no longer have to log into Zed to
use custom or self-hosted zeta backends.

---------

Co-authored-by: Agus Zubiaga <agus@zed.dev>
@pjv
Copy link

pjv commented Dec 17, 2025

I understand use of this environment variable isn't an exactly supported configuration but i have a local ollama instance with zeta available on it. How exactly can i configure zed preview to use that zeta instance for edit predictions?

@SuperKenVery
Copy link

@pjv You may want to use this proxy to wrap ollama, then use PREDICT_EDITS_URL to point zed to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ai Improvement related to Agent Panel, Edit Prediction, Copilot, or other AI features cla-signed The user has signed the Contributor License Agreement

Projects

Development

Successfully merging this pull request may close these issues.

7 participants