[FIX][API]: Propagate gateway visibility to linked tools/prompts/resources#3476
[FIX][API]: Propagate gateway visibility to linked tools/prompts/resources#3476crivetimihai merged 2 commits intomainfrom
Conversation
|
Thanks @madhav165 — critical fix for #3475. Moving visibility propagation out of the |
|
I have reviewed and tested the changes introduced in this pull request related to propagating gateway visibility to the linked tools, prompts, and resources. The functionality works as expected. I validated the behavior by creating gateways with different visibility configurations (both all teams and specific team) and verified that visibility updates correctly propagate to the associated tools, resources, and prompts. Test Scenarios Executed from gateway UI Case 1 – Gateway in Active StateCreated a gateway and updated the visibility settings. Verified that the updated visibility was correctly reflected across the linked tools, resources, and prompts. Case 2 – Gateway in Deactivated StateUpdated the visibility of a deactivated gateway. Confirmed that the changes were still properly propagated to the linked tools, resources, and prompts. Case 3 – Gateway with MCP Server TerminatedModified the visibility configuration after the MCP server was terminated. Verified that the visibility changes were correctly reflected across tools, resources, and prompts. Across all scenarios, the visibility propagation behaved consistently and no unexpected issues were observed. |
TS0713
left a comment
There was a problem hiding this comment.
Tested the PR, working as expected. Mentioned everything in my previous comment. Approved.
70ea4d8 to
460d52f
Compare
…way is updated Closes #3475 Signed-off-by: Madhav Kandukuri <madhav165@gmail.com>
Ensure the test verifies that visibility changes to linked tools/resources/prompts are actually persisted to the database when gateway initialization fails. Closes #3475 Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
460d52f to
9b94c58
Compare
Review SummaryFix VerifiedThe fix correctly moves visibility propagation to run before the Changes Made During Review
Testing PerformedUnit tests: 260/260 passed, 1 skipped E2E tests on deployed instance (3 gateway containers behind nginx):
Admin UI (Playwright): Verified visibility changes reflect correctly on MCP Servers, Tools, Prompts, and Resources pages. Pre-existing Issues Found (not introduced by this PR)Filed as separate bugs:
|
crivetimihai
left a comment
There was a problem hiding this comment.
Approved — fix is correct, well-scoped, and thoroughly tested. See review comment for details.
…urces (#3476) * fix: propagate visibility to linked tools/prompts/resources when gateway is updated Closes #3475 Signed-off-by: Madhav Kandukuri <madhav165@gmail.com> * fix(test): assert db.commit() in visibility propagation test Ensure the test verifies that visibility changes to linked tools/resources/prompts are actually persisted to the database when gateway initialization fails. Closes #3475 Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> --------- Signed-off-by: Madhav Kandukuri <madhav165@gmail.com> Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> Co-authored-by: Mihai Criveti <crivetimihai@gmail.com>
…urces (#3476) * fix: propagate visibility to linked tools/prompts/resources when gateway is updated Closes #3475 Signed-off-by: Madhav Kandukuri <madhav165@gmail.com> * fix(test): assert db.commit() in visibility propagation test Ensure the test verifies that visibility changes to linked tools/resources/prompts are actually persisted to the database when gateway initialization fails. Closes #3475 Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> --------- Signed-off-by: Madhav Kandukuri <madhav165@gmail.com> Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> Co-authored-by: Mihai Criveti <crivetimihai@gmail.com> Signed-off-by: Yosief Eyob <yosiefogbazion@gmail.com>
🐛 Bug-fix PR
📌 Summary
When a gateway's visibility is updated (e.g.
public→team), the change was not propagated to its linked tools, prompts, and resources if the upstream MCP server was unreachable. This caused a visibility mismatch where the gateway would beteam-scoped while its tools/prompts/resources remainedpublic.Closes #3475
🔁 Reproduction Steps
visibility: "public"PUT /gateways/{id}withvisibility: "team"teambut linked tools/prompts/resources are stillpublic🐞 Root Cause
In
gateway_service.py:update_gateway, visibility propagation to linked items happened inside atryblock gated on_initialize_gatewaysucceeding (network call). If the upstream was unreachable, the exception was caught and propagation was skipped entirely. Also contained a duplicate visibility assignment.💡 Fix Description
_initialize_gatewaytry blockgateway.tools,gateway.resources, andgateway.prompts(already eager-loaded) and sets their visibility directlygateway.visibilityassignment🧪 Verification
make lintmake testpytest ...test_update_gateway_visibility_propagates_when_init_fails✅ Checklist
make black isort pre-commit)