Repository navigation
Conversation
The agent catalog counted nodes from generic LOOP templates (appended by CatalogRepo.Workflows to /api/bootstrap) as references to project roles that reuse a template role id. An empty project showed inflated usage and disabled Delete, while DELETE /api/agents/:id correctly allowed it via AgentShadowsTemplateOutside. Mirror the server rule: a project-owned, non-shared role with a template twin only resolves to LOOPs in its own project; platform and shared roles still resolve everywhere. Refs Tencent#1496.
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.
What changed
Fixes #1496. Generic LOOP templates are appended to /api/bootstrap by
CatalogRepo.Workflows(). The agent catalog counted their nodes as references
to project roles that reuse a template role id, so an empty project showed
"N 个节点" and disabled Delete, while DELETE /api/agents/:id correctly
allowed it via AgentShadowsTemplateOutside.
The frontend now mirrors the server rule: a project-owned, non-shared role
whose id appears in a generic template only resolves to LOOPs in its own
project. Platform and shared roles still resolve in every LOOP.
Scope
Compatibility
No schema, migration, runner protocol, or bootstrap/API contract changes.
Only the agent catalog usage count and its delete-disable check are affected;
stored roles and LOOPs are untouched. Follow-up (not in this PR): have the
server publish resolved usage details as the single source of truth.
Validation
PASSED: node --test webtest/tests/assets-agents.test.mjs (13/13)
PASSED: npm --prefix webtest test (397/397)
PASSED: npm --prefix webtest run coverage (85.3% >= 85%)
PASSED: go test ./web ./internal/repo -count=1
PASSED: go test ./internal/httpapi -run '<catalog/bootstrap/agent subset>' -count=1 (5/5)
PASSED: go vet ./... ; python3 scripts/check-public.py ; scripts/scan-secrets.sh
NOT RUN: full
go test -p=2 ./...(bwrap/Chromium unavailable in the localcontainer; CI installs bubblewrap), chatbot tests, e2e/public browser suite.
The regression test fails on main with "2 个节点" and passes with this change.
Safety