Skip to content

Conversation

@0xbbjoker
Copy link
Collaborator

@0xbbjoker 0xbbjoker commented Nov 13, 2025

  • Add ownerId field to Agent interface in core types
  • Update agentTable schema to use camelCase alias for owner_id column
  • Update RLS code to use camelCase ownerId property
  • Add integration tests for creating and updating agents with ownerId
  • Ensures TypeScript uses camelCase while maintaining snake_case in database

This change improves type safety and follows JavaScript/TypeScript naming
conventions while maintaining backward compatibility with the database schema.


Note

Adds ownerId to Agent, maps DB owner_id to camelCase, updates RLS usage, and adds integration tests for create/update flows.

  • Core Types:
    • Add optional ownerId to Agent in packages/core/src/types/agent.ts.
  • Plugin SQL:
    • Schema: Map DB column owner_id to camelCase ownerId in packages/plugin-sql/src/schema/agent.ts.
    • RLS: Use agent.ownerId and update assignment writes via { ownerId: ownerId } in packages/plugin-sql/src/rls.ts.
  • Tests:
    • Integration: Add tests for creating, retrieving, and updating ownerId in packages/plugin-sql/src/__tests__/integration/agent.test.ts.

Written by Cursor Bugbot for commit 4697996. This will update automatically on new commits. Configure here.

@graphite-app
Copy link

graphite-app bot commented Nov 13, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • merge-queue-hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 13, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/add-agent-owner-id-field

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@claude
Copy link
Contributor

claude bot commented Nov 13, 2025

Claude finished @0xbbjoker's task —— View job


Code Review Complete ✅

Todo List:

  • Analyze all changed files for security and quality issues
  • Verify test coverage and implementation
  • Check TypeScript types and ElizaOS patterns
  • Review database schema changes
  • Provide actionable feedback

✅ APPROVED - Excellent Implementation

This PR demonstrates high-quality code with comprehensive test coverage. All critical requirements are met:

Key Strengths:

  • Comprehensive Test Coverage: 69 new lines of integration tests covering creation, updates, and retrieval
  • Proper TypeScript Types: Clean ownerId?: UUID addition with no any types
  • Database Schema Safety: Proper camelCase alias mapping (ownerId: uuid('owner_id'))
  • ElizaOS Patterns: Follows existing conventions and imports from @elizaos/core
  • Security: No hardcoded values, proper UUID validation, safe RLS integration

Test Coverage Highlights:

  • Creates agents with ownerId and verifies camelCase retrieval packages/plugin-sql/src/tests/integration/agent.test.ts:235-265
  • Tests ownerId updates with proper validation packages/plugin-sql/src/tests/integration/agent.test.ts:267-302
  • Uses bun test framework correctly (no jest/vitest violations)
  • Proper UUID generation and validation throughout

Technical Implementation:

  • Core Types: Clean addition to Agent interface packages/core/src/types/agent.ts:111
  • Schema Mapping: Proper camelCase alias while maintaining snake_case in DB packages/plugin-sql/src/schema/agent.ts:13
  • RLS Integration: Correctly uses camelCase property in security code packages/plugin-sql/src/rls.ts:226,232

No Issues Found:

  • No security vulnerabilities
  • No hardcoded credentials or SQL injection risks
  • No breaking changes without migration
  • No circular dependencies
  • All imports use proper @elizaos/core patterns

This is a model implementation that follows all ElizaOS best practices. Ready for merge! 🚀


* It includes:
* - `enabled`: A boolean indicating if the agent is currently active or disabled.
* - `status`: The current operational status, typically `AgentStatus.ACTIVE` or `AgentStatus.INACTIVE`.
* - `ownerId`: Optional UUID of the user/entity that owns this agent.
Copy link
Collaborator

Choose a reason for hiding this comment

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

ownerID is not an user or entity.
It is a serverID.

My next PR about entity isolation will change this name. We can merge as is. But if you can change the comment to feat the reality ?

Thanks !

@0xbbjoker 0xbbjoker closed this Nov 17, 2025
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