Skip to content

Make data components and artifact components unique across agents#2139

Merged
robert-inkeep merged 4 commits into
mainfrom
fix-component-dupe-bug
Feb 18, 2026
Merged

Make data components and artifact components unique across agents#2139
robert-inkeep merged 4 commits into
mainfrom
fix-component-dupe-bug

Conversation

@sarah-inkeep
Copy link
Copy Markdown
Contributor

@sarah-inkeep sarah-inkeep commented Feb 18, 2026

Problem: When multiple agents had subagents with the same ID, the component queries only filtered by tenantId and subAgentId. That caused components to be shared across those subagents, and the component arrays to grow on each save.
Fix: Add projectId and agentId to the queries so components are scoped to the correct parent agent. Each subagent instance now gets only its own components.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Feb 18, 2026

🦋 Changeset detected

Latest commit: b19b087

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@inkeep/agents-core Patch
@inkeep/agents-api Patch
@inkeep/agents-manage-ui Patch
@inkeep/agents-cli Patch
@inkeep/agents-sdk Patch
@inkeep/agents-work-apps Patch
@inkeep/ai-sdk-provider Patch
@inkeep/create-agents Patch
@inkeep/agents-mcp Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 18, 2026

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

Project Deployment Actions Updated (UTC)
agents-api Ready Ready Preview, Comment Feb 18, 2026 10:48pm
agents-docs Ready Ready Preview, Comment Feb 18, 2026 10:48pm
agents-manage-ui Ready Ready Preview, Comment Feb 18, 2026 10:48pm

Request Review

Copy link
Copy Markdown
Contributor

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

PR Review Summary

(2) Total Issues | Risk: High

🔴❗ Critical (1) ❗🔴

Inline Comments:

  • 🔴 Critical: agents.ts:569-570 Copy-paste bug using subAgentDataComponents instead of subAgentArtifactComponents for projectId/agentId filters

🟠⚠️ Major (1) 🟠⚠️

🟠 1) agents.ts:556-576 Missing test coverage for component isolation

Issue: The data component and artifact component isolation fix has no test coverage. The existing tests in agentFull.test.ts mock the findMany calls to return empty arrays but do not test the scenario where multiple agents exist and the query parameters must correctly isolate components to the specific agent being queried.

Why: Without a test that verifies agent-level isolation of data/artifact components, a regression could cause components from one agent to leak into another agent's definition. This could result in: (1) agents receiving incorrect UI components, (2) data components appearing for the wrong sub-agent, (3) potential data isolation issues if components contain sensitive configuration.

Fix: Add a test case that:

  1. Creates two agents (Agent A and Agent B) in the same project
  2. Creates data components and artifact components assigned to each agent's sub-agents
  3. Calls getFullAgentDefinition for Agent A
  4. Verifies that only Agent A's data/artifact components are returned, not Agent B's

Example test structure:

it('should isolate data and artifact components to the specific agent', async () => {
  // Setup: Create Agent A with dataComponentA and artifactComponentA
  // Setup: Create Agent B with dataComponentB and artifactComponentB
  
  // Act: Get full definition for Agent A
  const result = await getFullAgentDefinition(db)({
    scopes: { tenantId, projectId, agentId: agentA.id }
  });
  
  // Assert: Only Agent A's components are returned
  expect(result.subAgents[0].dataComponents).toContain(dataComponentA.id);
  expect(result.subAgents[0].dataComponents).not.toContain(dataComponentB.id);
  expect(result.subAgents[0].artifactComponents).toContain(artifactComponentA.id);
  expect(result.subAgents[0].artifactComponents).not.toContain(artifactComponentB.id);
});

Refs:


🚫 REQUEST CHANGES

Summary: The fix correctly identifies the need to add projectId and agentId filters for uniqueness, but contains a critical copy-paste bug on lines 569-570 that must be fixed before merging. The artifact component query incorrectly references subAgentDataComponents instead of subAgentArtifactComponents, which will cause the query to produce incorrect results. Additionally, this bug fix would benefit from test coverage to prevent future regressions.

Discarded (0)

No discarded findings.

Reviewers (2)
Reviewer Returned Main Findings Consider While You're Here Inline Comments Pending Recs Discarded
pr-review-standards 1 0 0 0 1 0 0
pr-review-tests 2 1 0 0 0 0 1
Total 3 1 0 0 1 0 1

Note: One finding from pr-review-tests was deduplicated with the inline comment (both identified the same copy-paste bug).

