Commit Graph

40564 Commits

Author SHA1 Message Date
Finn Evers 4f862ffbc6 Cleanup unused workflows and script files (#66024)
Removes a lot of dead code we have floating around here that is no
longer used and has not been for ages.

If we ever need to check something out here again, we can just revert
parts of these. Currently, these just trigger security warnings if
anything and thus are dead weight. Hence removing here.

Drive-by fix of our collab staging deploys as well.

Release Notes:

- N/A
2026-10-23 09:30:55 +00:00
Finn Evers e841324d0d Remove unused GitHub action files (#66019)
We currently do not use nor maintain those files and thus their
dependencies can get outdated fast.

Hence, removing here to keep the repo cleaner.

Release Notes:

- N/A
2026-10-23 09:11:13 +00:00
John D. Swanson 27ea42bf01 Update dependencies to address security vulnerabilities (#65997)
## Summary

Update locked dependencies to incorporate upstream security and
correctness fixes.

## Testing

- macOS arm64: Zed build passed; application launch confirmed.
- Focused dependency-consumer tests and optional QUIC compilation
passed.
- Formatting and diff whitespace checks passed.
- Linux and Windows were not tested locally.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [ ] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist). (N/A)
- [x] Tests cover the new or changed behavior.

Release Notes:

- Updated dependencies to address recent software ecosystem
vulnerabilities.
2026-10-23 08:37:00 +00:00
Smit Barmase fda552edce agent: Fix reading the entire threads database after every thread save (#66015)
Part of #64897. Also fixes the `threads.db` read traffic and lock stalls
reported in [this comment on
#59107](https://github.com/zed-industries/zed/issues/59107#issuecomment-5781374977).

During long agent sessions, Zed kept reading the whole `threads.db` file
in the background. The reporter saw about 150 MB/s of reads.

After every save, we reload the thread list. That only needs small
fields like the title and dates. But some of those fields were added to
the table later, so SQLite stores them after each thread's large `data`
blob, and has to go through the whole blob to reach them. On a 148 MB
test database with 120 threads, one reload read 37,958 pages, which is
the entire file.

This adds an index that holds just the fields the thread list needs.
SQLite now reads the list from the index and skips the blobs, and the
same reload reads 7 pages. The index starts with the dates, so SQLite
also gets the threads in newest-first order without sorting, but that
part is minor. A test checks that SQLite actually uses the index.

Moving `data` to the end of the table would fix it too. But `threads.db`
has no migration tracking, and that change would copy every thread's
blob on first launch. I went with the index since it's safer and doesn't
touch any existing rows.

Saving a thread 200 times in a row on that database (release build):

| | Before | After |
|---|---|---|
| Time per save | 22.2 ms | 2.4 ms |
| CPU time for 200 saves | 4.4 s | 0.47 s |

Memory use stays the same. The index takes about 24 KB, and Zed builds
it once on first launch, in the background. That took about 0.1 s for
148 MB.

Next, I'd like to update only the saved thread in the list, so we don't
reload the whole list after every save. That'll be a follow-up PR.

Release Notes:

- Improved CPU usage and disk reads while the agent is working,
especially with a long thread history.

---------

Co-authored-by: zed-zippy[bot] <234243425+zed-zippy[bot]@users.noreply.github.com>
2026-10-23 08:23:02 +00:00
Smit Barmase 18512de483 ui: Fix scrollbar settings not applying to open scrollbars (#66017)
Changing a scrollbar setting didn't update scrollbars that were already
open. You had to close and reopen the terminal or panel to see the new
setting. This broke in #52747, and now open scrollbars update right
away.

`ui` still doesn't depend on the `settings` crate, those changes reach
each scrollbar through a small marker global.

This also fixes a scrollbar briefly flickering when switched to `auto`,
and an `auto` scrollbar still hiding itself shortly after switching to
`always`.

Release Notes:

- Fixed scrollbar settings not applying to already open terminals,
panels and menus until they were reopened.
2026-10-23 07:56:57 +00:00
Anthony Eid 9e84b066b5 fs: Preserve child watches when removing parent subscriptions (#65998)
## Summary

Removing a recursive watch subscription could silently stop events for
surviving child subscriptions that shared its backend watch. This change
tracks coverage explicitly, installs replacement watches
shallowest-first before removing the parent, and retains broader
coverage if replacement fails without scanning unrelated registrations
during teardown. Once replacement coverage is established, an unwatch
error is logged without treating the removed watch as reusable coverage,
and retained roots remain visible in watcher diagnostics. It addresses
part of [FR-68](https://linear.app/zed-industries/issue/FR-68) and
follows the issue identified in #60663; this implementation targets the
current `OsWatcher` architecture and preserves existing coverage on
promotion failure, whereas that PR targets the older architecture and
removes the parent watch before attempting replacements.

## Validation

- `corgi test -p fs` — 56 tests passed on macOS; parent verification
returned the same result from Corgi's cache.
- Native child-event delivery after parent removal passed six
consecutive runs.
- New and extended regressions for unwatch failure, retained-root
diagnostics, and unrelated-removal retries fail against the previous PR
implementation and pass with the revision.
- `./script/clippy -p fs`, `cargo fmt -p fs`, and `git diff --check`
passed.
- A bounded release-build probe using the real watcher owner with a fake
backend measured teardown of 40,000 nonrecursive registrations at 8.9 ms
on base, 856 ms on the previous PR implementation, and 10.5 ms with the
revision. This does not measure native backend costs.
- Linux and Windows execution remain unverified. Relevant removal
sequences can still cause repeated failed native promotions; unrelated
removals no longer retry them.

Release Notes:

- fs: Fixed surviving child watch subscriptions losing filesystem events
when a covering parent subscription is removed.
2026-10-22 23:46:23 +00:00
Anthony Eid cfb894a5dd fs: Normalize folded watcher path identity (#65995)
## Summary

Case-insensitive filesystem watches registered with a trailing separator
could silently miss events because registration keys preserved the
separator while event-path ancestors omitted it. Normalize path
components before case folding so equivalent spellings share the same
watch key without resolving symlinks or parent components. Add
regression coverage for event delivery, shared-watch lifetime, and root
and parent-component identity in the existing watcher test module.

Related to [FR-68](https://linear.app/zed-industries/issue/FR-68)
(partial fix; parent-watch removal and backend churn remain separate).

## Validation

- `corgi test -p fs 'fs_watcher::tests'` — 19 tests passed on macOS.
- `git diff --check` — passed.

Release Notes:

- fs: Fixed missed filesystem events for case-insensitive watches
registered with trailing separators or equivalent path spellings.
2026-10-22 18:50:17 +00:00
giocld c18e71c782 languages: Fix Go test task cwd on Windows (#65722)
Fixes #64841. gopls.run_tests left /C:/... causing os error 267. Now
parses with lsp Uri to_file_path + drive-letter normalize.

Release Notes:

- Fixed Go Run Test failing on Windows with directory invalid error.

---------

Co-authored-by: giocld <giocld@users.noreply.github.com>
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2026-10-22 15:44:23 +00:00
Kirill Bulatov f1ccf949d5 gpui_ios: Reuse the cached main-thread marker (#65975)
Follow-up to
https://github.com/zed-industries/zed/pull/65934#issuecomment-6332065288

Release Notes:

- [GPUI] N/A
2026-10-22 15:35:30 +00:00
Bennet Bo Fenner 574df448ea Preserve transport errors in Google and OpenAI Responses streams (#65940)
Preserve typed transport errors in Google AI and OpenAI Responses
completion streams instead of converting mid-stream read failures into
generic, non-retryable model errors.

- Classify streaming body-read failures separately from malformed JSON,
preserving the provider name and original error.
- Carry typed errors through the completion mappers and
direct/OpenAI-compatible callers. Keep the OpenAI Responses mapper
compatible with integrations that still supply generic errors.
- Apply the same classification to OpenCode's Google-protocol stream.
- Leave timeout durations and retry policies unchanged.

Release Notes:

- Fixed streaming connection failures being classified as non-retryable
errors for Google AI and OpenAI Responses model requests.
2026-10-22 13:57:27 +00:00
Bennet Bo Fenner 566f893ee3 open_ai: Handle Responses reasoning text events (#65938)
Handle the official Responses API `response.reasoning_text.delta` and
`response.reasoning_text.done` events, used by gpt-oss-compatible
servers and custom OpenAI-compatible gateways.

- Map nonempty reasoning-text deltas to thinking output, alongside the
existing `response.reasoning.delta` compatibility path.
- Ignore the done event for display so its full text does not duplicate
streamed deltas.
- Synthesize reasoning-text deltas from reasoning-item content in
non-streaming JSON responses.
- Preserve the existing structured reasoning-item replay path unchanged.

Release Notes:

- Fixed missing thinking output from OpenAI-compatible Responses
endpoints that emit reasoning-text events.
2026-10-22 13:33:31 +00:00
Raum Dellamorte 50304070c2 helix: Return to normal mode after pasting in select mode (#65492)
## Summary

In Helix, if you enter Select Mode, select some text, and Shift-r to
replace the selection with the currently yanked text, you are returned
to Normal Mode. However, Zed's Helix Mode does not exit Select Mode.
Your next motion will begin a new selection. To fix this, I added a
check in the catch-all branch of match vim.mode in the Paste Vim::action
to return to Mode::HelixNormal if we're in Mode::HelixSelect.

I renamed the branch to better reflect what it's for and that closed the
original pull request #65152

## Testing

I've extended the existing `test_shift_r_paste()` to include pasting
over a selection in `Mode::HelixSelect` and asserting that the new mode
is `Mode::HelixNormal`.

I've run `cargo test -p vim helix::test::test_shift_r_paste` which
returned `test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured;
572 filtered out; finished in 0.95s`

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [ ] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- Fixed pasting in Helix select mode (`shift-r`, `space p`, `cmd-v`) not
returning to normal mode

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
2026-10-22 12:38:58 +00:00
Ben Brandt fd2aedc471 agent_servers: Update ACP SDK to 3.5.0 (#65982)
Updates `agent-client-protocol` to
[v3.5.0](https://github.com/agentclientprotocol/rust-sdk/releases/tag/v3.5.0)
and adopts its fixes for v2 integration feedback.

- **Typed v1 fallback:** v2 startup uses `send_initialize`. A
`LowerVersion` outcome or a v1-only `-32022` error triggers the v1
fallback directly, instead of recovering the agent's response from the
debug log. The debug-log lookup is now only used when the agent exits
right after answering and the process-exit error supersedes the in-band
result.
- **Termination-aware disconnects:** connection-loss checks now include
`termination()` and `is_connection_terminated`, so transport or handler
failures (not only clean EOF) are treated as a lost connection.

Disconnect cleanup still uses `on_close` plus driver completion:
`finish_connection` already runs once the driver ends, and `on_close`
stays the ordered barrier for clean EOF.

Release Notes:

- N/A

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: zed-zippy[bot] <234243425+zed-zippy[bot]@users.noreply.github.com>
2026-10-22 12:25:18 +00:00
Arth Srivastava 32558ab9d5 multi_buffer: Fix word diff ranges for collapsed hunks (#65829)
## Summary

Closes #65678.

Collapsed diff hunks can produce invalid word-diff ranges when offsets
calculated against deleted base text are applied to the modified buffer.
When the base and modified text differ in byte length, these offsets can
land inside a multibyte UTF-8 character, violating the boundary
invariant expected by the text rendering system.

The issue occurs because `self.show_deleted_hunks` indicates whether
deleted hunks can be displayed, not whether a particular hunk's deleted
text is currently present in the multibuffer.

This change checks for the corresponding `DiffTransform::DeletedHunk` in
`self.diff_transforms` before including base-side word diffs for a
specific hunk.

## Changes

- Check the per-hunk expansion state before projecting `base_word_diffs`
into multibuffer offsets.
- Preserve deleted-side and modified-side word highlighting for expanded
hunks.
- Avoid emitting base-side word-diff ranges for collapsed hunks, where
the deleted text is not present in the multibuffer.
- Add regression tests in
`crates/multi_buffer/src/multi_buffer_tests.rs` covering:
- `test_word_diff_byte_132_collapsed`: verifies that collapsed hunks do
not emit invalid UTF-8 ranges.
- `test_word_diff_byte_132_expanded`: verifies that expanded hunks
retain deleted-side and modified-side highlighting.
- `test_word_diff_mixed_expanded_and_collapsed`: verifies that expansion
state is handled independently for each hunk.
- `test_word_diff_expanded_cjk`: verifies word-diff highlighting with
multibyte CJK text.

## Testing

- `cargo test -p multi_buffer -j 1 --lib` — 72 passed.
- `cargo test -p multi_buffer -j 1 --lib test_word_diff` — 9 passed.
- `cargo clippy -p multi_buffer -j 1 --lib` — passed with no warnings.
- `cargo check -p multi_buffer -j 1 --tests` — passed.
- `cargo fmt --check -p multi_buffer` — passed.
- `git diff --check` — passed.

### Regression verification

The collapsed-hunk regression test fails against the original
implementation because a generated word-diff range ends at byte 132,
which is not a valid UTF-8 character boundary. It passes with this
change. The expanded and mixed-hunk regression tests also pass.

The complete macOS editor-rendering crash has not been independently
reproduced by an editor-level test; the regression tests verify the
invalid-range condition at the multibuffer layer.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI checklist not applicable; this PR contains no UI changes.
- [x] Tests cover the new or changed behavior.

Release Notes:

- Fixed an issue where collapsed inline diff hunks could produce invalid
word-diff highlights when rendering multibyte UTF-8 text.

---------

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2026-10-22 12:12:21 +00:00
$H!NDGEKYUME 340c703bb2 project_panel: Preserve clipboard contents when duplicating entries (#60894)
# Objective

- Duplicate in the project panel currently overwrites the system
clipboard, and also replaces any pending Copy or Cut in the panel.
- Fixes #60891

## Solution

- Duplicate now copies the selected entries directly through the
project's copy path instead of running Copy then Paste.
- That avoids writing file paths to the system clipboard and leaves the
panel's pending Copy/Cut state alone.
- Copy, Cut, and Paste keep their existing clipboard behavior. Filename
disambiguation, recursive directory copies, undo, selection updates,
auto-open, and the rename editor still go through the shared transfer
path.

## Testing

- Added `test_duplicate_preserves_clipboards`, which checks that
Duplicate leaves the system clipboard unchanged, still copies the
selected entry, does not paste external clipboard paths, and still
honors a pending Cut afterward.
- Ran `cargo test -p project_panel test_duplicate_preserves_clipboards`.
- Existing `test_create_duplicate_items` still covers the
rename-after-duplicate UI.
- Reviewers can reproduce the original bug by copying some text,
duplicating a file or folder in the project panel, then pasting: the
original text should still be there. Copy and Cut should still write
paths to the system clipboard as before.
- The clipboard write is platform-agnostic. I did not do a separate
Windows/Linux UI pass beyond the unit test.

## 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)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

---

Release Notes:

- Fixed duplicating files or folders in the project panel overwriting
clipboard contents.

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
2026-10-22 12:06:55 +00:00
Lukas Wirth 389c22e1c7 gpui: Make Modifiers::secondary web platform aware (#65970)
This introduces a new PlatformInfo abstraction that allows querying a
gpui app's platform from runtime facts.
This is necessary for correctness when dealing with web applications, as
their host platform there is a runtime fact, not a compile time fact.


Release Notes:

- [GPUI] Fixed platform-dependent modifiers and keybinding parsing and
formatting in web applications by querying the host operating system at
runtime.
2026-10-22 11:49:45 +00:00
CoinMan.dev 04470cd9b5 project: Don't send a project update when no worktree was removed (#65189)
## Summary

> Machine translation of my original text (Russian, below):
>
> Zed started to freeze when opening some of the threads created by an
AI agent. After such a thread was opened, the cursor in the message
input started blinking rapidly, everything stopped, and Zed could not be
closed; the only way out was to kill the process. If several Zed windows
were open, all of them froze.
>
> This happened in Zed on Windows with projects in WSL2. Not every
thread in the same project froze, some opened fine, so it was hard to
understand why it was happening.
>
> The investigation was done with the help of an AI (Claude), and it
also prepared this fix. Its conclusions are below.

Original text:

Zed начал зависать при открытии некоторых тредов, которые создаёт
ИИ-агент. После открытия курсор в поле ввода начинал быстро мигать, всё
останавливалось, и закрыть Zed было невозможно — приходилось снимать
задачу. Причём если было открыто несколько окон Zed, зависали все.

Всё это происходило в Zed на Windows с проектами в WSL2. Не все треды в
одном и том же проекте зависали, некоторые открывались нормально, из-за
чего было непонятно, почему это происходит.

Разбор ситуации делался с помощью ИИ (Claude), он же подготовил
исправление. Его выводы ниже.

> **AI-generated (Claude):**
>
> **Cause.** In a remote project the client sends `RemoveWorktree`
whenever it releases a handle to a worktree
(`Project::on_worktree_released`). On the server,
`WorktreeStore::remove_worktree` answered every such request with
`UpdateProject`, even when the worktree was already gone. When the
client handles `UpdateProject`,
`WorktreeStore::set_worktrees_from_proto` re-creates a handle for every
listed worktree it does not hold. A remote client holds invisible
worktrees weakly (`WorktreeStore::remote(false, ..)`), so that handle is
released right away and `RemoveWorktree` is sent again. While the
request that really removes a worktree is still queued behind redundant
ones, every answer lists that worktree again and produces one more
request.
>
> Loading an agent thread triggers this because
`AcpThread::resolve_location` opens the file of every tool-call location
with `Project::open_local_buffer`, which creates an invisible worktree
for a file outside the project. When the buffer cannot be opened (an
image: "Binary files are not supported") the worktree is released at
once. A thread whose tool calls read a couple of dozen screenshots
outside the project releases that many invisible worktrees almost
simultaneously.
>
> **Change.** `remove_worktree` sends the project update only if it
removed a worktree.
>
> **Measurements.** Stock Zed 1.22.0 client (Linux, calls counted with
gdb breakpoints), remote server built from v1.22.0 with and without this
change, loading one thread that creates 21 invisible worktrees:
>
> | | without | with |
> |---|---|---|
> | `UpdateProject` handled by the client | 4,741 | 57 |
> | `Worktree::remote` handles created on the client | 4,702 | 281 |
> | `SettingsStore::clear_local_settings` calls | 9,980 | 645 |
> | UI thread busy after the thread loaded | 112 s | 6 s |
>
> In the captured part of a traced unpatched run, 2,839 of 2,840
`RemoveWorktree` requests removed nothing, and 2,565 of them were for
the same worktree. A second thread (33 tool-call locations outside the
project) went from 54 s to 6 s.
>
> The client still re-creates and drops handles for worktrees listed in
older updates, and `handle_update_project` still recomputes settings for
every listed worktree. Both are bounded now and left for follow-ups.
>
> Possibly related: #65008, #62542 (similar symptoms with WSL remotes
and agent threads). Not verified that this resolves them.

## Testing

> Machine translation of my original text (Russian, below):
>
> I checked it on my machine: Zed 1.22.0 on Windows 11, project in WSL2
(Ubuntu). I replaced the server in `~/.zed_server` with one built from
v1.22.0 with this change. The thread that used to freeze Zed every time
now opens normally.

Original text:

Проверил у себя: Zed 1.22.0 на Windows 11, проект в WSL2 (Ubuntu).
Подставил в `~/.zed_server` сервер, собранный из v1.22.0 с этим
изменением. Тред, который раньше каждый раз вешал Zed, теперь
открывается нормально.

> **AI-generated (Claude):**
>
> - New test
`test_removing_missing_worktree_does_not_send_project_update` in
`remote_editing_tests.rs` fails without the change (`left: 1, right: 0`)
and passes with it.
> - `cargo test -p remote_server --lib`: 57 passed. `cargo clippy -p
project -p remote_server --lib --tests -- -D warnings`: clean.
> - The measurements above were taken on Linux (Ubuntu in WSL2, Xvfb),
with the project opened as an SSH remote through a local stand-in for
`ssh` (client and server on the same machine).
> - In the check on Windows described above, the thread replays 710
messages; Zed's log shows it loaded three times with the patched server
running, and the connection to the server was idle afterwards.
> - To reproduce: open a remote project, let an external agent read
about 20 image files outside the project in one thread, then reopen that
thread.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [ ] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist). (no UI
changes)
- [x] Tests cover the new or changed behavior.

Release Notes:

- Fixed remote projects (SSH, WSL) becoming unresponsive when loading an
agent thread that refers to many files outside the project.

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

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 11:47:56 +00:00
junkmailkeep 03efd49220 ui: Keep project action shortcuts inside their buttons (#65531)
## Summary

This is my first PR; I'm still learning Rust.

- We made long project names show dots at the end when they don't fit,
so the shortcut stays visible.
- We made the shortcut go underneath Open Project when the sidebar is
too narrow, and the button grows so everything fits.
- We added an option for a button to grow to fit its contents, and Open
Project uses it when the shortcut wraps.

AI helped with the code and testing.

Closes #65220.

### Screenshots

Welcome before: Zed 1.23.3. The other screenshots are local development
builds on macOS.

| | Before | After |
| --- | --- | --- |
| Welcome recent project | ![Welcome
before](https://github.com/user-attachments/assets/420e4542-f009-44fc-ba93-f575eae4f1bd)
| ![Welcome
after](https://github.com/user-attachments/assets/9123df5d-9f19-484d-8d68-f8d083d863dd)
|
| Empty Project Panel | ![Project Panel
before](https://github.com/user-attachments/assets/7cbb4016-5d32-4392-879e-7b90df67eab0)
| ![Project Panel
after](https://github.com/user-attachments/assets/a7b060c4-50df-4363-9d1d-f0354bdd24a4)
|

## Testing

- Tested with Codex on macOS 27.0.1 in light and dark themes, using the
default font and Menlo at 16px.
- Clicking and keyboard shortcuts worked. The build, formatting, Zed's
lint checks, and six focused tests passed.
- Linux and Windows still need testing.

To try it:

1. Open a folder with a long name, then a new window. Hover over the
recent project.
2. Set the sidebar to 180px wide, use Menlo at 16px, and bind Ctrl-K
Ctrl-O to Open Project. Hover over the button and check that both lines
fit.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- Fixed long recent project names and the Open Project shortcut
overflowing on the Welcome screen and in narrow panels.

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
2026-10-22 10:18:22 +00:00
Ben Brandt 6744a21e2d agent_servers: Route ACP subagent associations to child threads (#65976)
ACP agents announce subagent sessions with `subagent_update` on the
parent's stream. Zed dropped these: v2 left them unhandled and v1
ignored them. On v2, where subagent support is part of the baseline and
only negotiated with `acp-beta`, a subagent's updates were discarded and
its permission requests failed with "unknown session".

- **Routing.** The first `subagent_update` for a session creates an
agent-owned child `AcpThread` (no prompting, no working directories,
action log linked to the parent's, as native subagents do), registers it
for routing on the connection, and hands it to the parent's subagent
registry. The child's own updates, permission, elicitation, fs and
terminal requests then reach it. One helper, `apply_subagent_update`,
serves v1 and v2.
- **Association.** Title, description and cancel capability are stored
on the child (`acp_thread::subagents::SubagentAssociation`) with the
RFD's patch semantics: omitted is unchanged, `null` clears, capabilities
are replaced whole. A session ID the parent does not already own is
rejected if the connection routes it, so an update cannot reparent a
session, refer to the parent itself, or form a cycle.
- **Activity.** On v2 the subagent's own `state_update` drives its
activity and the parent's mirrored copy is ignored. On v1 the
association's state snapshot is the only source, and `null` leaves
activity unconfirmed.
- **v1 stays off.** v1 applies `subagent_update` only if Zed advertised
the `subagents` client capability, decided from the same
`client_capabilities_for_agent` value it sends. Zed does not advertise
it yet (a test guards that), so v1 behavior is unchanged; a later PR
offers it behind `acp-beta`.
- **No closing subagents.** Releasing a child never sends
`session/close`, and v2's `close_session` refuses ACP subagents; the
agent releases them with their parent.
- **UI.** A subagent's permission card in the parent labels it with the
parent's title for it, then its own title. Inline subagent cards and
navigation into subagent threads come in a later PR, so today the
visible change on v2 is that subagent permission requests appear in the
parent and can be answered.

Release Notes:

- N/A
2026-10-22 10:15:28 +00:00
Kirill Bulatov 9b9e7b814a xtask: Forbid legacy Objective-C dependencies (#65935)
Reject objc, cocoa, and related legacy wrappers in workspace packages
and unused workspace dependency declarations.

Cover aliases, optional and target-specific dependencies, build and dev
dependencies, and permitted objc2 replacements.

Release Notes:

- N/A
2026-10-22 09:30:27 +00:00
Kirill Bulatov 2d6c664dc2 gpui_macos: Cache the main-thread marker per thread (#65934)
Reuse a thread-local `Option<MainThreadMarker>` for platform creation,
display queries, and display-link assertions.

Preserve background-thread rejection and cache both successful and
unsuccessful checks.

An instrumented standalone check observed one pthread_main_np call per
thread across repeated main-thread and worker-thread lookups; the
uncached implementation failed with 1000 calls.

Release Notes:

- [GPUI] Cache macOS main-thread checks per thread.
2026-10-22 09:30:26 +00:00
Kirill Bulatov 5d47f83542 Allow opening README files by default (#65389)
Closes https://github.com/zed-industries/zed/discussions/38228


https://github.com/user-attachments/assets/4f80a4a8-8e4a-499b-b51f-4d389fe1f781

Release Notes:

- Added a way to open README files by default, use `"on_new_window":
"readme",` to configure
2026-10-22 09:26:30 +00:00
Kirill Bulatov b7d50b95e8 Warn only for explicitly requested fonts (#65968)
Follow-up to https://github.com/zed-industries/zed/pull/65852

Release Notes:

- [GPUI] N/A
2026-10-22 09:11:13 +00:00
Kirill Bulatov 10cfb45944 gpui_macos: Migrate window and appearance bindings to objc2 (#65933)
Migrate window classes, callbacks, native geometry, ownership, and
appearance handling to objc2.

Remove the temporary legacy adapters and the now-unused objc and cocoa
dependencies.

Release Notes:

- [GPUI] Migrate macOS window and appearance bindings to objc2
2026-10-22 09:11:07 +00:00
Som faf8f0b698 language_models: Log and record model-fetch failures instead of discarding them (#64171)
# Objective

Addresses part of #58102.

When a model list fetch fails (e.g., due to an invalid or expired API
key), Zed currently swallows the error without logging it anywhere.

Root cause: Across six provider implementations (anthropic, ollama,
lmstudio, llama_cpp, open_router, and vercel_ai_gateway),
restart_fetch_models_task stores the fetch Task in a struct field but
never inspects its Result. Whenever a new fetch is triggered, .replace()
simply drops the previous task and silently discards whatever error
occurred.

## Solution

Added `last_fetch_models_error: Option<String>` to each provider struct
to track the failure. In `restart_fetch_models_task`, the fetch is now
wrapped in an outer task that logs the failure via
`util::ResultExt::log_err()` and updates that field. Wrapping the task
rather than calling `.detach_and_log_err()` keeps task cancellation
intact: dropping the outer task when a new fetch starts still cancels
the in-flight request, as expected.

`fetch_models` itself is unchanged, since callers like `authenticate` in
`lmstudio.rs` and `llama_cpp.rs` match directly on its `Result`.

This PR is deliberately limited to logging and recording the error.
Surfacing it in the UI would be better tackled in a dedicated follow-up.
That keeps this PR focused on the backend plumbing across the six
providers.

## Testing

Added `restart_fetch_models_task_records_error_on_failure` across all
six providers, using `FakeHttpClient` to confirm
`last_fetch_models_error` gets populated on failure. Added
`restart_fetch_models_task_cancels_the_previous_fetch` to `anthropic.rs`
(using channel-gated fake responses) to verify that an in-flight request
is cancelled and cannot overwrite a newer fetch.

All checks pass cleanly: `cargo test -p language_models` (97 passed),
`cargo clippy -p language_models -- -D warnings`, and `cargo fmt --check
-p language_models`.

UI testing: N/A (no UI changes in this PR; all verification is
headless).

## Self-Review Checklist

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [ ] The content adheres to Zed's UI standards (n/a — no UI changes)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable (single
Option<String> per provider, zero happy-path allocation overhead)

---

Release Notes:

- Fixed: failed model list fetches (such as from invalid or expired API
keys) are now logged and recorded instead of silently dropped across
Anthropic, Ollama, LM Studio, llama.cpp, OpenRouter, and Vercel AI
Gateway.

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
2026-10-22 08:51:10 +00:00
Kirill Bulatov d86aa6e6b9 gpui_macos: Migrate application and menu bindings to objc2 (#65932)
Migrate application delegates, menus, platform services, and retained
AppKit objects while preserving checked ivar access.

Kept legacy window string allocation and an appearance pointer cast
until the window migration (next PR).

Release Notes:

- [GPUI] Migrate macOS application and menu bindings to objc2

---------

Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
2026-10-22 08:26:45 +00:00
Kirill Bulatov 3389d87577 Cache resolved fonts (#65852)
Closes https://github.com/zed-industries/zed/issues/65777

Release Notes:

- [GPUI] Fixed font lookup causing performance issues
2026-10-22 08:04:55 +00:00
Matheus Laurindo 0eb085876e Use recent commits to improve message generation (#61528)
## Summary

Commit message generation now includes the three most recent repository
commit messages as style examples alongside the diff.

## Problem

The generator previously had no visibility into the repository's recent
commit conventions. As a result, generated messages could drift from the
project's established style, including its use of scopes, bodies, and
release-note sections.

## Benefits

- Keeps generated commit messages aligned with the repository's current
conventions.
- Preserves full recent commit messages so the model can learn both
subject and body formatting.
- Handles repositories with fewer than three commits or unavailable
history without blocking generation.
- Starts history lookups alongside diff collection to avoid adding
unnecessary serial latency.

## Testing

- `git diff --check` passed.
- `cargo test -p git_ui test_commit_message_prompt --lib` could not run
because `cargo` is not installed in the environment.
- `cargo fmt --all -- --check` and `./script/clippy -p git_ui` could not
run for the same environment limitation.

Release Notes:

- Improved AI commit message generation by using recent repository
commit history for style consistency. Last 3 commit messages are now
sent out to the message-generating model as reference for style.

---------

Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
Co-authored-by: zed-zippy[bot] <234243425+zed-zippy[bot]@users.noreply.github.com>
2026-10-22 07:43:35 +00:00
Rajat Patra 0a39cdb4f3 gpui: Fix window_positioning example on non-primary displays (#65917)
## Summary

The `window_positioning` example opens nine popups on each display, but
five of them (Top Left, Top Center, Left Center, Right Center and Bottom
Center) work out their position from `(0, 0)` or from the display's size
instead of from the display's bounds. That works on the primary display,
but on any other display those spots end up off the display. On Windows,
gpui then falls back to the default bounds, so those popups open
display-sized instead of where they should be.

This changes those five to use `screen.bounds()` (`origin`, `left()`,
`right()`, `top()`, `bottom()`), like the other four already do. Only
the example is changed.

Screenshots of both displays, primary on the left. Both builds have
#65002 applied, since without it the popups on the 100% display come out
the wrong size, which gets in the way of the comparison.

**Before**

<img width="1000" alt="zed-window-positioning-before"
src="https://github.com/user-attachments/assets/4707993d-efb9-4d15-95ac-8433c61d4a0f"
/>

**After**

<img width="1000" alt="zed-window-positioning-after"
src="https://github.com/user-attachments/assets/ebbaea7c-ef82-4512-9522-921e9fe5fd99"
/>

In the before shot the second display is mostly black because Right
Center opened display-sized on top of the others. Its label shows it
asked for `940, 412.5` and got `2560, -4` at 1440x900.

## Testing

Windows 11 (build 26300), a 2560x1600 primary display at 150% and a
1440x900 display at 100% to its right. I ran the example before and
after and checked where each popup ended up on its display:

- Displays aligned at the top: 6 of 9 popups in place on the second
display before, 9 of 9 after.
- Second display moved 696px down: 4 of 9 before (and Bottom Center sits
partly above the display), 9 of 9 after.
- Primary display: 9 of 9 in every run.

`cargo fmt` and `cargo clippy -p gpui --example window_positioning --
--deny warnings` pass. I haven't tried macOS or Linux, but nothing in
the change is platform-specific.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist). (No UI
changes in Zed, only a gpui example.)
- [ ] Tests cover the new or changed behavior. (The examples have no
automated tests. I tested it by hand on two displays, see Testing.)

I used Claude to help investigate this and write the change. I've
reviewed it and understand it.

Release Notes:

- [GPUI] N/A
2026-10-22 07:18:46 +00:00
Anthony Eid 87c92e8c09 Add .agents folder to .gitignore (#57857)
This PR adds .agents to zed's .gitignore file to allow people to have to
have local only skills

We can still manually add skills to Zed when people want to share them.
This should make it easier for people have their own custom skills while
still being able to run `git add .`

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 is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A

---------

Co-authored-by: MrSubidubi <finn@zed.dev>
2026-10-22 05:59:32 +00:00
John D. Swanson 130f1e92a4 Update dependencies to address security vulnerabilities (#65956)
## Summary

Update Zed's TLS certificate dependencies, managed Node runtime, and
Wasmtime stack to address the eMudhra intermediate compromise and recent
Wasmtime sandbox vulnerabilities.

- Update `rustls-webpki` to 0.103.16, `webpki-roots` to 1.0.10 and its
legacy wrapper to 0.26.11, and `webpki-root-certs` to 1.0.10. SQLx's
legacy wrapper resolves to the patched 1.0.10 root data.
- Update managed Node from 24.21.0 to 24.22.1.
- Update Wasmtime, WASI, and Tree-sitter's Wasmtime C API from 48.0.1 to
48.0.7, with aligned Cranelift 0.135.7 and required Wasm tooling
patches. Keep the existing Wasmtime feature set.

## Testing

Local platform: macOS arm64, Rust 1.98.1.

- `cargo build --locked -p zed --bin zed`: passed. Launched the new
binary with isolated user data and a temporary Rust file; the process
remained running. A user-provided screenshot confirms `app-smoke.rs`
opened and rendered with Rust syntax highlighting. Interactive GUI
checks were not completed: the UI automation tool failed to initialize
and macOS denied the Apple Events fallback. This PR remains a draft for
human review and any further manual validation.
- `ZED_HEADLESS=1 cargo test --locked -p extension_host -p node_runtime
-p reqwest_client --lib`: passed. The extension-host integration test
builds, installs, and runs the real test extension, including
relative/absolute filesystem operations and process execution.

```text
extension_host: 46 passed; 0 failed
node_runtime:   24 passed; 0 failed
reqwest_client:  4 passed; 0 failed
```

- `cargo check --locked -p extension_host -p extension_cli -p language`,
`./script/clippy --locked -p node_runtime -p reqwest_client`,
formatting, and diff whitespace checks passed. The lint wrapper's
optional cargo-shear/typos/buf checks were not run because cargo-shear
was unavailable.
- Isolated native aarch64 checks passed: oversized branch tables
rejected at 65,521 and 262,146 targets; a table at the supported 65,520
limit executes correctly; component instantiation and the pinned
Tree-sitter C API WasmStore work. WASI read/write/rename and internal
symlinks work with Zed's dual ReadWrite preopens; the trailing-slash
outside symlink rename and parent traversal are rejected without
modifying the outside sentinel.
- Isolated TLS checks passed: WebPKI 0.103.16 rejects all 12 captured
incident certificate chains with `CertDistrusted`, including when
supplied the old roots. The patched root bundles omit the affected root.
The official native Node archive matches its published SHA-256; Node
rejects all 12 incident hosts with `CERT_REVOKED` and accepts an
ordinary verified TLS control request.
- The standalone probes are local validation artifacts, not added
repository tests. Reviewers can rerun the Cargo commands above; for
manual validation, launch the build, open a source file, and install/run
a Wasm extension and a Wasm grammar. Linux/Windows runtime testing and a
full workspace test run were not performed. The debug app build emits a
large unwind-table linker warning and a future-compatibility warning for
`block`.

## Self-review

The dependency diff was reviewed for scope, version alignment, feature
changes, and sandbox compatibility. Two incidental dependency-link
changes selected by Cargo were removed; only the intended security
updates remain. README's review notice is retained because repository
rules reserve its removal for the human author.

- [x] I've reviewed my diff for quality, security, reliability, and
performance. (Human author review pending.)
- [ ] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist). (N/A; no UI
changes.) N/A
- [x] Tests cover the new or changed behavior.

## Suggested .rules additions

When checking a Cargo.lock update for scope, compare dependency lists
for packages whose own versions did not change; Cargo can reselect their
already-locked transitive versions.

Release Notes:

- Updated dependencies to address recent software ecosystem
vulnerabilities.
2026-10-22 04:43:07 +00:00
Anthony Eid b488c4e814 gpui: Update Taffy 0.13 to 0.15 (#65950)
Updates Taffy from 0.13 to 0.15. Upstream reports roughly 60% faster
grid layout and 15% faster flexbox layout, alongside layout caching
improvements and fixes to sizing, alignment, and absolute positioning.
This adapts GPUI to the updated measurement and alignment APIs while
retaining its explicit relative-positioning default; performance
improvements have not been benchmarked in Zed.

Validation: All 469 existing GPUI library tests passed with `corgi test
-p gpui --lib -F gpui_platform/runtime_shaders`; formatting and diff
checks passed. Runtime shaders were enabled to bypass a local Metal
compiler failure.

Release Notes:

- [Gpui] Update taffy version
2026-10-22 03:54:16 +00:00
Jakub Konka 544780422a Add an HTTP fallback for the Ubuntu toolchain PPA (#65944)
## Summary

Add an HTTP fallback for the Ubuntu toolchain PPA used by `script/linux`
on Ubuntu 20.04.

The [Linux ARM64 release
job](https://github.com/zed-industries/zed/actions/runs/39623264964/job/119388744726)
failed because Launchpad's HTTPS frontend returned HTTP 503 for package
downloads. The official HTTP endpoints served the same packages
successfully.

Use APT's native `mirror+file` transport with explicit priorities:
prefer Canonical's HTTPS endpoint, and use Canonical's HTTP endpoint
only when a fetch fails. This handles both repository indexes and
package archives without custom retry logic. Other repositories and
distro setup paths are unchanged.

## Security tradeoff

This is an accepted availability workaround, not a security-equivalent
replacement for HTTPS. The signing key is still fetched over HTTPS, and
APT signature and package-hash verification remain enabled. HTTP
fallback permits network observers to see requests and attackers to
replay or freeze previously signed repository contents. This PPA has no
`Valid-Until` field. It does not permit arbitrary package modification
without a verification failure.

## Testing

- `bash -n script/linux` — passed.
- `nix shell nixpkgs#shellcheck -c ./script/shellcheck-scripts error` —
passed.
- Temporary integration harness using Ubuntu 20.04 / APT 2.0.10 and a
signed local repository, exercising the mirror-generation commands
extracted from `script/linux`:
  - Healthy HTTPS serves all requests without contacting HTTP.
  - HTTP 503 on the primary repository index falls back successfully.
- HTTP 503 on a package download falls back successfully, even after
indexes were fetched over HTTPS.
  - Both endpoints failing produces a nonzero exit.
  - Tampered signed metadata is rejected.
  - Tampered package contents are rejected.
- Downloaded all seven failing ARM64 packages across Canonical's
official HTTP endpoints and verified their hashes against repository
metadata; verified the signed `InRelease` and package-index hash.
- No full dependency installation or CI rerun performed. The temporary
integration harness is not committed.

Release Notes:

- N/A
2026-10-21 19:29:22 +00:00
Ryan Brue 42c4caa474 remote: Stop URL-encoding SSH usernames (#64744)
The username was percent-encoded when building the SSH destination, a
leftover from when the destination was an `ssh://` URL (#25314). Since
the destination is now passed as a plain argument, the encoding turned
domain usernames like `DOMAIN\user` into `DOMAIN%5Cuser`, and
authentication failed.

Pass the username verbatim instead. So that a username beginning with
`-` can't be parsed as an option, `ssh` now receives it via `-l
<username> -- <host>` rather than a `username@host` string, and
`scp`/`sftp` (which have no username option, and forward it to `ssh` via
`-l` themselves) get `--` before their operands. Options that used to
follow the destination (`-T`, and `-t` for the Windows master process)
are moved before `--` so they aren't sent as part of the remote command.

Fixes #63709
Closes #63722

Assisted-by: LLM

NOTE: This is a continuation of #63722. I chose to leave Shaik Shahid
Afridi as the primary author, because I'm just resolving the review
comments from that PR.

In responding to the review comments, we also improve SSH/SCP for
usernames starting with `-`, because we now use `-l` for SSH and `--`
for SFTP/SCP, though I'm not sure if OpenSSH would accept a username
starting with `-` anyways. Nevertheless, an improvement over what came
before.

# Objective

When attempting to connect to a remote with a backslash in the username
(or any other character that results in URL encoding), Zed would mangle
the resulting SSH command and the remote would not be usable.

## Solution

- Describe the solution used to achieve the objective above.
URL encoding in the SSH field is an artifact of when `ssh://` was used,
and is no longer needed.

## Testing

Tested by running Zed and attempting to connect to a remote with a
backslash in the user field (a Windows domain account). SSH succeeded,
but then I ran into a separate bug with `%PROCESSOR_ARCHITECTURE%` not
being expanded. I'll be looking into that in a separate PR.

```sh
2026-09-24T16:09:24-05:00 INFO  [remote::transport::ssh] Remote is windows: true
2026-09-24T16:09:38-05:00 ERROR [remote::transport] $SHELL is not set, falling back to cmd.exe
2026-09-24T16:09:38-05:00 INFO  [remote::transport::ssh] Remote shell discovered: cmd.exe
2026-09-24T16:09:39-05:00 ERROR [workspace::notifications] Prebuilt remote servers are not yet available for windows-%PROCESSOR_ARCHITECTURE%. See https://zed.dev/docs/remote-development
```

Tested on Linux x86_64, attempting to connect to a Windows x86_64
machine.

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments **(N/A)**
- [ ] 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) **(N/A)**
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

## Showcase

**NOTE:** I mentioned it above, but just in case it was missed, there is
a separate bug with Zed not expanding `%PROCESSOR_ARCHITECTURE%`. I'll
probably look into that next, since I'm trying to get remote development
set up for my Windows machine.


[Screencast_20260924_160804.webm](https://github.com/user-attachments/assets/ce6c77fb-eea5-4cda-944e-50539bece61d)

---

Release Notes:

- Fixed an issue where SSH usernames containing `/` or `\` were
percent-encoded, preventing successful connections.

Co-authored-by: Shaik Shahid Afridi <81465960+Yooosless@users.noreply.github.com>
Co-authored-by: Kirill Bulatov <kirill@zed.dev>
2026-10-21 19:10:22 +00:00
Ben Kunkle 63089a6ebe worktree: Clean up watches when symlinks disappear during scanning (#65939)
## Summary

Fix a watch leak introduced by #61372: deleting an external symlink
between watch registration and directory enumeration left its canonical
target watched.

Record cleanup and event-path mappings when establishing the watch,
before enumeration can fail. Add a deterministic FakeFs regression.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- N/A
2026-10-21 18:42:55 +00:00
Shuhei Kadowaki cb593458e1 project: Match document filter patterns in dynamic registrations (#65252)
## Summary

Follow-up to #59243, which made dynamically registered capabilities
honor the `language` and `scheme` of their document selectors, but left
`pattern` matching fail-open. A registration such as `{ "language":
"toml", "pattern": "**/Project.toml" }` therefore still applied to every
TOML document the server had opened, and a pattern-only filter applied
to every document.

This matches `pattern` against the document's path:

- String patterns are matched against the absolute path. As in the LSP
glob syntax, `*` and `?` do not match path separators.
- Relative patterns are matched against the path relative to their base
URI, and Zed now advertises the
`textDocument.filters.relativePatternSupport` client capability.
- Documents without a file system path never match a `pattern` filter.
Contexts that stand for a whole language, like the semantic token legend
lookup, and guest buffers whose path is unknown keep not evaluating
patterns.
- Registrations whose patterns are not valid globs are rejected when
they are registered.

LSP 3.18 changed `TextDocumentFilter.pattern` from a string to a
`GlobPattern`, so that it can also be a relative pattern. ~~This PR
depends on zed-industries/lsp-types#16, which updates the type and adds
the client capability. I'd like to merge this together with that
upstream change: `Cargo.toml` currently points at the commit of
zed-industries/lsp-types#16 on my fork, and I will switch it to the
`zed-industries/lsp-types` revision once that PR is merged.~~

**Update:** zed-industries/lsp-types#16 has been merged, and
`Cargo.toml` now points at its `zed-industries/lsp-types` revision
(zed-industries/lsp-types@82d7fc66eb).

## Testing

- Added unit tests for matching string patterns, wildcards across path
separators, and relative patterns.
- Added an integration test that a pattern-scoped completion
registration only applies to matching buffers, and that a registration
with an invalid pattern is rejected.
- Updated
`test_dynamic_formatting_registration_with_pattern_only_selector`, which
asserted the fail-open behavior left by #59243.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- Fixed language servers' dynamically registered capabilities applying
to files outside of the `pattern` of their document selector.

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 17:41:09 +00:00
Finn Evers 59dd60d4dd Refactor ExtensionLanguageProxy to provide only ExtensionLanguageProxy::update_languages (#65381)
## Summary

Further preparation for https://github.com/zed-industries/zed/pull/65047
- this PR changes the trait so thar we now register and unregister
languages through a single call into the trait.

This allows us to easier manage state depending on this - we previously
always removed and readded everything, with this now in place, we
instead get a diff that let's us know what changed and thus needs
updating. That will be used in the linked PR as well.

## Testing

Added some tests (actually most of the diff), other behavior is still
the same, and also gave it a manual test run. Tests caugtht some edge
cases with token rules previously unhandled which this PR now also takes
care of.

## Self-review

- [X] I've reviewed my diff for quality, security, reliability, and
performance.
- [N/A] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [X] Tests cover the new or changed behavior.

Release Notes:

- N/A

---------

Co-authored-by: zed-zippy[bot] <234243425+zed-zippy[bot]@users.noreply.github.com>
2026-10-21 16:49:51 +00:00
Lena cd1255fba1 Automate cleanup of non-responsive PRs (#65930)
Ping and (after a grace period) close the stale community PRs where
changes were requested but not addressed.
Ping and (after a grace period) close the community PRs with no
self-review.

## Testing

Ran the dry-run locally and verified every PR listed.

Release Notes:

- N/A
2026-10-21 16:33:41 +00:00
Matei Oprea 2afec34882 Prevent existing tabs on move from emitting AddItem on reordering (#65795)
## Summary

Moving a pane shouldn't issue a `AddItem` trigger event on pane's
`add_item_inner` function. Treating tab reordering as a new event would
cause listeners like markdown auto preview mode to be triggered (if
enabled) as well which will activate preview mode even if we're
currently in edit mode for a markdown file.

Closes #65545 

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [ ] Tests cover the new or changed behavior.

Release Notes:

- Fixed reordering a markdown editor tab switching back to markdown
preview when "open markdown files in preview" is enabled
2026-10-21 15:37:49 +00:00
Jacob Wolf d27ad54dd6 Fix on-type formatting using a stale position when autoindent is pending (#65769)
## Summary
Sister to Shopify/ruby-lsp#4242.

Pressing Enter triggers `textDocument/onTypeFormatting` from inside the
newline transaction, before autoindent has been applied. The request
position was converted to a point at that moment, so language servers
received column 0 of the new line even though the cursor ends up at the
indented column. The left-biased cursor pins from #61823 were captured
at the same moment, so the autoindent whitespace prevented them from
being restored.

With Ruby LSP this inserted `end` in front of the body's indentation and
left the cursor after `end`. That is why the Ruby extension disables
on-type formatting (zed-extensions/ruby#38).

This PR:
- Resolves the on-type formatting position after pending autoindent is
applied.
- Capture the cursor pins after pending autoindent is applied.

## Testing

- `cargo test -p editor --lib on_type_format` (7 passed; the 2 new tests
fail on `main`)
- `cargo test -p collab --features test-support --test collab_tests
on_input_format` (2 passed)
- `./script/clippy -p editor -p project`
- Manually with Ruby LSP: `def foo⏎`, `do |x|⏎`, heredocs, `do |` and
`"#{`

### Proof


https://github.com/user-attachments/assets/43ff3307-4bd7-43f5-a65d-d18eca0b5d2a

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

## References

- zed-extensions/ruby#38
- Follow-up to #61823

## Suggested .rules additions

For `crates/editor/.rules`: code that runs inside `Editor::transact`
(for example from `newline`) sees the buffer before autoindent is
applied. Wait for `Buffer::wait_for_autoindent_applied()` before reading
cursor positions or anchoring to them.

Release Notes:

- Fixed on-type formatting after pressing Enter being applied before the
new line's indentation, which left the cursor after text inserted by
language servers such as Ruby LSP.
2026-10-21 15:37:45 +00:00
John Yani f41ac64812 agent: Parse thread markdown lazily, on first render (#65470)
## Summary

Opening an agent thread previously materialized parsed Markdown for
message and tool-output blocks before those blocks were laid out,
including blocks far off-screen.
Parsed Markdown can retain events, per-code-block syntax highlights, and
rasterized Mermaid diagrams.

The original debug-build profiling with two large threads open
attributed approximately 295 MiB to `markdown`, with individual
assistant or tool blocks accounting for tens of MiB.
The profiling figures below are from the original measurements and were
not rerun during the final review.

The thread view uses a virtualized `gpui::list` (`ListState`), but
layout also includes overdraw and can include focused off-screen rows.
Previously, parsing started at entity creation in `acp_thread`,
independently of list layout.

With `MarkdownOptions::defer_parsing`, `Markdown` records the source
without parsing until one of these occurs:

- `MarkdownElement::request_layout` lays out the block.
- `Markdown::ensure_parsed(cx)` is called explicitly.

While deferred, source updates through `append` and `reset` do not start
parsing.
Once parsing starts, later source updates parse normally, including when
the block is off-screen.
This is one-time lazy activation, not eviction of previously parsed
blocks.

`acp_thread` enables deferral for message content created through
`ContentBlock::create_markdown`, including assistant and tool messages
and compaction summaries, and for tool-call raw input and output.
Tool-call labels and error text remain eager.

The numbered `read_file` output bypasses `MarkdownElement` to draw its
own gutter.
Its `RenderOnce` component now calls `ensure_parsed` before reading the
code-block language for highlighting.
Raw source remains available before parsing for search, copy/export, and
content-visibility checks.

Restoring a thread applies its saved scroll position before deferred
Markdown has finished measuring.
`ListState::set_item_measurement_readiness` lets the thread report
pending Markdown parsing and Mermaid rendering, including compaction
summaries and errors.
The list preserves scroll intent while measurements remain provisional.
Leading overdraw stops at the first unready preceding row rather than
traversing the entire zero-height prefix.
Search autoscroll also waits for parsing and Mermaid rendering to
finish.

## Original memory measurements

The original before/after heap profiles used uncapped dumps of the same
view: two large threads and one expanded tool card.

|                                          |    Before |     After |
| ---------------------------------------- | --------: | --------: |
| `markdown` category                      | 273.7 MiB | 109.5 MiB |
| Parsed events (`start_background_parse`) | 213.0 MiB |  11.0 MiB |

Deferred blocks that have not been laid out or explicitly activated do
not retain a parsed representation.
Raw source remains available, and blocks that have already been parsed
are not evicted merely because they leave the viewport.

Companion PR: #65444.

## Testing

- Agent UI library suite: 519 passed.
- Three scroll-restoration regressions across 20 scheduler seeds each:
60 successful runs.
- GPUI list tests: 36 passed.
- Focused Markdown/Mermaid tests: 21 passed.
- ACP compaction regression: passed.
- Five regression assertions fail with the corresponding fixes removed.
- Two adapted controls fail on main with production code unchanged.
- Scoped `rustfmt` and `git diff --check` passed.

Validation used isolated Cargo build artifacts and `INPUTRC=/dev/null`
for the agent-UI suite.
Interactive visual behavior was not manually validated during this
review.

Release Notes:

- Improved agent panel memory usage by parsing thread message Markdown
on first layout instead of at thread load.
- [GPUI] Added `ListState::set_item_measurement_readiness` to preserve
scroll intent while asynchronously measured list items settle.

---------

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2026-10-21 15:37:41 +00:00
John Yani 9e65fc7682 agent: Materialize tool-call diffs lazily, on first view (#65444)
## Summary

Restoring a thread materialized the diff of every edit in its history,
whether or not the card had ever been shown. On long, tool-heavy threads
that meant multi-GiB memory spikes just from opening a thread.

Two eager paths on restore:

- `EntryViewState::sync_entry` built a diff `Editor` and a
`TerminalView` for every tool call in the history.
- `acp_thread::Diff::finalized` created a `Buffer::local(new_text)`
holding the whole post-edit file, set the language from the file path,
and awaited `parsing_idle()`, retaining the parsed buffer in
`FinalizedDiff`.

Profiling a real 44-thread store (debug build, isolated `LD_PRELOAD`
heap profiler instrumenting only the `zed` process) attributed ~1.26 GiB
to tree-sitter syntax trees and ~3.0 GiB anon to opening a thread, with
the dominant stacks under `Buffer::reparse` /
`SyntaxSnapshot::reparse_with_ranges` reached from `Diff::finalized`.
The diff-editor and terminal widgets were a negligible part of it.

Diffs are now built on first view:

- `EntryViewState::sync_entry` no longer builds diff and terminal
content views for tool calls whose content is not visible. The
history-restore loop calls `sync_entry_initial`, and expanding a card
re-syncs that entry to build its views.
- `acp_thread::Diff::finalized` stores only the diff source (`path`,
`old_text`, `new_text`). The buffer, rope, multibuffer and tree-sitter
parse are built by `Diff::resolve`, called from
`AcpThread::resolve_tool_call_diffs(index, cx)` when the card first
becomes visible. `resolve` is idempotent, and the accessors reachable
before resolution (`to_markdown`, `has_revealed_range`) handle the
unresolved case.

Same isolated profile, same 44 threads, `MPROF_MIN=4096
MPROF_SAMPLE=64`:

| | before | after |
|---|---:|---:|
| `Pss_Anon` after load | ~3.0 GiB | 478 MiB |
| `Rss` | 3.4 GiB | 997 MiB |
| tracked live heap (est.) | 1933.6 MiB | 184.7 MiB |
| syntax / tree-sitter | 1262.8 MiB | 7.1 MiB |

Opening a second thread kept tree-sitter at ~6 MiB, and expanding one
card built only the diff for that card (~12 MiB), so the work is now
proportional to what is shown.

Companion PR: #65470 parses thread markdown lazily, on first render.
With both changes the same profile goes from 3003 to 1199 MiB `VmRSS`,
and anonymous memory from 2724 to 934 MiB.

![Agent-panel resident memory: vanilla vs patched
Zed](https://raw.githubusercontent.com/Vanuan/zed/assets/mem-plot/mem-compare-2.png)

Still eager on restore, and left for follow-ups: markdown parsing of
assistant messages (~245 MiB over two threads), `serde_json` deserialize
and `Value::clone` of the thread payload (~276 MiB), mermaid
rasterization (~59 MiB), and the same lazy treatment for `DiffPatch`
hunks.

Related reports: #65465, #62133, #63720, #59402, #60793, #57478, #57126,
#61026, #50889.

## Testing

- `cargo check -p agent_ui`
- `cargo test -p acp_thread`
- `cargo test -p agent_ui`

Release Notes:

- Improved memory usage in the agent panel: tool-call diffs are built
and parsed only when a card is first viewed, instead of for every edit
in a thread's history.

---------

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
2026-10-21 15:37:38 +00:00
Hikari Hayashi 3dbf6a8101 Fix npm-backed language server setup in pnpm and Yarn projects (#65280)
## Summary

Give directory-less npm commands a Zed-owned working directory and
explicit prefix, preventing project devEngines requirements from
blocking language server package queries. Apply the directory
consistently to managed and system runtimes while preserving explicit
install targets.

Cover command construction, child working directories, and propagation
of directory-creation errors for both runtimes.

Fixes #65279

## Testing

Tested locally and confirmed language server setup works in Yarn and
pnpm projects.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- Fixed language server setup failing with `EBADDEVENGINES` in Yarn and
pnpm projects.

---------

Co-authored-by: Codex <noreply@openai.com>
2026-10-21 15:37:34 +00:00
Shuhei Kadowaki 1563b405f9 project: Honor document selectors of didChange and didSave registrations (#65253)
## Summary

#59243 made dynamically registered capabilities honor their document
selectors, but `textDocument/didChange` and `textDocument/didSave`
registrations still overwrote the server-wide sync options and ignored
their selectors, while `didSave` was sent for every saved file of the
worktree to every server whose options asked for saves.

These registrations are now kept per registration, with their selectors:

- The sync kind of a document's changes and whether its saves are
notified, with or without text, come from the latest registration
matching the document, falling back to the static options.
- The merged capabilities keep mirroring the latest registrations, and
unregistering now restores the static options instead of clearing them.
- A `didSave` registration without options is now honored instead of
ignored.

Static save options now only cover the documents a server was opened
with, as they apply to the documents the client selects for the server,
while `didSave` registrations may select any document of the worktree.
Registrations without a selector stand for the same documents as the
static options. This removes the broadcast of every save to every
server, which rust-analyzer no longer needs to pick up manifest changes
in Zed: with dynamic registration it declares no static save options,
and registers `didSave` for `**/*.rs` and `**/Cargo.toml` to reload its
workspace when a manifest is saved. Manifest saves keep reaching it
either way: while `pattern` matching remains fail-open, its filters
match every document, and once #65252 lands they select exactly these
files.

Documents without a language no longer match every registration, and
only match filters without a `language`.

## Testing

- Added integration tests that `didChange` and `didSave` registrations
only apply to documents matching their selectors, fall back to the
static options otherwise, and restore them when unregistered.
- Added an integration test that static save options and registrations
without a selector do not cover documents not opened in the server, that
a `language` filter does not select a document without a language, and
that a registration can select such a document.
- Updated `test_managing_language_servers`, which asserted that saving a
file notifies every server of the worktree.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- Fixed language servers receiving change and save notifications that do
not follow their dynamic registrations, including save notifications for
unrelated files of the project.

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 15:37:30 +00:00
Zach August 11262f9256 project_panel: Explain when a move fails because the destination already exists (#64344)
# Objective

- Fixes #64128 dragging a file onto a folder that already contains a
file with the same name showed only Error: renaming "/a/1.json into
"1.json". The reason why was buried inside the error because the pop-up
prints only the outermost layer.

## Solution

undo.rs: 
-Extracted the existing already_exists check into a module level
pub(crate) function which walks the error chain for
io::ErrorKind::AlreadyExists with a fallback that looks for the text
"already exists." Undo's rename now calls that function so it behaves
exactly like before.
- Made project_path_display() a pub(crate) fn so the project panel can
format names the same way undo does.

project_panel.rs:
- move_worktree_entry() now hands back the destination path along with
the rename task instead of discarding it.
- drag_onto() builds (from, to) names from old_paths and the returned
destination. This hapens while the project can still be read and before
anything moves.
- explain_move_error(err, names) -> anyhow::Error when names are
available and the error is "already exists," it adds the clear message
with err.context(...), otherwise it returns the error unchanged.
- drag_onto() - both result loops (normal and folded folders) - each now
destructures three items and calls .map_err(|err|
explain_move_error(err, names.as_ref()) just before
.notify_workspace_async_err()

## Testing

- (#[gpui::test]) test_drag_onto_existing_name_shows_clear_error drags
a/1.json onto a root that already has 1.json. It checks that both files
keep their original contents and that exactly one notification appears.
- (#[test]) test_explain_move_error covers the three cases
      1. an already-exists error gets the clear message.
      2. a different error passes through untouched.
      3. with no names, the error passes through untouched.

- Both new tests pass.
- The unit test fails when detection is broken on purpose by returning
false in the new pub(crate) fn already_exists_error, so it does guard
the message logic.

## 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)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

## Showcase

<details>
  <summary>Click to view showcase</summary>
<img width="495" height="150" alt="before_zed_project_panel_name_error"
src="https://github.com/user-attachments/assets/735eb482-f4b9-4502-b810-782180c3b40c"
/>
<img width="495" height="150" alt="after_zed_project_panel_name"
src="https://github.com/user-attachments/assets/e7e9c30f-e171-4ce7-a3fd-c0f2690c08f5"
/>
<img width="217" height="186" alt="zed_test_panel_shot"
src="https://github.com/user-attachments/assets/8d76e18a-9695-4f4a-8231-785ae140c73e"
/>


</details>

---

Release Notes:

- Improved the error message in the project panel when moving a file or
folder onto a location where one with the same name already exists

---------

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2026-10-21 15:37:28 +00:00
Kirill Bulatov e83f1c9495 gpui_macos: Migrate clipboard bindings to objc2 (#65713)
Use typed pasteboards and retained Foundation objects while preserving
clipboard formats and metadata.

Cover embedded NUL and Unicode text and autorelease lifetimes.

Release Notes:

- [GPUI] Migrated macOS clipboard bindings to objc2
2026-10-21 15:35:23 +00:00
Kirill Bulatov cb1937a8e7 gpui_macos: Migrate display bindings to objc2 (#65714)
Use retained NSScreen objects and objc2 main-thread checks while
preserving refresh-rate and display-bounds fallbacks.

Release Notes:

- [GPUI] Migrated macOS display and display-link bindings to objc2
2026-10-21 15:35:19 +00:00
Kirill Bulatov 0a9eb81e6c gpui_macos: Migrate keyboard and event bindings to objc2 (#65715)
Use typed NSEvent bindings, objc2 Carbon object pointers, and a
null-safe NSString conversion.

Keep the legacy string conversion and cast the two window event call
sites until window bindings migrate.

Release Notes:

- [GPUI] Migrated macOS keyboard and event bindings to objc2
2026-10-21 15:35:15 +00:00
Kirill Bulatov e80af52575 Preserve LSP message order (#65856)
Closes https://github.com/zed-industries/zed/issues/65667

Release Notes:

- Fixed LSP formatting requests bringing in incorrect changes sometimes
2026-10-21 15:35:05 +00:00
Kirill Bulatov cc23f35a7d Remove deleted files from file finder's history items (#65660)
Closes https://github.com/zed-industries/zed/issues/65657

Release Notes:

- Fixed deleted files from file finder's history items not being removed

Co-authored-by: Andrew Mitchell <alamottemitchell@gmail.com>
2026-10-21 15:34:53 +00:00