mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-11 05:11:49 +01:00
Preserve built-in agent adapter config on reconcile
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
1ee894b3ce
commit
03ab5e07c3
2 files changed
+16
-1
No files matched your search
@@ -163,6 +163,13 @@ describeEmbeddedPostgres("built-in agents", () => {
|
||||
adapterConfig: { model: "gpt-5.4" },
|
||||
});
|
||||
|
||||
const reconciled = await svc.ensure(companyId, "briefs");
|
||||
expect(reconciled.status).toBe("ready");
|
||||
expect(reconciled.agent).toMatchObject({
|
||||
adapterType: "codex_local",
|
||||
adapterConfig: { model: "gpt-5.4" },
|
||||
});
|
||||
|
||||
const rows = await db.select().from(agents).where(eq(agents.companyId, companyId));
|
||||
expect(rows).toHaveLength(1);
|
||||
});
|
||||
|
||||
@@ -1307,8 +1307,16 @@ export function builtInAgentService(db: Db) {
|
||||
async function ensure(companyId: string, key: string, input: BuiltInAgentProvisionInput = {}) {
|
||||
const definition = requireBuiltInAgentDefinition(key);
|
||||
await ensureCompany(companyId);
|
||||
const resolvedInput = await defaultProvisionInput(companyId, definition, input);
|
||||
const existing = await findSingleAgent(companyId, definition);
|
||||
const preserveExistingAdapter = Boolean(
|
||||
existing
|
||||
&& input.adapterType === undefined
|
||||
&& input.adapterConfig === undefined
|
||||
&& hasCompleteAdapterConfig(existing.adapterType, existing.adapterConfig),
|
||||
);
|
||||
const resolvedInput = preserveExistingAdapter
|
||||
? input
|
||||
: await defaultProvisionInput(companyId, definition, input);
|
||||
if (existing) {
|
||||
const patch: Partial<typeof agents.$inferInsert> = {
|
||||
metadata: builtInMetadata(definition, existing.metadata),
|
||||
|
||||
Reference in new issue
Block a user