Description
Bug Description:
The Theia AI Workspace Agent is slow and inaccurate on a basic 'smoke test', when asked a simple question: "how many files are in this repo?" while open in a workspace containing the theia repo.
Steps to Reproduce:
- Launch theia 1.54+ and configure the experimental AI features with an (official) OpenAI api key. Configure the AI agents to be all disabled except the Workspace agent which is set to use
openai/gpt-4o-mini
. - Git clone
https://github.com/eclipse-theia/theia
and open it in theia as a workspace. - Ask the AI Chat "how many files are in this repo?"
- Observe the results:
- Observe that it takes a very long time for it to answer such a simple question (approx. 2 minutes for me)
- Observe that the answer is incorrect. It responded with "There are a total of 386 files in this repository." But presumably this is not correct. And also it is inconsistent with the intermediary list that it used, below, when it ran getWorkspaceFileList, which by pasting into python as
files = <paste>
and counting withlen(files)
says there are 3757 entries in this list.
Partial view of what the list of files used as intermediary by Workspace Agent looked like (GitHub prevented the entire list due to a 65536 character limit on comment length)
["file:///home/project/theia/.editorconfig","file:///home/project/theia/.eslintrc.js","file:///home/project/theia/.git","file:///home/project/theia/.github","file:///home/project/theia/.gitignore","file:///home/project/theia/.gitpod.dockerfile","file:///home/project/theia/.gitpod.yml","file:///home/project/theia/.npmignore","file:///home/project/theia/.theia","file:///home/project/theia/.vscode","file:///home/project/theia/.yarnrc","file:///home/project/theia/CHANGELOG.md","file:///home/project/theia/CODE_OF_CONDUCT.md","file:///home/project/theia/CONTRIBUTING.md","file:///home/project/theia/LICENSE-EPL","file:///home/project/theia/LICENSE-GPL-2.0-ONLY-CLASSPATH-EXCEPTION","file:///home/project/theia/LICENSE-vscode.txt","file:///home/project/theia/NOTICE.md","file:///home/project/theia/README.md","file:///home/project/theia/SECURITY.md","file:///home/project/theia/configs","file:///home/project/theia/configs/base.eslintrc.json","file:///home/project/theia/configs/base.tsconfig.json","file:///home/project/theia/configs/build.eslintrc.json","file:///home/project/theia/configs/errors.eslintrc.json","file:///home/project/theia/configs/mocharc.yml","file:///home/project/theia/configs/nyc.json","file:///home/project/theia/configs/typedoc.json","file:///home/project/theia/configs/warnings.eslintrc.json","file:///home/project/theia/configs/xss.eslintrc.json","file:///home/project/theia/dependency-check-baseline.json","file:///home/project/theia/dev-packages","file:///home/project/theia/dev-packages/application-manager","file:///home/project/theia/dev-packages/application-manager/.eslintrc.js","file:///home/project/theia/dev-packages/application-manager/README.md","file:///home/project/theia/dev-packages/application-manager/package.json","file:///home/project/theia/dev-packages/application-manager/src","file:///home/project/theia/dev-packages/application-manager/src/application-package-manager.ts","file:///home/project/theia/dev-packages/application-manager/src/application-process.ts","file:///home/project/theia/dev-packages/application-manager/src/expose-loader.ts","file:///home/project/theia/dev-packages/application-manager/src/generator","file:///home/project/theia/dev-packages/application-manager/src/generator/abstract-generator.ts","file:///home/project/theia/dev-packages/application-manager/src/generator/backend-generator.ts","file:///home/project/theia/dev-packages/application-manager/src/generator/frontend-generator.ts","file:///home/project/theia/dev-packages/application-manager/src/generator/index.ts","file:///home/project/theia/dev-packages/application-manager/src/generator/webpack-generator.ts","file:///home/project/theia/dev-packages/application-manager/src/index.ts","file:///home/project/theia/dev-packages/application-manager/src/package.spec.ts","file:///home/project/theia/dev-packages/application-manager/src/rebuild.ts","file:///home/project/theia/dev-packages/application-manager/tsconfig.json","file:///home/project/theia/dev-packages/application-package","file:///home/project/theia/dev-packages/application-package/.eslintrc.js","file:///home/project/theia/dev-packages/application-package/README.md","file:///home/project/theia/dev-packages/application-package/package.json","file:///home/project/theia/dev-packages/application-package/src","file:///home/project/theia/dev-packages/application-package/src/api.ts","file:///home/project/theia/dev-packages/application-package/src/application-package.spec.ts","file:///home/project/theia/dev-packages/application-package/src/application-package.ts","file:///home/project/theia/dev-packages/application-package/src/application-props.ts","file:///home/project/theia/dev-packages/application-package/src/environment.ts","file:///home/project/theia/dev-packages/application-package/src/extension-package-collector.ts","file:///home/project/theia/dev-packages/application-package/src/extension-package.ts","file:///home/project/theia/dev-packages/application-package/src/index.ts","file:///home/project/theia/dev-packages/application-package/src/json-file.ts","file:///home/project/theia/dev-packages/application-package/src/npm-registry.ts","file:///home/project/theia/dev-packages/application-package/tsconfig.json","file:///home/project/theia/dev-packages/cli","file:///home/project/theia/dev-packages/cli/.eslintrc.js","file:///home/project/theia/dev-packages/cli/README.md","file:///home/project/theia/dev-packages/cli/bin","file:///home/project/theia/dev-packages/cli/bin/theia","file:///home/project/theia/dev-packages/cli/bin/theia-patch.js","file:///home/project/theia/dev-packages/cli/package.json","file:///home/project/theia/dev-packages/cli/patches","file:///home/project/theia/dev-packages/cli/patches/%40phosphor%2Bwidgets%2B1.9.3.patch","file:///home/project/theia/dev-packages/cli/patches/%40theia%2Bmonaco-editor-core%2B1.83.101.patch","file:///home/project/theia/dev-packages/cli/src","file:///home/project/theia/dev-packages/cli/src/check-dependencies.ts","file:///home/project/theia/dev-packages/cli/src/download-plugins.ts","file:///home/project/theia/dev-packages/cli/src/run-test.ts","file:///home/project/theia/dev-packages/cli/src/test-page.ts","file:///home/project/theia/dev-packages/cli/src/theia.ts","file:///home/project/theia/dev-packages/cli/tsconfig.json","file:///home/project/theia/dev-packages/ffmpeg","file:///home/project/theia/dev-packages/ffmpeg/.eslintrc.js","file:///home/project/theia/dev-packages/ffmpeg/README.md","file:///home/project/theia/dev-packages/ffmpeg/binding.gyp","file:///home/project/theia/dev-packages/ffmpeg/native","file:///home/project/theia/dev-packages/ffmpeg/native/ffmpeg.c","file:///home/project/theia/dev-packages/ffmpeg/native/ffmpeg.h","file:///home/project/theia/dev-packages/ffmpeg/native/linux-ffmpeg.c","file:///home/project/theia/dev-packages/ffmpeg/native/mac-ffmpeg.c"]
Additional Information
When I asked with the Perplexity API model (llama-3.1-sonar-small-128k-online
), I received the following different and not useful answer (not useful in that it did not execute this procedure and provide me with an answer):
My point in mentioning this is that the proper expected result, properly, in my opinion, is that the AI agent would perform some combination of these answers: it should (and has the ability to, it seems) understand that it can run one simple terminal command could answer the question, and it should perform this command (similar to how it performs getWorkspaceFileList, although it is perhaps a bit different as that function is presumably hardcoded in theia?) and return the output of that command.
This is both a convenience matter, in that the answer should be provided near-instantly at the speed of non-AI computation of a simple terminal command (when I ran the suggested git ls-files | wc -l
in the theia terminal it returned instantly — but interestingly with a different number than my python counting of the getWorkspaceFilesList... 3106), but it is also a cost issue: there is no need to send a list of 3757 filenames to the AI model, which the API charges the user for per-token.
Another issue, when I enabled all the AI agents, each with gpt-4o-mini
, and I asked the chat (so that it goes initially to the orchestrator, although I did not actually see the orchestrator in action) it still used the workspace agent but now gave a different answer:
System info
- Operating System: Ubuntu 24.04 aarch64 minimal (built with light modifications to get it running on arm, can elaborate if needed)
- Theia Version: 1.54-essentially (specifically I built it from the master branch today 2024-10-28 in order to include feat: support custom keys for custom Open AI models #14299)