Skip to content

ordering for fields copy trace and ununsed name field removed#880

Merged
dimaMachina merged 7 commits intomainfrom
fields-copy-trace
Nov 4, 2025
Merged

ordering for fields copy trace and ununsed name field removed#880
dimaMachina merged 7 commits intomainfrom
fields-copy-trace

Conversation

@shagun-singh-inkeep
Copy link
Collaborator

No description provided.

@changeset-bot
Copy link

changeset-bot bot commented Nov 4, 2025

🦋 Changeset detected

Latest commit: 99caa32

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

This PR includes changesets to release 8 packages
Name Type
@inkeep/agents-manage-ui Patch
@inkeep/agents-cli Patch
@inkeep/agents-manage-api Patch
@inkeep/agents-run-api Patch
@inkeep/agents-core Patch
@inkeep/agents-sdk Patch
@inkeep/ai-sdk-provider Patch
@inkeep/create-agents 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

vercel bot commented Nov 4, 2025

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

Project Deployment Preview Comments Updated (UTC)
agents-manage-api Ready Ready Preview Comment Nov 4, 2025 5:10pm
agents-manage-ui Ready Ready Preview Comment Nov 4, 2025 5:10pm
agents-run-api Ready Ready Preview Comment Nov 4, 2025 5:10pm
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
agents-docs Skipped Skipped Nov 4, 2025 5:10pm

@shagun-singh-inkeep shagun-singh-inkeep marked this pull request as ready for review November 4, 2025 13:54
@claude
Copy link
Contributor

claude bot commented Nov 4, 2025

Claude finished @shagun-singh-inkeep's task —— View job


Code Review: Ordering for Fields Copy Trace

I'm conducting a comprehensive architectural and engineering review of this PR.

Todo List:

  • Read and understand the changeset
  • Analyze the trace formatter changes
  • Research existing trace formatting patterns
  • Review system design and architectural considerations
  • Check for customer impact and API consistency
  • Provide final recommendations

Summary

This PR introduces field ordering for trace export functionality in the agents management UI. The changes add consistent field prioritization to JSON output when users copy trace data to clipboard, ensuring important fields (type, description, status, timestamp) appear first, followed by alphabetically sorted remaining fields.

Engineering Review

Architecture & Design ⚠️

1. Hardcoded Priority Fields
The PRIORITY_FIELDS constant is defined inline without configuration options or extensibility:

const PRIORITY_FIELDS = ['type', 'description', 'status','timestamp'];

Considerations:

  • Evolvability: Adding new priority fields requires code changes
  • Configuration: No mechanism for different contexts to have different field priorities
  • Recommendation: Consider making this configurable or at least document the rationale for these specific fields

2. Type Safety Concerns
The orderObjectKeys function uses weak typing:

function orderObjectKeys<T extends Record<string, any>>(obj: T): T

Issues:

  • Uses any type, losing type safety benefits
  • No validation that priority fields actually exist on the object
  • Recommendation: Consider stricter typing or at least runtime validation

Code Quality ⚠️

1. Missing Space in Priority Fields Array

const PRIORITY_FIELDS = ['type', 'description', 'status','timestamp'];
//                                                    ^ missing space

2. Inconsistent Field Exclusion
The timeline mapping now excludes both id and name but only id was excluded before:

// Before: { id: _id, ...rest }
// After:  { id: _id, name: _name, ...rest }

Questions:

  • Why was name excluded? This seems unrelated to the ordering feature
  • Is this a breaking change for consumers expecting the name field?
  • Recommendation: Document this change or consider it a separate concern

Performance

The performance impact is minimal and appropriate:

  • O(n log n) for sorting, where n is the number of fields per activity
  • Only processes fields that exist, avoiding unnecessary work
  • Acceptable for the clipboard copy use case

Customer Impact ⚠️

1. Data Contract Changes
Removing the name field from timeline activities could be a breaking change:

// Activities no longer include 'name' field in exported JSON
const { id: _id, name: _name, ...rest } = activity;

