BUG: chat_create can return and mutate an existing context when new_context collides #181
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nsaspy/a0-symbolics#181
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Finding
api/chat_create.pyaccepts an optional caller-providednew_contextvalue:helpers.context_utils.use_context()first callsAgentContext.use(ctxid)and returns that existing context when the ID is already present. It only creates a context when lookup fails.chat_createthen treats the returned object as new and may copy project metadata andchat_model_overridefromcurrent_contextinto it before returningok: true/ that same ID.So a create request with a colliding valid context ID is not a conflict/idempotent no-op; it can mutate an unrelated existing conversation's project/model state while claiming a chat was created.
This should be fixed alongside the context-ID validation/containment work in #43, but it is a separate lifecycle invariant.
Direction
Separate
get/use existing contextfromcreate context with requested idAPIs. Creation must be atomic under the context registry lock and fail deterministically on collision unless a specific endpoint documents idempotent create semantics.The normal WebUI should usually generate the ID server-side; caller-supplied IDs should exist only for an explicit import/restore/test contract if still needed.
Acceptance
chat_createnever returns an existing context as a newly-created chat.Mirrored from
lost-rob0t/a0-symbolics#44via tracker sync.