Skip to content

Add knowledge tag ID canonical input - #5983

Open
BillLeoutsakosvl346 wants to merge 1 commit into
stagingfrom
feature/kb-tag-id-input
Open

Add knowledge tag ID canonical input#5983
BillLeoutsakosvl346 wants to merge 1 commit into
stagingfrom
feature/kb-tag-id-input

Conversation

@BillLeoutsakosvl346

@BillLeoutsakosvl346 BillLeoutsakosvl346 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a canonical advanced Tag ID input for Knowledge Search while preserving the existing basic tag-name selector and existing workflows.

The internal Knowledge search contract now accepts exactly one tagName or tagId. Tag IDs are resolved in the shared Knowledge filter resolver against the selected knowledge base, and the server derives the authoritative display name, storage slot, and field type. The thin search route remains unchanged, and the public v1/v2 schemas remain name-only.

This also adds a copy-ID control to Knowledge tag rows and preserves advanced values through canonical migration, nested tools, execution, display, search/replace, and workspace forks. Literal definition UUID filters are removed when their parent knowledge base is remapped; dynamic references remain portable.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: ___________

Testing

  • Focused Vitest coverage for the editor, copy-ID control, internal contract, authoritative ID resolution, canonical parameters, nested tools, migrations, display/search-replace, tool parsing, and workspace fork/remap behavior
  • bun run check:audits — 29/29 audits passed
  • bun run lint:check — 24/24 tasks passed
  • bun run type-check — 24/24 tasks passed
  • bun run test — 17/17 tasks passed
  • bunx turbo run build --filter=@sim/app — passed
  • git diff --check — passed

Reviewers should focus on switching Knowledge Search tag filters between basic and advanced modes, dynamic Tag ID references, and the single-knowledge-base restriction for ID filters.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Screenshots/Videos

Browser screenshots were not captured because this agent session had no controllable browser attached. Focused jsdom tests cover first-input focus/paste behavior, canonical knowledge-base context, collapsed resolved/raw labels, and the copy-ID interaction.

@vercel

vercel Bot commented Jul 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview Aug 18, 2026 12:06am

Request Review

@BillLeoutsakosvl346
BillLeoutsakosvl346 marked this pull request as ready for review July 27, 2026 21:11
@BillLeoutsakosvl346
BillLeoutsakosvl346 requested a review from a team as a code owner July 27, 2026 21:11
@cursor

cursor Bot commented Jul 27, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Touches knowledge search validation, workflow fork/remap, and canonical param execution paths; wrong ID resolution or remap behavior could change search results or break forked workflows, though coverage is broad.

Overview
Adds advanced Tag ID filtering for Knowledge Search alongside the existing basic tag-name UI, wired through canonical tagFilters basic/advanced pairs on the Knowledge block and nested tools.

Editor & UX: Advanced mode uses a connected Tag ID input (references, paste/focus behavior) that resolves definitions from the active knowledge base; collapsed headers show resolved names or raw IDs. Knowledge tag management rows get a copy tag ID control with tooltip feedback.

API & resolution: Internal search accepts exactly one of tagName or tagId per filter; IDs resolve to slot/field type in the shared resolver (single-KB only for ID filters). Public v1/v2 remain name-only. Docs note tagName or tagId on tagFilters.

Fork/remap/migration: Workspace fork remap strips literal tag-definition UUIDs from advanced filters when the parent KB is remapped; dynamic references stay. Basic name-based filters remain portable. Migrations backfill tagFilters advanced mode when manual tag IDs exist. Search/replace and display summarize tag IDs.

Reviewed by Cursor Bugbot for commit ff8f1b2. Bugbot is set up for automated code reviews on this repo. Configure here.

@BillLeoutsakosvl346
BillLeoutsakosvl346 changed the base branch from main to staging July 27, 2026 21:12
@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@greptile-apps please review the corrected feature diff after retargeting this PR to staging.

@cursor review

@greptile-apps

greptile-apps Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds canonical basic/advanced Knowledge tag filters and carries tag IDs through search, serialization, migration, workflow utilities, and workspace forks.

  • Adds a manual Tag ID alternative to the existing tag-name selector.
  • Resolves tag IDs against accessible knowledge-base definitions and validates IDs, operators, and values server-side.
  • Adds tag-ID copy controls and regression coverage for UI, API, tooling, migration, and fork behavior.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/sim/app/api/knowledge/search/route.ts Resolves tag IDs from accessible knowledge-base definitions and validates resolved filter types, operators, and range values.
apps/sim/lib/api/contracts/knowledge/search.ts Extends the internal search contract with mutually exclusive tag-name and tag-ID filter identifiers.
apps/sim/blocks/blocks/knowledge.ts Defines the tag-name and manual Tag ID controls as a canonical basic/advanced parameter pair.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/knowledge-tag-filters/knowledge-tag-filters.tsx Supports editing, resolving, and displaying Tag ID filters in the advanced canonical mode.
apps/sim/ee/workspace-forking/lib/remap/remap-references.ts Preserves dynamic tag-ID references while removing source-workspace literal tag IDs when knowledge bases move across fork boundaries.
apps/sim/tools/shared/tags.ts Parses both tag-name and tag-ID filter representations into the internal structured-filter shape.

Sequence Diagram

sequenceDiagram
  participant User as Workflow editor
  participant Serializer as Canonical serializer
  participant Tool as Knowledge search tool
  participant API as Knowledge search API
  participant Tags as KB tag definitions
  participant Search as Vector/tag search
  User->>Serializer: Configure tag name or manual tag ID
  Serializer->>Tool: Emit canonical tagFilters
  Tool->>API: Search request with tag filters
  API->>Tags: Resolve tag ID/name to slot and field type
  Tags-->>API: Tag definition
  API->>API: Validate operator and values
  API->>Search: Typed structured filters
  Search-->>User: Matching knowledge chunks
Loading

Reviews (4): Last reviewed commit: "Fix canonical tag filter edge cases" | Re-trigger Greptile

Comment thread apps/sim/app/api/knowledge/search/route.ts Outdated
@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@greptile-apps please re-review the latest changes addressing both BugBot findings.

@cursor review

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@greptile-apps please perform a final review of the latest Tag ID editing refinement.

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 5e89280. Configure here.

Comment thread apps/sim/tools/shared/tags.ts Outdated
Comment thread apps/sim/blocks/blocks/knowledge.ts
@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@greptile-apps please re-review commit 20a3941, which addresses both latest BugBot findings and adds focused regression coverage.

@cursor review

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

Demo:

Screen.Recording.2026-07-27.at.4.15.24.PM.mov

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.

1 participant