# Send session headers on all OpenCode requests \(\#63702\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/28e52a2879f07912fd583420615ad94eaa699a3f)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 28e52a2879f07912fd583420615ad94eaa699a3f

Requested commit: 28e52a2879f07912fd583420615ad94eaa699a3f

Commit: 28e52a2879f07912fd583420615ad94eaa699a3f

Tree: da398774088a39be8cc1528d4c21be33c4c65f22

Author: morgankrey

Committer: GitHub

## Message

```
Send session headers on all OpenCode requests (#63702)

Fixes https://github.com/zed-industries/zed/issues/63672

OpenCode Go now requires the `x-opencode-session` header on every model
request. Zed previously sent the header only when a request already had
a thread ID, so inline assistance, terminal assistance, and other
standalone requests could omit it and risk rejection.

This change makes the OpenCode provider add the header to every request.
Existing thread and assist session IDs are reused when available.
Standalone requests receive a generated non-empty ID. Thread title and
summary requests now carry the thread ID so related requests keep the
same session scope.

The change also adds tests for missing, empty, and invalid IDs, plus a
wire-level test that verifies the header reaches the HTTP client. The
provider test file stays separate so the implementation remains under
1,000 lines.

Testing:

- `cargo fmt --all -- --check`
- Focused OpenCode, thread summary, and thread title tests
- `cargo check -p agent_ui -p sidebar`
- `GITHUB_ACTIONS=1 ./script/clippy -p language_models`
- `git diff --check`

Release Notes:

- Fixed OpenCode Go requests that could fail when Zed omitted the
session header.

---------

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
```

## Parents

- [49d01146c8e995f23b51f046e210b8708a62a5e9](https://git.cafe/gitcafe/zed/commit/49d01146c8e995f23b51f046e210b8708a62a5e9?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/28e52a2879f07912fd583420615ad94eaa699a3f?format=markdown)