Comment thread packages/agents-core/src/data-access/manage/agents.ts Outdated
@github-actions github-actions Bot deleted a comment from claude Bot Feb 18, 2026
Copy link
Copy Markdown
Contributor

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

PR Review Summary

(1) Total Issues | Risk: Medium

🔴❗ Critical (0) ❗🔴

None — the prior Critical issue has been resolved.

🟠⚠️ Major (0) 🟠⚠️

No new Major issues in the delta.

🟡 Minor (0) 🟡

No new Minor issues in the delta.

💭 Consider (0) 💭

No new Consider items.

🕐 Pending Recommendations (1)

  • 🟠 agents.ts:556-576 Missing test coverage for component isolation — the data/artifact component isolation fix has no test coverage to prevent regression

💡 APPROVE WITH SUGGESTIONS

Summary: The Critical copy-paste bug from the prior review has been correctly fixed. The artifact component query now properly references subAgentArtifactComponents instead of subAgentDataComponents for the projectId and agentId filters, bringing it in line with the established pattern used elsewhere in the function. The fix is correct and complete.

The only remaining concern is the test coverage gap raised in the prior review — without a test that verifies cross-agent component isolation, a future regression could reintroduce this bug silently. Consider adding a test case before merging, but this is not a blocking issue for the fix itself.

Discarded (0)

No discarded findings.

Reviewers (0)
Reviewer Returned Main Findings Consider While You're Here Inline Comments Pending Recs Discarded
Orchestrator only 0 0 0 0 0 1 0
Total 0 0 0 0 0 1 0

Note: Subagent dispatch was skipped for this re-review. The delta consists of a 2-line typo fix that directly addresses the Critical issue raised in the prior automated review. No additional review was warranted for this trivial correction.

@github-actions github-actions Bot deleted a comment from claude Bot Feb 18, 2026
Copy link
Copy Markdown
Contributor

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

PR Review Summary

(0) Total Issues | Risk: Low

🔴❗ Critical (0) ❗🔴

None.

🟠⚠️ Major (0) 🟠⚠️

None — the pending "Missing test coverage" recommendation has been addressed.

🟡 Minor (0) 🟡

None.

💭 Consider (0) 💭

None.


✅ APPROVE

Summary: The test coverage gap has been addressed. The new agentFull.components-scoping.test.ts file adds a well-structured regression test that:

  1. Tests the exact bug scenario — two agents with identically-named subagents (shared-subagent)
  2. Verifies proper isolation — each agent's data/artifact components are scoped correctly
  3. Follows established patterns — uses testManageDbClient, createTestProject, generateId, and standard Vitest patterns consistent with the ~30 other test files in the same directory

This test would fail if the projectId/agentId filters were removed from the queries, providing strong regression protection. Ship it! 🚀

Discarded (0)

No discarded findings.

Reviewers (0)
Reviewer Returned Main Findings Consider While You're Here Inline Comments Pending Recs Discarded
Orchestrator only 0 0 0 0 0 0 0
Total 0 0 0 0 0 0 0

Note: Subagent dispatch was skipped for this delta re-review. The delta consists of a single test file (171 lines) that directly addresses the "Missing test coverage" pending recommendation from the prior review. The test file follows established patterns and no additional specialized review was warranted.

Copy link
Copy Markdown
Contributor

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

PR Review Summary

(0) Total Issues | Risk: Low

🔴❗ Critical (0) ❗🔴

None.

🟠⚠️ Major (0) 🟠⚠️

None.

🟡 Minor (0) 🟡

None.

💭 Consider (0) 💭

None.


✅ APPROVE

Summary: The delta since the last review is a single changeset file (curly-knives-watch.md) that correctly documents this bug fix for version management. The changeset:

  • Targets the correct package (@inkeep/agents-core)
  • Uses appropriate severity (patch) for a bug fix
  • Has a clear, accurate message: "Fix data and artifact components being shared across agents when subagents share the same ID"

All substantive issues from prior reviews have been addressed — the copy-paste bug was fixed and regression tests were added. This PR is ready to ship! 🚀

Discarded (0)

No discarded findings.

Reviewers (0)
Reviewer Returned Main Findings Consider While You're Here Inline Comments Pending Recs Discarded
Orchestrator only 0 0 0 0 0 0 0
Total 0 0 0 0 0 0 0

Note: Subagent dispatch was skipped for this delta re-review. The delta consists of a single changeset file (5 lines) that documents the bug fix for version management. No code changes occurred since the last review which already approved the PR.

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.

2 participants