Fix queue clear() endpoint to respect user ownership in multi-user deployments#75
Merged
lstein merged 1 commit intofeature/multiuserfrom Feb 23, 2026
Merged
Conversation
Copilot
AI
changed the title
[WIP] Fix queue clear endpoint to respect user id
Fix queue Feb 22, 2026
clear() endpoint to respect user ownership in multi-user deployments
Author
Added tests in commit b0841a3 at
|
lstein
approved these changes
Feb 23, 2026
Owner
lstein
left a comment
There was a problem hiding this comment.
Tested endpoints directly and works as advertised.
Co-authored-by: lstein <111189+lstein@users.noreply.github.com> Add tests for session queue clear() user_id scoping Co-authored-by: lstein <111189+lstein@users.noreply.github.com> chore(frontend): rebuild typegen
b0841a3 to
1db49d1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
clear()endpoint unconditionally deleted all queue items for a givenqueue_idregardless of who called it, allowing any non-admin user to wipe other users' pending jobs. This is inconsistent withprune(), which already supports auser_idfilter for multi-tenancy.Changes:
session_queue_base.py: Adduser_id: Optional[str] = Nonetoclear()signature — when provided, only items owned by that user are clearedsession_queue_sqlite.py: Add conditionalAND user_id = ?to the SQL WHERE clause inclear(), matching the existing pattern inprune()session_queue.py(router): Scope the clear operation by user — admins passuser_id=None(clears all), non-admins pass their ownuser_id(clears only their items)tests/app/services/session_queue/test_session_queue_clear.py: New tests verifying the user-scoped clear behaviourRelated Issues / Discussions
QA Instructions
In a multi-user setup (feature/multiuser branch):
PUT /v1/queue/{queue_id}/clear— only user A's items should be deleted; user B's items should remainMerge Plan
Checklist
What's Newcopy (if doing a release after this PR)Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.