Skip to content

fix(admin): let the Cursor worker API key be replaced or removed - #264

Merged
bobdivx merged 1 commit into
mainfrom
fix/cursor-worker-key-edit
Oct 21, 2026
Merged

bobdivx merged 1 commit into
mainfrom
fix/cursor-worker-key-edit

Conversation

@bobdivx

@bobdivx bobdivx commented Oct 21, 2026

Copy link
Copy Markdown
Owner

Bug (prod 2.0.260)

An xAI key was pasted by mistake. Cursor refused it (worker.err: "The provided API key is invalid. The API key was loaded from the CURSOR_API_KEY environment variable.", which is the env var DevForge itself sets for the worker process). After that the tab gave no visible way to fix the key:

  • the install/reinstall modal only showed the key field when no key was stored;
  • the only replace field sat in « Avancé », whose tile said "Tout est rempli automatiquement";
  • the server accepted the xai- key, and the tile only showed "Arrêté", not "clé refusée";
  • there was no way to delete the key.

Fix

  • The install modal always shows one masked "Clé API Cursor" field. The stored key appears only as a masked placeholder (never sent back), a typed value replaces it, and an empty field keeps it.
  • key_invalid is detected from the worker logs. The tile shows "Clé KO" and the Avancé tile says "Clé API refusée : la remplacer". The modal shows an alert plus the required key field with a hint (cursor.com/dashboard → API Keys, not xAI). A failed install with a refused key offers "Réessayer avec cette clé".
  • Avancé: replace the key, or delete it (with confirmation).
  • Obvious non-Cursor keys (xai-, sk-, sk-ant-, sk-or-, gsk_, AIza, ghp_, gho_, github_pat_, hf_) are rejected client-side and server-side. Install refuses to restart with a stored foreign key and asks for a Cursor key.
  • Precedence unchanged and explicit: a key saved in DevForge always wins over a server CURSOR_API_KEY. env_key_present (boolean only) lets the UI explain this.
  • Changing the key clears the stopped worker's old logs, so the old error disappears.
  • The key field uses autocomplete="new-password" so a password manager cannot fill the DevForge login password into it.

Tests

  • Rust: foreign-key rejection, invalid-key log detection, hint.
  • Web: cursorKeyProblem, and installNeeds / workerSummary with key_invalid.

Once a key was stored, the main "Réinstaller le worker Cursor" modal no
longer showed a key field, and the only way to change it was a field in
"Avancé" whose tile said everything was automatic. A wrong key (e.g. an
xAI key) was accepted by the server and the refusal by Cursor was only
visible in the logs, with the tile showing a plain "Arrêté".

- Install modal always shows one masked "Clé API Cursor" field: the
  stored key is only shown as a masked placeholder, a typed value
  replaces it, empty keeps it. Required when no key is stored or when
  Cursor refused the current one.
- When Cursor refused the key (worker logs), status returns
  key_invalid: the worker tile shows "Clé KO", the modal opens with the
  key field and a hint (cursor.com/dashboard → API Keys, not xAI); a
  failed install offers "Réessayer avec cette clé".
- Advanced modal: replace the key, or delete it (with confirmation).
- Server and UI reject obvious non-Cursor keys (xai-, sk-, sk-ant-,
  gsk_, AIza, ghp_, hf_…) with a clear message; install refuses to
  restart with a stored foreign key.
- status/settings expose env_key_present (boolean only): the UI explains
  that a key saved in DevForge takes precedence over CURSOR_API_KEY.
- Changing the key clears the stopped worker's old logs so the old
  "invalid key" error no longer shows.
- Password manager autofill disabled on the key field (new-password).
@bobdivx
bobdivx merged commit 9df4379 into main Oct 21, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant