Skip to content

Conversation

@dimaMachina
Copy link
Collaborator

No description provided.

@vercel
Copy link

vercel bot commented Jan 5, 2026

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

Project Deployment Review Updated (UTC)
agents-docs Ready Ready Preview, Comment Jan 5, 2026 7:54pm
agents-manage-api Ready Ready Preview, Comment Jan 5, 2026 7:54pm
agents-manage-ui Ready Ready Preview, Comment Jan 5, 2026 7:54pm
agents-run-api Ready Ready Preview, Comment Jan 5, 2026 7:54pm

@changeset-bot
Copy link

changeset-bot bot commented Jan 5, 2026

🦋 Changeset detected

Latest commit: cc43fe8

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-manage-ui Major
@inkeep/agents-cli Major
@inkeep/agents-manage-api Major
@inkeep/agents-run-api Major
@inkeep/agents-core Major
@inkeep/agents-manage-mcp Major
@inkeep/agents-sdk Major
@inkeep/ai-sdk-provider Major
@inkeep/create-agents Major

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

@dimaMachina dimaMachina changed the title automatically generate and render breadcrumbs in dashboard with Next.js /[tenantId]/@breadcrumbs/[...slug]/page.tsx parallel route 2/2 automatically generate and render breadcrumbs in dashboard with Next.js /[tenantId]/@breadcrumbs/[...slug]/page.tsx parallel route Jan 5, 2026
@claude
Copy link

claude bot commented Jan 5, 2026

Claude finished @dimaMachina's task —— View job


Comprehensive TypeScript Staff Engineer Review

This PR implements an automated breadcrumb system using Next.js parallel routes (/@breadcrumbs) to replace manual breadcrumb management. I've conducted a thorough architectural and code quality review.

Key Architecture Changes ✨

Parallel Route Implementation: The new /@breadcrumbs/[...slug]/page.tsx leverages Next.js parallel routes pattern for automatic breadcrumb generation based on URL segments. This is architecturally sound and follows Next.js best practices.

Route-Based Automation: Instead of manually passing breadcrumb props, the system automatically infers navigation context from the URL path - a more maintainable approach.


🔴 Critical Architecture & Design Issues

1. Performance & Error Handling Concerns

Location: /[tenantId]/@breadcrumbs/[...slug]/page.tsx:90-115

for (const [index, segment] of slug.entries()) {
  let label: string | undefined;
  try {
    // Multiple async fetches happen sequentially in a loop
    label = fetcher ? await fetcher(segment) : getStaticLabel(segment);
  } catch (error) {
    // Error breaks the entire breadcrumb chain
    break;
  }
}

Issues:

  • Sequential API calls: Each breadcrumb segment triggers individual API calls sequentially, creating a waterfall effect
  • Fragile error handling: Single API failure breaks entire breadcrumb chain
  • Missing loading states: No graceful degradation during slow API responses

Recommendation: Parallelize fetches and implement graceful degradation:

// Collect all fetchers first, then run in parallel
const fetchPromises = segments.map((segment, idx) => {
  const fetcher = getFetcher(segments[idx - 1]);
  return fetcher ? fetcher(segment).catch(() => segment) : Promise.resolve(getStaticLabel(segment));
});
const labels = await Promise.allSettled(fetchPromises);

2. Type Safety & Route Validation

Location: /[tenantId]/@breadcrumbs/[...slug]/page.tsx:27