2. Usability Improvements
The ordered fields provide better readability for users examining exported traces, which is positive for debugging workflows.

System Design Considerations ⚠️

1. Lack of Extensibility
The current approach doesn't account for:

  • Different field priorities for different activity types
  • Context-specific ordering (e.g., debugging vs. auditing)
  • Future field additions to the ActivityItem interface

2. Missing Validation
No validation ensures that priority fields actually exist on the objects being processed.

3. Single Responsibility Concern
The formatConversationAsPrettifiedTrace function now handles both data transformation and field ordering, which could be separated for better testability.

Testing & Reliability

Critical Issue: No Tests
This utility has no test coverage, which is concerning for a data transformation function that:

  • Processes complex nested objects
  • Has specific ordering logic
  • Is used in user-facing features (clipboard copy)

Recommendations:

  • Add unit tests for orderObjectKeys function
  • Test edge cases (empty objects, missing priority fields)
  • Integration tests for the full formatting pipeline
  • Consider property-based tests for ordering invariants

Documentation ⚠️

The code has decent inline documentation but lacks:

  • Examples of expected input/output
  • Rationale for the specific priority field choices
  • Impact documentation for the name field removal

Recommendations

High Priority

  1. Add comprehensive test coverage - Essential for data transformation logic
  2. Document the name field removal - Clarify if this is intentional and breaking
  3. Fix formatting issue - Add missing space in PRIORITY_FIELDS

Medium Priority

  1. Consider configuration - Make field priorities configurable for future extensibility
  2. Improve type safety - Replace any with more specific types
  3. Add validation - Ensure priority fields exist before processing
  4. Separate concerns - Consider extracting ordering logic to its own utility

Low Priority

  1. Performance optimization - Could cache priority field indices for repeated calls
  2. Enhanced documentation - Add usage examples and rationale

Conclusion

This is a straightforward improvement to user experience with good intentions, but it has some architectural concerns around extensibility and testing. The functionality works as intended, but the implementation could be more robust and future-proof.

The most critical issue is the lack of test coverage for a data transformation utility that users depend on for debugging workflows. Consider this a blocking concern for production release.


@vercel vercel bot temporarily deployed to Preview – agents-docs November 4, 2025 16:20 Inactive
@shagun-singh-inkeep shagun-singh-inkeep changed the title ordering for fields copy trace ordering for fields copy trace and ununsed name field remove Nov 4, 2025
@shagun-singh-inkeep shagun-singh-inkeep changed the title ordering for fields copy trace and ununsed name field remove ordering for fields copy trace and ununsed name field removed Nov 4, 2025
@vercel vercel bot temporarily deployed to Preview – agents-docs November 4, 2025 17:08 Inactive
@dimaMachina dimaMachina merged commit 48a3e3e into main Nov 4, 2025
8 checks passed
@dimaMachina dimaMachina deleted the fields-copy-trace branch November 4, 2025 17:14
nick-inkeep added a commit that referenced this pull request Feb 4, 2026
SDK versions 0.2.27+ have a bug causing AJV validation crashes
before any API calls are made. This affects all PR reviews.

Tracking issue: anthropics/claude-code-action#892
Related: #852, #880, #804

Will revert to @v1 when the upstream issue is resolved.
nick-inkeep added a commit that referenced this pull request Feb 4, 2026
SDK versions 0.2.27+ have a bug causing AJV validation crashes
before any API calls are made. This affects all PR reviews.

Tracking issue: anthropics/claude-code-action#892
Related: #852, #880, #804

Will revert to @v1 when the upstream issue is resolved.
dimaMachina pushed a commit that referenced this pull request Feb 5, 2026
SDK versions 0.2.27+ have a bug causing AJV validation crashes
before any API calls are made. This affects all PR reviews.

Tracking issue: anthropics/claude-code-action#892
Related: #852, #880, #804

