zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
46.89k stars 2.69k forks source link

Unable to select Claude 3.5 Sonnet Zed model #16618

Open thm76 opened 3 weeks ago

thm76 commented 3 weeks ago

Check for existing issues

Describe the bug / provide steps to reproduce it

When I open the assistant tab there is no model selected.

I select "Claude 3.5 Sonnet Zed" from the dropdown but nothing changes - it still says "No model selected"

If I "Open configuration" the message under "Zed" says "You must accept the terms of service to use this provider" but it's not clear where and how I can view and accept the terms.

Environment

Zed: v0.150.0 (Zed Preview) OS: macOS 15.0.0 Memory: 16 GiB Architecture: x86_64

If applicable, add mockups / screenshots to help explain present your vision of the feature

Initial assistant tab:

Screenshot 2024-08-22 at 06 11 53

Available options:

Screenshot 2024-08-22 at 06 11 59

After selecting the first options nothing changes and the assistant tab looks the same as before (1st screenshot)

Screenshot 2024-08-22 at 06 12 07

If applicable, attach your Zed.log file to this issue.

Zed.log

2024-08-21T20:15:14.867709Z [INFO] connected to rpc endpoint https://collab.zed.dev/rpc
2024-08-21T20:15:15.058795Z [INFO] starting language server. binary path: "/Users/xxx/Library/Application Support/Zed/node/node-v22.5.1-darwin-x64/bin/node", working directory: "/", args: ["/Users/xxx/Library/Application Support/Zed/copilot/copilot-v0.5.0/dist/agent.js", "--stdio"]
2024-08-21T20:15:15.625514Z [INFO] add connection to peer
2024-08-21T20:15:15.626268Z [INFO] add_connection;
2024-08-21T20:15:15.627381Z [INFO] waiting for server hello
2024-08-21T20:15:15.629581Z [INFO] got server hello
2024-08-21T20:15:15.63115Z [INFO] set status to connected (connection id: ConnectionId { owner_id: 0, id: 0 }, peer id: PeerId { owner_id: 495, id: 29975 })
2024-08-21T20:15:15.632499Z [INFO] set status on client 102776: Connected { peer_id: PeerId { owner_id: 495, id: 29975 }, connection_id: ConnectionId { owner_id: 0, id: 0 } }
2024-08-21T20:15:15.912811Z [WARN] request completed with error: failed to connect to the server
2024-08-21T20:15:16.109082Z [INFO] Language server with id 0 sent unhandled notification LogMessage:
{
  "level": 0,
  "message": "[DEBUG] [agent] [2024-08-21T20:15:16.087Z] Agent service starting",
  "metadataStr": "[DEBUG] [agent] [2024-08-21T20:15:16.087Z]",
  "extra": [
    "Agent service starting"
  ]
}
2024-08-21T20:15:16.125567Z [INFO] Language server with id 0 sent unhandled notification client/registerCapability:
{
  "registrations": [
    {
      "id": "68a696b2-5b40-469b-bd01-83f66f6dd8cb",
      "method": "workspace/didChangeWorkspaceFolders",
      "registerOptions": {}
    }
  ]
}
2024-08-21T20:15:16.694574Z [INFO] Language server with id 0 sent unhandled notification LogMessage:
{
  "level": 1,
  "message": "[INFO] [auth] [2024-08-21T20:15:16.693Z] Invalid copilot token: missing token: 403 ",
  "metadataStr": "[INFO] [auth] [2024-08-21T20:15:16.693Z]",
  "extra": [
    "Invalid copilot token: missing token: 403 "
  ]
}
2024-08-21T20:15:16.695365Z [INFO] Language server with id 0 sent unhandled notification window/showMessageRequest:
{
  "type": 2,
  "message": "No access to GitHub Copilot found. You are currently logged in as xxx.",
  "actions": [
    {
      "title": "Sign up for GitHub Copilot"
    },
    {
      "title": "Dismiss"
    }
  ]
}
2024-08-21T20:15:16.729718Z [INFO] Language server with id 0 sent unhandled notification LogMessage:
{
  "level": 0,
  "message": "[DEBUG] [agent] [2024-08-21T20:15:16.701Z] Telemetry initialized",
  "metadataStr": "[DEBUG] [agent] [2024-08-21T20:15:16.701Z]",
  "extra": [
    "Telemetry initialized"
  ]
}
2024-08-21T20:15:17.307729Z [INFO] set environment variables from shell:/bin/zsh, path:/Users/xxx/.nvm/versions/node/v18.18.2/bin:/Users/xxx/Library/pnpm:/Users/xxx/.bun/bin:/Users/xxx/bin:/usr/local/bin:/Library/Frameworks/Python.framework/Versions/3.12/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Users/xxx/.cargo/bin:/usr/local/bin
2024-08-21T20:15:26.745544Z [WARN] request completed with error: failed to connect to the server
2024-08-21T20:15:26.822309Z [ERROR] no worktrees when constructing ProjectLspAdapterDelegate
2024-08-21T20:15:36.48047Z [ERROR] Failed to write settings to file "/Users/xxx/.config/zed/settings.json"

Caused by:
    0: failed to persist temporary file: Cross-device link (os error 18)
    1: Cross-device link (os error 18)
2024-08-21T20:16:03.295359Z [ERROR] Failed to write settings to file "/Users/xxx/.config/zed/settings.json"

Caused by:
    0: failed to persist temporary file: Cross-device link (os error 18)
    1: Cross-device link (os error 18)

nemith commented 3 weeks ago

Seriously where do i accept these terms.

TIAcode commented 3 weeks ago

It will ask to accept the terms when you try to send the first message.