const BreadcrumbSlot: FC<PageProps<'/[tenantId]/[...slug]'>> = async ({ params }) => {

Issues:

  • PageProps<'/[tenantId]/[...slug]'> type doesn't match actual route structure
  • No validation that segments correspond to valid routes
  • Type assertion without runtime validation

Recommendation: Implement proper type definitions and route validation:

type ValidRouteSegments = 'projects' | 'agents' | 'credentials' | ...;
type BreadcrumbRoute = `/[tenantId]/${ValidRouteSegments}/[...segments]`;

3. Error State Management

Location: /[tenantId]/@breadcrumbs/[...slug]/page.tsx:107-114

catch (error) {
  const errorCode = getErrorCode(error);
  const resolvedStatusCode = getStatusCodeFromErrorCode(errorCode);
  label = resolvedStatusCode ? `${resolvedStatusCode} Error` : 'Error';
  addCrumb({ segment, label });
  break; // stop traversing if error occurs
}

Issues:

  • Error breadcrumbs remain in navigation indefinitely
  • No retry mechanism for failed fetches
  • Breaks breadcrumb chain instead of graceful fallback

🟡 Code Quality & Best Practices

4. Hardcoded Route Logic

Location: /[tenantId]/@breadcrumbs/[...slug]/page.tsx:84-87

// This route isn't exist so we don't add it to crumbs list
if (href !== `/${tenantId}/projects/${projectId}/traces/conversations`) {
  crumbs.push({ label, href });
}

Issues:

  • Hardcoded route exclusion indicates architectural inconsistency
  • Should be handled at the route level, not in breadcrumb logic
  • Creates maintenance burden for route changes

5. Mixed Async/Sync Pattern

Location: /[tenantId]/@breadcrumbs/[...slug]/page.tsx:99-102

const fetcher = Object.hasOwn(fetchers, prev)
  ? fetchers[prev as keyof typeof fetchers]
  : undefined;
label = fetcher ? await fetcher(segment) : getStaticLabel(segment);

Issues:

  • Mixing async/sync operations without clear separation
  • Type casting as keyof typeof fetchers bypasses type safety
  • No caching strategy for expensive API calls

🟢 Positive Architectural Decisions

6. Parallel Route Pattern

The choice to use Next.js parallel routes is excellent:

  • ✅ Automatic URL-based breadcrumb generation
  • ✅ Separation of concerns from page components
  • ✅ Leverages Next.js caching and optimization

7. Centralized Label Management

Location: /constants/theme.ts:13-30

export const STATIC_LABELS = Object.freeze({
  projects: 'Projects',
  agents: 'Agents',
  // ... other labels
});

✅ Good pattern for i18n preparation and consistency

8. Layout Integration

Location: /[tenantId]/layout.tsx:16-20

The layout properly receives and renders the breadcrumbs slot, maintaining clean separation of concerns.


🔵 System Design Considerations

9. Scalability Concerns

Current Issues:

  • Each breadcrumb page load triggers multiple API calls
  • No optimization for deeply nested routes
  • Missing request deduplication

Recommendations:

  1. Implement caching strategy: Use React cache() more extensively
  2. Batch API requests: Single request for breadcrumb metadata
  3. Add request deduplication: Prevent duplicate concurrent fetches

10. Consistency with Existing Patterns

Good Alignment:

  • ✅ Follows existing error serialization patterns (getErrorCode)
  • ✅ Uses established API client patterns
  • ✅ Maintains consistent TypeScript conventions

Areas for Improvement:

  • Missing integration with existing loading states
  • No alignment with existing empty state patterns

🔧 Recommended Action Items

High Priority

  1. Fix sequential API calls - Implement parallel fetching strategy
  2. Add proper error boundaries - Graceful degradation instead of breaking chain
  3. Remove hardcoded route exclusions - Handle at route definition level

Medium Priority

  1. Add comprehensive TypeScript types for route validation
  2. Implement caching strategy for API responses
  3. Add loading states for slow breadcrumb fetches

Low Priority

  1. Extract fetcher logic into separate utility module
  2. Add unit tests for breadcrumb generation logic
  3. Document parallel route pattern for future developers

📊 Customer Impact Assessment

Positive Impact:

  • ✅ More consistent breadcrumb experience across all routes
  • ✅ Reduced maintenance burden for breadcrumb management
  • ✅ Better SEO with proper structured navigation

Potential Risks:

  • ⚠️ Performance degradation on deeply nested routes
  • ⚠️ API failure impacts on navigation UX
  • ⚠️ Potential accessibility issues during loading states

This is a solid architectural improvement that modernizes breadcrumb management. The parallel route pattern is the right approach, but the implementation needs refinement around performance optimization and error resilience.

The core concept is excellent - focus on addressing the sequential API calls and error handling patterns to make this production-ready.


let label: string | undefined;
try {
const prev = slug[index - 1];
// this condition is needed until we remove all `/[segment]/new` routes
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change
// this condition is needed until we remove all `/[segment]/new` routes

I think this comment is no longer relevant, since we'll keep /new routes, right @sarah-inkeep ?

const AgentLoading: FC = () => {
return (
<div className="flex p-4">
<div className="flex p-4 no-container">
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change
<div className="flex p-4 no-container">
<div className="flex p-4 no-container">

maybe better class name will be no-parent-container ?

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