Will revert to @v1 when the upstream issue is resolved.
dimaMachina added a commit that referenced this pull request Feb 5, 2026
…chat or if custom headers are invalid (#1699)

* upd

* upd

* upd

* upd

* upd

* upd

* upd

* typecheck is ok now

* wip custom headers dialog

* upddd

* upddd

* upddd

* brand color

* upd

* validate on mount

* polish

* fix lint

* format

* review fixes

* feat(pr-review): add clickable links to inline comments in review summary (#1714)

- Add `url` field to GraphQL queries for review threads and PR comments
- Add Phase 5.4 to capture inline comment URLs after posting
- Update Point-Fix Edits section to include clickable links
- Update Pending Recommendations to use URLs from pr-context skill
- Add `gh api` to allowed tools for fetching comment URLs
- Add secure debug artifact uploads for Claude review runs

* Revert "fix(agents-core): remove refine call in resource id schema (#1689)" (#1691)

This reverts commit 938ffb8.

* fix: pin claude-code-action to SDK 0.2.25 to avoid AJV crash (#1716)

SDK versions 0.2.27+ have a bug causing AJV validation crashes
before any API calls are made. This affects all PR reviews.

Tracking issue: anthropics/claude-code-action#892
Related: #852, #880, #804

Will revert to @v1 when the upstream issue is resolved.

* bump zod to latest 4.3.6 and fix `.omit() cannot be used on object schemas containing refinements` error (#1712)

* Revert "fix(agents-core): remove refine call in resource id schema (#1689)"

This reverts commit 938ffb8.

* Revert "fix(agents-core): remove refine call in resource id schema (#1689)"

This reverts commit 938ffb8.

* bump

* upd

* remove zod from pnpm overrides

* update zod peerdependencies too, and we have error reproducible locally

* minimal fix

* rm unrelated changes

* rm unrelated changes

* rm unrelated changes

* rm unrelated changes

* rm unrelated changes

* rm unrelated changes

* rm unrelated changes

* rm unrelated changes

* Version Packages (#1701)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* feat: add Vercel production deployment workflow (#1679)

* feat: add Vercel production deployment workflow

Add GitHub Actions workflow to deploy to Vercel production only when
a GitHub release is published. This integrates with the existing
changesets release flow.

* feat: add deployment checks before promoting to production

Deploy to preview URL first, wait for Vercel deployment checks to pass,
then promote to production. This ensures API health before going live.

* PRD for vercel deployment strategy

* docs: add Vercel staging/production deployment strategy documentation

- Document Production Branch configuration (set to '_disabled_')
- Document GitHub Actions workflow for release-triggered deployments
- Document required secrets (VERCEL_TOKEN, VERCEL_ORG_ID, VERCEL_PROJECT_ID)
- Document optional staging domain configuration
- Add deployment flow diagram and troubleshooting section
- Add secrets documentation comments to workflow file

Completes US-001, US-002, US-003, US-004 from vercel-deployment-strategy PRD.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: update Vercel staging/production strategy to use never-deploy branch

Replace _disabled_ approach (which Vercel doesn't support) with a
never-deploy orphan branch. Update staging domain examples to use
api-staging.agents.yourdomain.com pattern.

* Apply suggestion from @claude[bot]

Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>

* revert: remove Vercel deployment docs changes and PRD

Revert vercel.mdx to main branch version and remove the PRD file.

* feat: deploy both agents-api and agents-manage-ui to Vercel

Update production workflow to deploy both projects in parallel using a
matrix strategy. Each project uses its own secret for the Vercel project ID.

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>

* remove cursor specific rules in favor or skills and agents.md (#1717)

* chore: trigger release for all packages (#1718)

No-op patch bumps to trigger a new release.

* Version Packages (#1719)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* updating release action (#1720)

* fix: add --scope flag to Vercel CLI commands in production workflow (#1721)

The vercel inspect and promote commands were failing with authorization
errors because VERCEL_ORG_ID as an environment variable isn't used by
the CLI for scope resolution - it requires the --scope flag explicitly.

* fix: use staged production deployments in Vercel workflow (#1722)

- Deploy with --prod --skip-domain to create staged production builds
- This ensures production env vars are used and avoids rebuild on promote
- Add --yes flag to auto-confirm prompts in CI environment
- Fixes issue where promoting preview deployments triggered interactive prompt

* fix: add --archive=tgz to prevent CLI hanging during deploy (#1724)

Large file uploads can cause the Vercel CLI to hang. The --archive=tgz
flag compresses files before upload which resolves this issue.

* fix: use repository variables instead of secrets for non-sensitive values (#1723)

Move TURBO_TEAM and VERCEL_ORG_ID from secrets to vars to prevent
GitHub Actions from masking these values in logs. Secret values are
automatically masked, which was causing "inkeep" to appear as "***"
throughout CI logs.

* fix: simplify Vercel workflow to use direct production deploy (#1725)

- Remove --skip-domain flag which was causing CLI to hang
- Remove separate promote step (--prod auto-assigns domains)
- Simpler, more reliable workflow

* fix: use secrets for VERCEL_ORG_ID (#1726)

* apply review

* pnpm i

* polish

* format

* Rename convert-json-schema-to-zod.ts to convert-json-schema-to-zod.test.ts

* add tests

* wip tests

* wip tests

* wip tests

* upd

* upd

* upd

* upd

* polish error names

* upd

* move to __tests__

* format

* chore: add changeset for custom headers validation feature

Co-authored-by: Dimitri POSTOLOV <undefined@users.noreply.github.com>

---------

Co-authored-by: Nick Gomez <122398915+nick-inkeep@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Andrew Mikofalvy <5668128+amikofalvy@users.noreply.github.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Dimitri POSTOLOV <undefined@users.noreply.github.com>
dimaMachina added a commit that referenced this pull request Feb 5, 2026
…fromJSONSchema()` method (#1735)

* upd

* upd

* upd

* upd

* upd

* upd

* upd

* typecheck is ok now

* wip custom headers dialog

* upddd

* upddd

* upddd

* brand color

* upd

* validate on mount

* polish

* fix lint

* format

* review fixes

* feat(pr-review): add clickable links to inline comments in review summary (#1714)

- Add `url` field to GraphQL queries for review threads and PR comments
- Add Phase 5.4 to capture inline comment URLs after posting
- Update Point-Fix Edits section to include clickable links
- Update Pending Recommendations to use URLs from pr-context skill
- Add `gh api` to allowed tools for fetching comment URLs
- Add secure debug artifact uploads for Claude review runs

* Revert "fix(agents-core): remove refine call in resource id schema (#1689)" (#1691)

This reverts commit 938ffb8.

* fix: pin claude-code-action to SDK 0.2.25 to avoid AJV crash (#1716)

SDK versions 0.2.27+ have a bug causing AJV validation crashes
before any API calls are made. This affects all PR reviews.

Tracking issue: anthropics/claude-code-action#892
Related: #852, #880, #804

Will revert to @v1 when the upstream issue is resolved.

* bump zod to latest 4.3.6 and fix `.omit() cannot be used on object schemas containing refinements` error (#1712)

* Revert "fix(agents-core): remove refine call in resource id schema (#1689)"

This reverts commit 938ffb8.

* Revert "fix(agents-core): remove refine call in resource id schema (#1689)"

This reverts commit 938ffb8.

* bump

* upd

* remove zod from pnpm overrides

* update zod peerdependencies too, and we have error reproducible locally

* minimal fix

* rm unrelated changes

* rm unrelated changes

* rm unrelated changes

* rm unrelated changes

* rm unrelated changes

* rm unrelated changes

* rm unrelated changes

* rm unrelated changes

* Version Packages (#1701)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* feat: add Vercel production deployment workflow (#1679)

* feat: add Vercel production deployment workflow

Add GitHub Actions workflow to deploy to Vercel production only when
a GitHub release is published. This integrates with the existing
changesets release flow.

* feat: add deployment checks before promoting to production

Deploy to preview URL first, wait for Vercel deployment checks to pass,
then promote to production. This ensures API health before going live.

* PRD for vercel deployment strategy

* docs: add Vercel staging/production deployment strategy documentation

- Document Production Branch configuration (set to '_disabled_')
- Document GitHub Actions workflow for release-triggered deployments
- Document required secrets (VERCEL_TOKEN, VERCEL_ORG_ID, VERCEL_PROJECT_ID)
- Document optional staging domain configuration
- Add deployment flow diagram and troubleshooting section
- Add secrets documentation comments to workflow file

Completes US-001, US-002, US-003, US-004 from vercel-deployment-strategy PRD.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: update Vercel staging/production strategy to use never-deploy branch

Replace _disabled_ approach (which Vercel doesn't support) with a
never-deploy orphan branch. Update staging domain examples to use
api-staging.agents.yourdomain.com pattern.

* Apply suggestion from @claude[bot]

Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>

* revert: remove Vercel deployment docs changes and PRD

Revert vercel.mdx to main branch version and remove the PRD file.

* feat: deploy both agents-api and agents-manage-ui to Vercel

Update production workflow to deploy both projects in parallel using a
matrix strategy. Each project uses its own secret for the Vercel project ID.

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>

* remove cursor specific rules in favor or skills and agents.md (#1717)

* chore: trigger release for all packages (#1718)

No-op patch bumps to trigger a new release.

* Version Packages (#1719)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* updating release action (#1720)

* fix: add --scope flag to Vercel CLI commands in production workflow (#1721)

The vercel inspect and promote commands were failing with authorization
errors because VERCEL_ORG_ID as an environment variable isn't used by
the CLI for scope resolution - it requires the --scope flag explicitly.

* fix: use staged production deployments in Vercel workflow (#1722)

- Deploy with --prod --skip-domain to create staged production builds
- This ensures production env vars are used and avoids rebuild on promote
- Add --yes flag to auto-confirm prompts in CI environment
- Fixes issue where promoting preview deployments triggered interactive prompt

* fix: add --archive=tgz to prevent CLI hanging during deploy (#1724)

Large file uploads can cause the Vercel CLI to hang. The --archive=tgz
flag compresses files before upload which resolves this issue.

* fix: use repository variables instead of secrets for non-sensitive values (#1723)

Move TURBO_TEAM and VERCEL_ORG_ID from secrets to vars to prevent
GitHub Actions from masking these values in logs. Secret values are
automatically masked, which was causing "inkeep" to appear as "***"
throughout CI logs.

* fix: simplify Vercel workflow to use direct production deploy (#1725)

- Remove --skip-domain flag which was causing CLI to hang
- Remove separate promote step (--prod auto-assigns domains)
- Simpler, more reliable workflow

* fix: use secrets for VERCEL_ORG_ID (#1726)

* apply review

* pnpm i

* polish

* format

* Rename convert-json-schema-to-zod.ts to convert-json-schema-to-zod.test.ts

* add tests

* wip tests

* wip tests

* wip tests

* upd

* upd

* upd

* upd

* polish error names

* upd

* move to __tests__

* rm jsonSchemaToZod

* rm jsonSchemaToZod

* rm jsonSchemaToZod

* rm jsonSchemaToZod

* format

* chore: add changeset for custom headers validation feature

Co-authored-by: Dimitri POSTOLOV <undefined@users.noreply.github.com>

* chore: add changeset for jsonSchemaToZod removal

Replace custom implementation with Zod's native z.fromJSONSchema() method

Co-authored-by: Dimitri POSTOLOV <dimaMachina@users.noreply.github.com>

* fix lint

* Update validation.test.ts

---------

Co-authored-by: Nick Gomez <122398915+nick-inkeep@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Andrew Mikofalvy <5668128+amikofalvy@users.noreply.github.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Dimitri POSTOLOV <undefined@users.noreply.github.com>
Co-authored-by: Dimitri POSTOLOV <dimaMachina@users.noreply.github.com>
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.

3 participants

Comments