Skip to content

fix(web): exclude generic template shadows from role reference counts - #1527

Open
wcy12378 wants to merge 1 commit into
Tencent:mainfrom
wcy12378:pi-codex/lf1496-role-ref-count
Open

wcy12378 wants to merge 1 commit into
Tencent:mainfrom
wcy12378:pi-codex/lf1496-role-ref-count

Conversation

@wcy12378

Copy link
Copy Markdown

fix(web): exclude generic template shadows from role reference counts

This is the #1496 slice: stop the role catalog from counting platform generic-template nodes as project role references.

Problem

CatalogRepo.Workflows() appends platform generic templates (generic: true) to the workflow list. The role catalog's reference count (web/app/agents.js) counted every node in that list, so a project with no SOP still showed "N nodes" for each role and disabled Delete ("role still referenced by a workflow") — while the backend DELETE check does not consider generic templates. Front-end and back-end used different algorithms (#1496).

Change

  • web/app/agents.js — when counting references, build the set of agent IDs bound by generic templates and skip a node whose agent is a private template copy bound outside its own project. Real project workflow references still count.
  • webtest/tests/assets-agents.test.mjs — test: a role referenced only by a generic template (and a foreign-project workflow) shows "unused" with Delete enabled; adding a real same-project workflow restores the count and disables Delete.

Backend DELETE logic, other pages and schema are unchanged.

Verification

  • webtest/tests/assets-agents.test.mjs: 12/12 PASS (including the new case).
  • Page tests 21/21, chatbot 552/552, build, Go checks and vet: PASS (from the implementation handoff).
  • No duplicate fix found in open PRs.

Coordination with PR #1248

Open PR #1248 (Fix #1210) changes the same reference-count line to display referencing workflow names via a new agentWorkflowUsage() helper. Its helper does not exclude generic templates, so the two changes are complementary, not duplicative. If both merge, combine by applying this exclusion inside agentWorkflowUsage().

Issue timeline shows no linked PR and no claim for #1496. Part of #1496; does not close the issue.

The role catalog counted nodes from platform generic templates (appended by
CatalogRepo.Workflows) as project role references, so roles in a project with
no SOP showed node counts and could not be deleted — while the backend DELETE
check does not consider generic templates (Tencent#1496).

Exclude template shadows from the reference count: a private template copy
only binds in its own project. Real project workflow references still count.
Test covers: generic-only reference shows 'unused' with delete enabled, while
a real same-project workflow reference still counts.

Scope: front-end role catalog count only; no backend/DELETE change.

Coordination: open PR Tencent#1248 changes the same count line (to display workflow
names). The changes are complementary — its agentWorkflowUsage helper does not
exclude generic templates. If both land, merge by adding this exclusion inside
agentWorkflowUsage. Part of Tencent#1496; does not close the issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: 使用多个工作流时,角色名重复,无法区分所属工作流

1 participant