mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-30 17:14:54 +01:00
feat(antigravity): swarms use the CLI's own default channel, and say which Google account they run on
Google's app and CLI use Google's default channel, where Gemini 4 Neon is offered; Paperclip forced the stable endpoint, which offers no Neon and bills a separately exhausted pool. The swarm route now passes no endpoint override by default. The deployment can pin Google's stable channel with the server env PAPERCLIP_ANTIGRAVITY_SWARM_CHANNEL (provider_default | stable); a Neon refusal on stable names that fix. The start step names the channel, and the Runner compares the CLI's own sign-in (from its log) with the agent's connection as digests only, showing a plain notice when they differ. Also: a resent accepted /swarm returns its original receipt before any availability check, and the request text is used verbatim (the composer removes the one /swarm the user typed). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
22913aed7a
commit
48caed2d3a
19 files changed
+284
-45
No files matched your search
@@ -30,7 +30,7 @@ describe.skipIf(!support.supported)("the /swarm request path to the CLI", () =>
|
||||
}, EMBEDDED_POSTGRES_TEST_TIMEOUT_MS);
|
||||
afterAll(async () => { await db?.$client.end(); await database?.cleanup(); });
|
||||
|
||||
it("sends byte for byte the recorded comment minus the command, never a merged wake's agent comment or the description", async () => {
|
||||
it("sends byte for byte the recorded comment (the request the composer sent), never a merged wake's agent comment or the description", async () => {
|
||||
const [company] = await db.insert(companies).values({ name: "Swarm", issuePrefix: `P${randomUUID().slice(0, 4)}` }).returning();
|
||||
const [agent] = await db.insert(agents).values({ companyId: company!.id, name: "Gemma", adapterType: "paperclip_runner",
|
||||
adapterConfig: { provider: "acpx", acpxAgent: "antigravity", model: "gemini-3.8-flash-low" } }).returning();
|
||||
@@ -38,7 +38,7 @@ describe.skipIf(!support.supported)("the /swarm request path to the CLI", () =>
|
||||
status: "todo", assigneeAgentId: agent!.id }).returning();
|
||||
const request = "two helpers write a.txt and b.txt\n\n- keep the spacing\n- then verify";
|
||||
const [comment] = await db.insert(issueComments).values({ companyId: company!.id, issueId: issue!.id, authorType: "user",
|
||||
authorUserId: USER, body: `/swarm ${request}` }).returning();
|
||||
authorUserId: USER, body: request }).returning();
|
||||
await recordAntigravitySwarmRequest(db, { companyId: company!.id, issueId: issue!.id, commentId: comment!.id, userId: USER });
|
||||
const [agentComment] = await db.insert(issueComments).values({ companyId: company!.id, issueId: issue!.id, authorType: "agent",
|
||||
authorAgentId: agent!.id, body: AGENT_COMMENT, createdAt: new Date(Date.now() + 1000) }).returning();
|
||||
@@ -76,7 +76,7 @@ describe.skipIf(!support.supported)("the /swarm request path to the CLI", () =>
|
||||
// What the Runner adds to the prompt before the turn: handoff, wake attachments, queued messages.
|
||||
modelEnvelope.task.prompt = `Earlier session handoff.\n\n${modelEnvelope.task.prompt}\n\nQueued: ${AGENT_COMMENT}`;
|
||||
const sent = `/swarm ${antigravitySwarmRequestText(JSON.stringify(modelEnvelope))}`;
|
||||
expect(sent).toBe(comment!.body);
|
||||
expect(sent).toBe(`/swarm ${comment!.body}`);
|
||||
expect(sent).not.toContain(AGENT_COMMENT);
|
||||
expect(sent).not.toContain(DESCRIPTION);
|
||||
});
|
||||
|
||||
@@ -1357,6 +1357,23 @@ describe("issue comment reopen routes", () => {
|
||||
expect(mockSwarm.record).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("returns the original receipt for an accepted /swarm resent after the setting was turned off, starting nothing twice", async () => {
|
||||
// The first send committed but its response was lost; then the swarm setting was turned off.
|
||||
mockSwarm.refusal.mockResolvedValue("Swarm is not turned on for this Paperclip.");
|
||||
const issue = makeIssue("todo");
|
||||
mockIssueService.getById.mockResolvedValue(issue);
|
||||
const selectFrom = mockDbSelectFrom.getMockImplementation()!;
|
||||
mockDbSelectFrom.mockImplementation((table) => getTableName(table as Parameters<typeof getTableName>[0]) === "issue_comments"
|
||||
? { where: vi.fn(() => Object.assign(Promise.resolve([{ id: "comment-1" }]), { for: async () => [{ id: "comment-1" }] })) } as any
|
||||
: getTableName(table as Parameters<typeof getTableName>[0]) === "activity_log" ? { where: async () => [{ id: "activity-1" }] } as any : selectFrom(table));
|
||||
const response = await request(await installActor(createApp())).post(`/api/issues/${issue.id}/comments`)
|
||||
.send({ body: "two helpers", nativeCommand: "swarm", clientRequestId: "77777777-7777-4777-8777-777777777777" });
|
||||
expect(response.status).toBe(201);
|
||||
expect(response.body.id).toBe("comment-1");
|
||||
expect(mockSwarm.record).not.toHaveBeenCalled();
|
||||
expect(mockHeartbeatService.wakeup).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("accepts a swarm request only from a signed-in user", async () => {
|
||||
mockIssueService.getById.mockResolvedValue(makeIssue("todo"));
|
||||
const res = await request(await installActor(createApp(), { type: "agent", agentId: "33333333-3333-4333-8333-333333333333", companyId: "company-1" }))
|
||||
|
||||
Reference in new issue
Block a user