nemith commented 3 weeks ago

Gotcha. Got it to work. It is important to note that it only works in the assistant pane. Using the assistant anywhere else (inline, etc) gives an error.

thm76 commented 3 weeks ago

It won't let me select the model in the first place, so I can't send a message (the "Send" button is disabled).

After clicking on the model in the dropdown I'm back to what the first screenshot shows, with "No LLM provider selected"

thm76 commented 3 weeks ago

I see the following in the log right after I try to select a model:

Caused by: 0: failed to persist temporary file: Cross-device link (os error 18) 1: Cross-device link (os error 18) 2024-08-22T19:51:53.052829Z [ERROR] Failed to write settings to file "/Users/ext/xxx/.config/zed/settings.json"

mrnugget commented 3 weeks ago

I'm going to add the accept-terms form to the configuration page too, but I think the problem you're seeing, @thm76, is related by different: is it possible that your Zed config is a symlink or lives on a different drive or something like that?

thm76 commented 3 weeks ago

I'm going to add the accept-terms form to the configuration page too, but I think the problem you're seeing, @thm76, is related by different: is it possible that your Zed config is a symlink or lives on a different drive or something like that?

My home folder is on a different volume from Zed Preview.app

mrnugget commented 3 weeks ago

In #16736 I'm adding the accept-tos thing to the configuration view, but I don't think that will fix the problem that you can't select the model.

The problem is that we can't write the settings file (in which we want to write the selected model):

2024-08-21T20:15:36.48047Z [ERROR] Failed to write settings to file "/Users/xxx/.config/zed/settings.json"
Caused by:

0: failed to persist temporary file: Cross-device link (os error 18)

1: Cross-device link (os error 18)

2024-08-21T20:16:03.295359Z [ERROR] Failed to write settings to file "/Users/xxx/.config/zed/settings.json"

Caused by:

0: failed to persist temporary file: Cross-device link (os error 18)

1: Cross-device link (os error 18)
diegodorado commented 1 week ago

I am having a (probably) related issue:

My settings.json is indeed a symlink because I like to maintain in in sync through nix home-manager.

Trying to switch the llm from the UI, (both alt-M or with the mouse) does not change the selected model...but if a restart the editor it seems it does.

I discovered the following:

  1. change the llm (alt-m or mouse, smae thing)
  2. i can see settings.json changed (need to close and re-open the file)
  3. no UI changes
  4. even though the settings.json got change, say, to ollama, if i prompt to the assistant i do not see request made to ollama, for which i assume the setting got changed, but the model wasn't in some app state
  5. if a reopen the editor, the changes are applied.

I was tailing logs while doing this and haven't seen anything related.

Two things caught my attention:

  1. I was a little bit surprised that switching the model from the UI would change my settings default_model. I guess I was expecting that to be just a session state and not changing my settings.json without noticing it.
  2. I supose that zed has a special watcher for settings.json different than for other (maybe also symlinked) files? because if I change externally that settings.json the buffer does not watch for those changes
mrnugget commented 1 week ago

I am having a (probably) related issue:

My settings.json is indeed a symlink because I like to maintain in in sync through nix home-manager.

Does that mean it's on a different disk volume? Because I too have my settings.json symlinked (~/.config/zed/settings.json points to ~/.dotfiles/zed_settings.json) and everything you described works.

diegodorado commented 1 week ago

It is the same volume, but because of the home manager way I found to make a symlink out of the store it seems that it is a symlink of a symlink:

❯  file .config/zed/settings.json
.config/zed/settings.json: symbolic link to /nix/store/cxh2i1kdjxfhnnzvcidyxnqprcwk038x-home-manager-files/.config/zed/settings.json

~
❯  file /nix/store/cxh2i1kdjxfhnnzvcidyxnqprcwk038x-home-manager-files/.config/zed/settings.json
/nix/store/cxh2i1kdjxfhnnzvcidyxnqprcwk038x-home-manager-files/.config/zed/settings.json: symbolic link to /nix/store/98bh5mivyh8sckhw96virbdpkpvm4q5f-hm_settings.json

~
❯  file /nix/store/98bh5mivyh8sckhw96virbdpkpvm4q5f-hm_settings.json
/nix/store/98bh5mivyh8sckhw96virbdpkpvm4q5f-hm_settings.json: symbolic link to /home/diegodorado/Code/nix-config/zed/settings.json

~
❯  file /home/diegodorado/Code/nix-config/zed/settings.json
/home/diegodorado/Code/nix-config/zed/settings.json: ASCII text

I may spend some time to see if I can remove that nested symlink if a single symlink worked for you @mrnugget

mrnugget commented 1 week ago

Thank you! That's good debugging information.

diegodorado commented 1 week ago

@mrnugget thanks for the assistance. Turns out that nested symlink was causing the issue... that was because I symlinked the settings.json and keymap.json alone... I switched to symlinking the whole folder and gitignore conversations and locks and now it works as intended

mrnugget commented 1 week ago

@diegodorado great! thanks for letting me know!

@thm76 does symlinking play a role in your setup? It didn't sound like it does, but I want to be sure.

thm76 commented 1 week ago

@mrnugget There are no symlinks in my setup. My / is mounted from a different volume from /home - I think that might be the issue..

thm76 commented 2 days ago

This comes up in the log in v0.153.3:

2024-09-12T08:19:33.679273+10:00 [ERROR] Failed to write settings to file "/Users/ext/xxx/.config/zed/settings.json"

Caused by: 0: failed to persist temporary file: Cross-device link (os error 18) 1: Cross-device link (os error 18)

agi-dude commented 15 hours ago

Running it as administrator fixed it in my case