mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-16 13:00:55 +00:00
* fix: Stop Sealing a Code Environment Decision a Chat Never Made Switching an existing chat to a coding agent left the composer unable to send. The chat had no workspace to select, Send stayed disabled, and the workspace chip was a read-only status with a recovery hint. Both layers treated "no decision recorded" as "decided to run without an attached environment". `readPersistedDecision` documented that a stored conversation always carries a decision and inferred `without_attached` whenever `codeEnvironmentMode` and `codeWorkspaces` were both absent, which is the ordinary state of a chat whose turns never involved a code-capable agent. `resolveConversationCodeEnvironmentDecision` then sealed that inference, so the first workspace its owner picked came back as `locked`. The client mirrored the same premise: `locked` was any saved chat, so `useCodeWorkspace` withheld agent defaults, a remembered selection, and a sole workspace, and `CodeWorkspaceMenu` rendered its non-interactive locked branch. Only a recorded decision is sealed now. A conversation holding neither field is undecided, so its first coding turn establishes the decision, and `resolvePersistableCodeEnvironmentDecision` records that decision with its selections; writing the mode alone would leave `attached` without the selections the next turn validates. On the client the same predicate drives `locked`, and the selection defaults that already applied to a new chat now apply to any chat that has not decided. An explicit `without_attached` stays sealed, a legacy row still infers `attached` from the selections it stores, and a sealed decision is still replaced only by its owner's move. * fix: Record the first code environment decision on an existing chat A saved chat that holds no decision may record the one a run establishes, but every caller persists through `saveConvo`, which carries those fields only in `$setOnInsert`. On a row that already exists the write was dropped, so the choice never survived a reload and a later turn could resolve a different workspace. `saveConvo` now fills a whole decision onto a row that holds none, by compare-and-set on that absence: a writer that decided first keeps its decision, a chat that already holds one is untouched, and bare selections never seed a row. * fix: Record the decision a failed turn of a saved chat ran under `saveErrorTurn` built its conversation fields only when it was seeding a new row, so an existing chat kept the stored error turn without the decision that turn ran under: a retry could then pick a different workspace than the failure already recorded. The validated decision now travels on both branches, where the conditional write in `saveConvo` keeps it from replacing a stored one. * refactor: Resolve the error turn's decision fields in `packages/api` The error-turn save derived its own decision fields, putting persistence policy in a CJS controller where `/api` is meant to hold wiring only. It now calls `resolvePersistableCodeEnvironmentDecision`, the resolver the streaming saves already use, so one rule decides what a turn may record: a chat that holds a decision keeps it and receives no decision fields at all. * fix: Keep the legacy code environment lock until the protocol is advertised The composer unlocked a saved chat that holds no decision without consulting `codeEnvironmentDecisionVersion`, so during the rollout window it could attach an agent default and submit it to a replica that still reads a field-less row as a sealed `without_attached` and rejects the turn as `locked`. The unlock now waits for the deployment to advertise the protocol, which makes the hook identical to its previous behavior while the flag is unset. Nothing is lost by waiting: the unmade decision is only reported once that flag is on. --------- Co-authored-by: Lia <lia@librechat.ai> |
||
|---|---|---|
| .. | ||
| __tests__ | ||
| callbacks.background.spec.js | ||
| callbacks.js | ||
| client.codeDecision.spec.js | ||
| client.imageDetail.spec.js | ||
| client.js | ||
| client.test.js | ||
| errors.js | ||
| filterAuthorizedTools.spec.js | ||
| openai.js | ||
| protocol.js | ||
| queuedTurns.js | ||
| recordCollectedUsage.spec.js | ||
| request.js | ||
| responses.js | ||
| resume.js | ||
| steer.js | ||
| v1.js | ||
| v1.spec.js | ||