morph-labs/rift

[AgentTask] exception: No API key provided, despite clearly being provided

batjko opened this issue · 5 comments

Using the smolDeveloper agent for the first time, it throws this error:

image

image

The key definitely works fine, I've tested it elsewhere.

The key is just missing from the environment (rift doesn't seem to respect the vscode setting for the key if it runs in the WSL, I assume?).

So as a workaround, I can run rift with the env var manually, like:
OPENAI_API_KEY="sk-blablaxyz rift"

Yes, set the environment variable for now. Our integration with smol doesn't extend to configuration settings, just communication between the IDE / LSP / the smol_dev package.

This can be fixed by reading the server's parsed copy of the configuration at the start of SmolAgent.run() and using os to set the environment variable before running the functions from smol-dev.

I'm not running smol developer directly, though. I don't have it installed or configure it myself; I just use whatever Rift comes with.
So when I start rift in the IDE and start a smol agent from within the side bar, I have no access to any of smol's configuration.
I assumed that's all abstracted away, but haven't really looked into it too closely.

@batjko this should now be solved on main: 8f75b15

All third-party agents now set the OPENAI_API_KEY environment variable if the rift.openaiApiKey attribute of the VSCode configuration has been set.