Skip to content

♻️ refactor: createAgent uses agentModel.create directly#13871

Merged
arvinxx merged 4 commits into
canaryfrom
refactor/create-agent-without-session
Apr 16, 2026
Merged

♻️ refactor: createAgent uses agentModel.create directly#13871
arvinxx merged 4 commits into
canaryfrom
refactor/create-agent-without-session

Conversation

@arvinxx

@arvinxx arvinxx commented Apr 16, 2026

Copy link
Copy Markdown
Member

Summary

  • createAgent router was still going through sessionModel.create, a legacy path that doesn't pass all agent fields (like agencyConfig) to the agents table
  • Switched to agentModel.create which directly inserts into the agents table with full field support
  • Removed sessionId from CreateAgentResult since sessions are no longer created

Test plan

  • Create a new agent via the sidebar + menu
  • Verify agent is created correctly with all config fields
  • Verify agent profile page loads correctly after creation

🤖 Generated with Claude Code

@vercel

vercel Bot commented Apr 16, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
lobehub Ready Ready Preview, Comment Apr 16, 2026 4:56am

Request Review

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We've reviewed this pull request using the Sourcery rules engine

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 35d049aa78

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/server/routers/lambda/agent.ts Outdated
The createAgent router was still going through sessionModel.create,
which is a legacy path that doesn't pass all agent fields (like
agencyConfig) to the agents table. Switch to agentModel.create
which directly inserts into the agents table with full field support.

- Add CreateAgentSchema in types package for proper input validation
- Remove dependency on insertAgentSchema from database package
- Remove sessionId from CreateAgentResult

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Apr 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 33.33333% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.76%. Comparing base (9583de8) to head (6d2dd5a).
⚠️ Report is 1 commits behind head on canary.

Additional details and impacted files
@@            Coverage Diff            @@
##           canary   #13871     +/-   ##
=========================================
  Coverage   66.76%   66.76%             
=========================================
  Files        2043     2043             
  Lines      174032   174015     -17     
  Branches    17138    20441   +3303     
=========================================
- Hits       116184   116174     -10     
+ Misses      57724    57717      -7     
  Partials      124      124             
Flag Coverage Δ
app 59.05% <33.33%> (+<0.01%) ⬆️
database 92.42% <ø> (ø)
packages/agent-runtime 79.72% <ø> (ø)
packages/context-engine 83.22% <ø> (ø)
packages/conversation-flow 92.36% <ø> (ø)
packages/file-loaders 87.02% <ø> (ø)
packages/memory-user-memory 74.74% <ø> (ø)
packages/model-bank 99.86% <ø> (ø)
packages/model-runtime 84.20% <ø> (ø)
packages/prompts 69.24% <ø> (ø)
packages/python-interpreter 92.90% <ø> (ø)
packages/ssrf-safe-fetch 0.00% <ø> (ø)
packages/utils 90.34% <ø> (ø)
packages/web-crawler 88.66% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Store 66.11% <ø> (+<0.01%) ⬆️
Services 52.13% <ø> (ø)
Server 66.77% <33.33%> (+<0.01%) ⬆️
Libs 51.29% <ø> (ø)
Utils 91.12% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@arvinxx arvinxx force-pushed the refactor/create-agent-without-session branch from 35d049a to 559322d Compare April 16, 2026 04:34
@arvinxx arvinxx changed the title ♻️ refactor: createAgent uses agentModel.create directly ♻️ refactor: createAgent uses agentModel.create directly Apr 16, 2026
arvinxx and others added 3 commits April 16, 2026 12:39
Add @deprecated JSDoc tags to the legacy session-based agent creation
path (session router, SessionService, SessionModel.create, session store,
insertAgentSchema). New code should use agent.createAgent / agentModel.create
directly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Pass input.groupId as sessionGroupId to agentModel.create so that
agents created from a sidebar folder are correctly assigned to that group.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove sessionId fallback in AddAgent.tsx and ForkAndChat.tsx
- Use z.custom<T>() for agencyConfig and tts in CreateAgentSchema
  to match agentModel.create parameter types

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@arvinxx arvinxx merged commit 4203e32 into canary Apr 16, 2026
33 of 34 checks passed
@arvinxx arvinxx deleted the refactor/create-agent-without-session branch April 16, 2026 05:10
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