Repository navigation
fix: scope template dedupe to the member who enabled it - #753
Conversation
A second member enabling a catalog template the org already had was handed the first member's automation with a 200: their trigger and config were dropped, and every run kept minting the first member's key, so the output landed in the first member's account. find_existing_template_automation now also filters on created_by_user_id, so each member gets their own install while a member re-enabling the same template still gets theirs back. Management stays org-scoped. Fixes #750 Co-authored-by: openhands <openhands@all-hands.dev>
|
📁 PR Artifacts Notice This PR adds or changes temporary PR-specific documents under |
|
Warning Your comment is too long (maximum is 65536 characters), so the coverage report was not added. See the job log for how to reduce it. |
|
@all-hands-bot Please review the latest head ae10c93. All CI checks are green and the branch merges cleanly with main. Before/after evidence is in the PR description. This comment/PR was created by an AI agent (OpenHands) on behalf of Graham Neubig. |
|
This review was posted by an AI agent (OpenHands). ScopeThe change belongs here: template dedupe on automation creation is service-owned behavior, and issue #750 is labeled AssessmentThe fix is correct and minimal. I verified the changed filter semantics directly against the code (standalone SQLite harness exercising the The OpenAPI Test evidence
No material correctness, security, or compatibility findings. ✅ APPROVED |
|
🚀 Released in 1.33.0. |
Why
Fixes #750. Every create endpoint that accepts
templatereplayed any same-org automation for that template with a200. A second member enabling a catalog entry another member already enabled was handed the first member's automation: the second member's trigger and config were dropped, and because a run mints its key forautomation.user_id, every run (even ones the second member dispatched) produced output in the first member's account.The lookup was per user when it was introduced (#322); #399 widened it to the org as a side effect of making management org-scoped. No catalog entry declares a once-per-org rule.
Summary
find_existing_template_automationnow also filters oncreated_by_user_id(the member who enabled it). All four callers (POST /v1,/v1/plugin-spec,/v1/preset/prompt,/v1/preset/plugin) pass the caller's id.200, no new row), cross-endpoint identity for one member, DRAFT artifacts not counting, INACTIVE installs counting, soft-deleted installs not blocking, org-scoped list/get/patch/delete/dispatch from fix: scope automation management to the org instead of the owner #399.200description andAGENTS.mdnow describe per-member dedupe.tests/test_template_dedupe_per_member.py: two members on each of the four endpoints (201, own owner/trigger/config, first member's automation untouched), same-member replay on each endpoint, cross-endpoint replay, org-scoped management of each other's installs, and a run on the second member's automation minting the key at/api/service/users/{second}/orgs/{org}/api-keys.How to Test
New file: 11 passed on this branch; on main 6 of them fail (
assert 200 == 201). The related suites pass (733 passed locally with Postgres testcontainers). Pre-commit (ruff, pycodestyle, pyright) passes.Before / after
The same script (
.pr/issue-750/demo_750.py) signs in as two members of one org and sends the samenews-digesttemplate to each endpoint.Notes
The Agent Canvas setup dialog cannot tell a
200from a201(noted in the issue); that belongs in OpenHands/OpenHands and is out of scope here..pr/holds review evidence only and is removed on release.This comment/PR was created by an AI agent (OpenHands) on behalf of Graham Neubig.