Per-user CODE_API_KEY UI is stale after bash_tool decoupling #12719
danny-avila
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Context
Follow-up from PR #12712 (Phase 4 of Agent Skills umbrella #12625). That PR decoupled
bash_toolregistration and skill-file priming from per-userCODE_API_KEYlookups — the sandbox API key now resolves fromprocess.env.LIBRECHAT_CODE_API_KEYonly, gated on theexecute_codecapability.The frontend still has a per-user credential flow at client/src/hooks/Plugins/useAuthCodeTool.ts that installs
LIBRECHAT_CODE_API_KEYviaupdateUserPluginsunderpluginKey: Tools.execute_code. Those values are stored viagetUserPluginAuthValueand read byloadAuthValues.After #12712, the per-user value is no longer read by the skills / bash-tool runtime. It's still consulted by the legacy
CodeExecutionToolpath, PTC (classification.ts), post-execution file-download callbacks, and sandbox file-upload routes. So the UI isn't entirely dead code, but its meaning is now inconsistent: entering a key there does nothing for agent-skills usage, while the system-level env var governs sandbox access for bash_tool / skill files.Risk
Users who configure a key via the UI will reasonably expect it to enable code execution for skills and get silent no-ops instead. Likely to generate "why doesn't my key work?" support traffic.
Options
A — Remove the UI entirely. Simplest. Drop
useAuthCodeTool.tsand any consumers. Admins setLIBRECHAT_CODE_API_KEYat the server level; per-user keys aren't supported anywhere. Non-skills paths (legacy CodeExecutionTool, PTC, file callbacks) would also stop accepting per-user keys — needs a sweep to confirm no one relies on it.B — Rewire all remaining CODE_API_KEY consumers to env-only. Finish the job #12712 started: strip
loadAuthValues({ authFields: [EnvVar.CODE_API_KEY] })fromhandleTools.js,callbacks.js,classification.ts,files.js,process.js,ToolService.js(PTC block). Then remove the UI as in option A.C — Keep the UI but explain the split. Label the field as "legacy tool only; bash_tool uses server env." Ugly and confusing.
Recommend B — it's the principled finish to the Phase 4 direction. A is acceptable if per-user keys have no remaining legitimate use case.
Scope of a fix (option B sketch)
Files with residual per-user
EnvVar.CODE_API_KEYlookups:api/app/clients/tools/util/handleTools.js(CodeExecutionTool)api/server/controllers/agents/callbacks.js(file download callbacks)api/server/controllers/tools.js(tool auth config)api/server/routes/files/files.js/api/server/services/Files/process.js(sandbox uploads)api/server/services/ToolService.js:~1253(PTC block)packages/api/src/tools/classification.ts(PTC classification)useAuthCodeTool.ts+ the install UI surface that calls it.None of these are inside Phase 4's scope, so they deferred intentionally — but the UI drift is the kind of thing that silently rots.
All reactions