mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-23 00:53:38 +02:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Paperclip runs agents through provider-specific adapters in local and remote environments > - A remote Grok run can refresh its credential inside its sandbox > - The host copy can become stale when teardown discards that refreshed credential > - This pull request copies the refreshed credential back through a locked, fail-closed teardown path > - The benefit is that later Grok runs can use the refreshed host credential without another login ## Linked Issues or Issue Description Refs: #12618 **Agent or provider** Grok local adapter. **Why this adapter is useful** A remote Grok run can refresh its access token during a run. Copying the refreshed credential back to the host keeps later runs ready to use. **How the agent is invoked** Paperclip invokes the Grok local adapter through its remote subscription run path. The adapter stages the company Grok home as a sandbox asset. The change adds a copy-out step on the teardown path. ## What Changed - `grok-auth-merge-decision.cjs` adds a host predicate in its own process. It compares the whole `<issuer>::<uuid>` identity key of the two files. It reads `expires_at` as an ISO-8601 string, an epoch-seconds number, or an epoch-milliseconds number. It exits 10 to use the source, 20 to keep the destination, 21 when the expiry shape is unreadable, and 22 when the source expiry sits more than 400 days after the host clock. It fails closed in every unclear case: an unusable side, a different identity, an absent expiry, a tie, an unreadable expiry, and an implausible expiry all keep the destination. - `grok-auth-merge-decision.ts` adds a wrapper that runs the predicate and maps the exit code to a typed result. - `grok-auth-copyback.ts` adds `copyBackGrokAuth({ hostHomeDir, readSandboxAuth, log, env })`. It locks on `hostHomeDir` with `withDirectoryMergeLock`, stages the sandbox bytes into a private `0600` temporary file, runs the predicate, and installs the file with an atomic rename in the same directory. It keeps no backup of the displaced credential. It leaves no temporary file on the success path, the keep path, or an error path. On an error it logs the `errno` code only, then re-throws. - `execute.ts` adds a `restore` callback to the Grok `home` asset. The callback takes the destination from `resolveManagedGrokHomeDir(process.env, agent.companyId)`, never from `env.GROK_HOME`. A copy-out failure does not fail the run. - `package.json` updates the `build` script to copy `grok-auth-merge-decision.cjs` into `dist/server/`, because `tsc` does not copy a `.cjs` file. **The credential shape this predicate reads** A redacted sample of a real vendor credential answered four structural questions. The answers hold no credential bytes, no account identifier, no file path, and no timestamp value. 1. `expires_at` is present. 2. `expires_at` sits inside the value object, under the `<issuer>::<uuid>` key. It is not a top-level field. 3. `expires_at` is an ISO-8601 string. It carries UTC time with a trailing `Z` and six fractional-second digits. 4. A normal run rewrites `auth.json`. The value object carries a `refresh_token` next to `expires_at`, so the client refreshes the access token and rewrites the file. ## Verification - [x] `pnpm vitest run packages/adapters/grok-local` — 114 tests in 12 files pass. - [x] `pnpm --filter @paperclipai/adapter-grok-local typecheck` — clean. - [x] `pnpm --filter @paperclipai/adapter-grok-local build` — succeeds, and `dist/server/grok-auth-merge-decision.cjs` exists after the build. - [x] Continuous integration is green on every check. ## Risks The predicate keeps the host credential when identity, expiry, file access, or freshness data is unclear. The copy-out path can log an error and leave the run successful when it cannot install the refreshed credential. The atomic rename and directory lock protect the host file from partial writes and concurrent copy-out actions. ## Model Used OpenAI GPT-5, current deployment. The exact runtime version and context window are not exposed to this agent. The model used tool calls and code inspection. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing>
509 lines
17 KiB
TypeScript
509 lines
17 KiB
TypeScript
import { randomUUID } from "node:crypto";
|
|
import { afterAll, afterEach, beforeAll, describe, expect, it, vi } from "vitest";
|
|
import { eq, sql } from "drizzle-orm";
|
|
|
|
import {
|
|
activityLog,
|
|
agents,
|
|
companies,
|
|
createDb,
|
|
heartbeatRuns,
|
|
issueQuestionResponseDeliveries,
|
|
issueThreadInteractions,
|
|
issues,
|
|
nativeRunFinalizations,
|
|
} from "@paperclipai/db";
|
|
import type { PrpEvent } from "@paperclipai/paperclip-runner";
|
|
|
|
import {
|
|
getEmbeddedPostgresTestSupport,
|
|
startEmbeddedPostgresTestDatabase,
|
|
} from "../../__tests__/helpers/embedded-postgres.js";
|
|
import { drainHeartbeatRunsToQuiescence } from "../../__tests__/helpers/drain-heartbeat-runs.js";
|
|
import { issueThreadInteractionService } from "../issue-thread-interactions.js";
|
|
import {
|
|
deliverNativeQuestionResponse,
|
|
flushNativeQuestionResponses,
|
|
nativeQuestionBridgeInternals,
|
|
nativeQuestionRunToCancel,
|
|
projectNativeRuntimeRequest,
|
|
registerNativeQuestionCommandTarget,
|
|
requestNativeQuestionRunCancellation,
|
|
validateNativeQuestionResponseInput,
|
|
} from "./native-question-bridge.js";
|
|
import {
|
|
executeIssuePostCommitActions,
|
|
issueService,
|
|
type IssuePostCommitAction,
|
|
} from "../issues.js";
|
|
import { heartbeatService } from "../heartbeat.js";
|
|
|
|
const embeddedPostgresSupport = await getEmbeddedPostgresTestSupport();
|
|
const describeEmbeddedPostgres = embeddedPostgresSupport.supported ? describe : describe.skip;
|
|
|
|
if (!embeddedPostgresSupport.supported) {
|
|
console.warn(
|
|
`Skipping native question bridge tests on this host: ${embeddedPostgresSupport.reason ?? "unsupported environment"}`,
|
|
);
|
|
}
|
|
|
|
describeEmbeddedPostgres("native question bridge", () => {
|
|
let temporary: Awaited<ReturnType<typeof startEmbeddedPostgresTestDatabase>> | null = null;
|
|
let db: ReturnType<typeof createDb>;
|
|
let heartbeat: ReturnType<typeof heartbeatService>;
|
|
let companyId: string;
|
|
let issueId: string;
|
|
let agentId: string;
|
|
let runId: string;
|
|
let sessionId: string;
|
|
let runnerInstanceId: string;
|
|
|
|
beforeAll(async () => {
|
|
temporary = await startEmbeddedPostgresTestDatabase("paperclip-native-question-");
|
|
db = createDb(temporary.connectionString);
|
|
heartbeat = heartbeatService(db);
|
|
}, 20_000);
|
|
|
|
afterEach(async () => {
|
|
// A cancelled or reaped run can promote and dispatch its agent's next
|
|
// queued run fire-and-forget (see startNextQueuedRunForAgent in
|
|
// heartbeat.ts), so that dispatch can still be writing heartbeat_runs,
|
|
// issues, or activity_log rows when this hook starts. Drain every
|
|
// in-flight run to quiescence first, or its late write races the
|
|
// TRUNCATE below and can deadlock.
|
|
await drainHeartbeatRunsToQuiescence(db, heartbeat);
|
|
nativeQuestionBridgeInternals.resetForTests();
|
|
await db.execute(sql.raw(`
|
|
TRUNCATE TABLE
|
|
"activity_log",
|
|
"issue_thread_interactions",
|
|
"heartbeat_runs",
|
|
"agent_wakeup_requests",
|
|
"issues",
|
|
"agents",
|
|
"companies"
|
|
RESTART IDENTITY CASCADE
|
|
`));
|
|
});
|
|
|
|
afterAll(async () => temporary?.cleanup());
|
|
|
|
async function seed() {
|
|
companyId = randomUUID();
|
|
issueId = randomUUID();
|
|
agentId = randomUUID();
|
|
runId = randomUUID();
|
|
sessionId = randomUUID();
|
|
runnerInstanceId = randomUUID();
|
|
await db.insert(companies).values({
|
|
id: companyId,
|
|
name: "Native questions",
|
|
issuePrefix: `NQ${companyId.replaceAll("-", "").slice(0, 6).toUpperCase()}`,
|
|
requireBoardApprovalForNewAgents: false,
|
|
});
|
|
await db.insert(agents).values({
|
|
id: agentId,
|
|
companyId,
|
|
name: "Native Codex",
|
|
adapterType: "paperclip_runner",
|
|
status: "running",
|
|
adapterConfig: { provider: "codex" },
|
|
runtimeConfig: {},
|
|
});
|
|
await db.insert(issues).values({
|
|
id: issueId,
|
|
companyId,
|
|
title: "Answer a native question",
|
|
status: "in_progress",
|
|
assigneeAgentId: agentId,
|
|
responsibleUserId: "operator-1",
|
|
});
|
|
await db.insert(heartbeatRuns).values({
|
|
id: runId,
|
|
companyId,
|
|
agentId,
|
|
status: "running",
|
|
runtimeMode: "native",
|
|
runtimeModeResolvedAt: new Date(),
|
|
nativeIssueId: issueId,
|
|
nativeSessionId: sessionId,
|
|
runnerInstanceId,
|
|
driverKind: "codex",
|
|
contextSnapshot: { issueId },
|
|
});
|
|
await db.insert(nativeRunFinalizations).values({
|
|
runId,
|
|
companyId,
|
|
issueId,
|
|
phase: "observed",
|
|
});
|
|
}
|
|
|
|
function runtimeRequestEvent(): PrpEvent {
|
|
return {
|
|
schema: "paperclip.prp.event.v1",
|
|
sourceEventId: "runtime-question-1",
|
|
sourceSeq: 1,
|
|
sourceInstanceId: runnerInstanceId,
|
|
sourceKind: "runner",
|
|
runId,
|
|
normalizedSessionId: sessionId,
|
|
turnId: "turn-1",
|
|
itemId: "item-1",
|
|
eventType: "runtime_request.created",
|
|
schemaVersion: 1,
|
|
priority: 0,
|
|
emittedAt: "2026-08-25T18:00:00.000Z",
|
|
payload: {
|
|
request: {
|
|
schema: "paperclip.runtime_request.v2",
|
|
requestKind: "runtime",
|
|
requestId: "request-1",
|
|
type: "input",
|
|
status: "pending",
|
|
prompt: "Choose a deployment color",
|
|
input: {
|
|
schema: "paperclip.question_set.v1",
|
|
title: "Deployment",
|
|
questions: [{
|
|
id: "color",
|
|
prompt: "Which color?",
|
|
required: true,
|
|
answerMode: "single_select",
|
|
options: [
|
|
{ id: "blue", label: "Blue" },
|
|
{ id: "green", label: "Green" },
|
|
],
|
|
}],
|
|
},
|
|
},
|
|
},
|
|
};
|
|
}
|
|
|
|
function binding() {
|
|
return {
|
|
companyId,
|
|
issueId,
|
|
runId,
|
|
agentId,
|
|
normalizedSessionId: sessionId,
|
|
runnerSourceInstanceId: runnerInstanceId,
|
|
completionContractId: randomUUID(),
|
|
completionContractSha256: `sha256:${"a".repeat(64)}`,
|
|
completionContractRevision: "1",
|
|
completionContractCriterionIds: [],
|
|
};
|
|
}
|
|
|
|
it("materializes, validates, and durably resumes a provider-neutral question response", async () => {
|
|
await seed();
|
|
const interaction = await projectNativeRuntimeRequest({
|
|
db,
|
|
binding: binding(),
|
|
event: runtimeRequestEvent(),
|
|
});
|
|
|
|
expect(interaction).toMatchObject({
|
|
kind: "ask_user_questions",
|
|
status: "pending",
|
|
sourceRunId: runId,
|
|
continuationPolicy: "none",
|
|
effectiveResolverPolicy: "human_only",
|
|
payload: {
|
|
runtimeRequestId: "request-1",
|
|
supersedeOnUserComment: false,
|
|
questionSet: { schema: "paperclip.question_set.v1" },
|
|
questions: [{
|
|
id: "color",
|
|
selectionMode: "single",
|
|
allowOther: false,
|
|
options: [{ id: "blue", label: "Blue" }, { id: "green", label: "Green" }],
|
|
}],
|
|
},
|
|
});
|
|
expect(await db.select().from(activityLog)).toHaveLength(1);
|
|
|
|
const answer = { answers: [{ questionId: "color", optionIds: ["blue"] }] };
|
|
validateNativeQuestionResponseInput(interaction!, answer);
|
|
expect(() => validateNativeQuestionResponseInput(interaction!, {
|
|
answers: [{ questionId: "color", optionIds: ["red"] }],
|
|
})).toThrow(/unknown option red/);
|
|
|
|
const answered = await issueThreadInteractionService(db).answerQuestions(
|
|
{ id: issueId, companyId, status: "in_progress" },
|
|
interaction!.id,
|
|
answer,
|
|
{ userId: "operator-1" },
|
|
);
|
|
const queueCommand = vi.fn(() => ({ commandId: "question", controllerSeq: 1 }));
|
|
const release = registerNativeQuestionCommandTarget({
|
|
binding: { companyId, issueId, runId, agentId },
|
|
queueCommand,
|
|
});
|
|
|
|
await flushNativeQuestionResponses(db, runId);
|
|
expect(queueCommand).toHaveBeenCalledWith(
|
|
"request.resolve",
|
|
{
|
|
requestId: "request-1",
|
|
response: {
|
|
schema: "paperclip.question_response.v1",
|
|
answers: { color: { selectedOptionIds: ["blue"] } },
|
|
},
|
|
},
|
|
`question_${interaction!.id}`,
|
|
);
|
|
expect(queueCommand).toHaveBeenCalledTimes(1);
|
|
const [delivery] = await db.select().from(issueQuestionResponseDeliveries);
|
|
expect(delivery).toMatchObject({
|
|
interactionId: interaction!.id,
|
|
status: "delivered",
|
|
deliveryMode: "steered",
|
|
targetRunId: runId,
|
|
});
|
|
expect(answered.kind).toBe("ask_user_questions");
|
|
if (answered.kind !== "ask_user_questions") throw new Error("expected question interaction");
|
|
await expect(nativeQuestionRunToCancel(db, answered)).resolves.toBe(runId);
|
|
release();
|
|
});
|
|
|
|
it("binds projection to the persisted native run and ignores legacy delivery", async () => {
|
|
await seed();
|
|
const mismatched = runtimeRequestEvent();
|
|
mismatched.runId = randomUUID();
|
|
await expect(projectNativeRuntimeRequest({ db, binding: binding(), event: mismatched }))
|
|
.rejects.toThrow("native_runtime_request_binding_mismatch");
|
|
|
|
const interaction = await projectNativeRuntimeRequest({
|
|
db,
|
|
binding: binding(),
|
|
event: runtimeRequestEvent(),
|
|
});
|
|
const answered = await issueThreadInteractionService(db).answerQuestions(
|
|
{ id: issueId, companyId, status: "in_progress" },
|
|
interaction!.id,
|
|
{ answers: [{ questionId: "color", optionIds: ["green"] }] },
|
|
{ userId: "operator-1" },
|
|
);
|
|
await db.update(heartbeatRuns).set({ runtimeMode: "legacy" }).where(eq(heartbeatRuns.id, runId));
|
|
expect(answered.kind).toBe("ask_user_questions");
|
|
if (answered.kind !== "ask_user_questions") throw new Error("expected question interaction");
|
|
await expect(deliverNativeQuestionResponse(db, answered)).resolves.toBe("not_native");
|
|
await expect(nativeQuestionRunToCancel(db, answered)).resolves.toBeNull();
|
|
});
|
|
|
|
it("does not duplicate the task card when the runner replays a request", async () => {
|
|
await seed();
|
|
const first = await projectNativeRuntimeRequest({ db, binding: binding(), event: runtimeRequestEvent() });
|
|
const second = await projectNativeRuntimeRequest({ db, binding: binding(), event: runtimeRequestEvent() });
|
|
expect(second?.id).toBe(first?.id);
|
|
expect(await db.select().from(issueThreadInteractions)).toHaveLength(1);
|
|
expect(await db.select().from(activityLog)).toHaveLength(1);
|
|
});
|
|
|
|
it("cancels the active native run when the shared issue service expires its question", async () => {
|
|
await seed();
|
|
const interaction = await projectNativeRuntimeRequest({
|
|
db,
|
|
binding: binding(),
|
|
event: runtimeRequestEvent(),
|
|
});
|
|
await issueService(db).update(issueId, { status: "cancelled" });
|
|
|
|
const [persistedInteraction] = await db.select({ status: issueThreadInteractions.status })
|
|
.from(issueThreadInteractions)
|
|
.where(eq(issueThreadInteractions.id, interaction!.id));
|
|
const [persistedRun] = await db.select({
|
|
status: heartbeatRuns.status,
|
|
resultJson: heartbeatRuns.resultJson,
|
|
}).from(heartbeatRuns).where(eq(heartbeatRuns.id, runId));
|
|
expect(persistedInteraction?.status).toBe("expired");
|
|
expect(persistedRun).toMatchObject({
|
|
status: "cancelled",
|
|
resultJson: {
|
|
cancelledByIssueStatus: "cancelled",
|
|
cancelledIssueId: issueId,
|
|
},
|
|
});
|
|
});
|
|
|
|
it("defers native cancellation until an external issue transaction commits", async () => {
|
|
await seed();
|
|
await projectNativeRuntimeRequest({
|
|
db,
|
|
binding: binding(),
|
|
event: runtimeRequestEvent(),
|
|
});
|
|
const postCommitActions: IssuePostCommitAction[] = [];
|
|
await db.transaction(async (tx) => {
|
|
await issueService(db).update(
|
|
issueId,
|
|
{ status: "done" },
|
|
tx,
|
|
undefined,
|
|
postCommitActions,
|
|
);
|
|
const [runInsideTransaction] = await tx.select({ status: heartbeatRuns.status })
|
|
.from(heartbeatRuns)
|
|
.where(eq(heartbeatRuns.id, runId));
|
|
expect(runInsideTransaction?.status).toBe("running");
|
|
});
|
|
|
|
expect(postCommitActions).toHaveLength(1);
|
|
await executeIssuePostCommitActions(db, postCommitActions);
|
|
const [persistedRun] = await db.select({ status: heartbeatRuns.status })
|
|
.from(heartbeatRuns)
|
|
.where(eq(heartbeatRuns.id, runId));
|
|
expect(persistedRun?.status).toBe("cancelled");
|
|
});
|
|
|
|
it("recovers a durable native cancellation when the post-commit process exits", async () => {
|
|
await seed();
|
|
await projectNativeRuntimeRequest({
|
|
db,
|
|
binding: binding(),
|
|
event: runtimeRequestEvent(),
|
|
});
|
|
const postCommitActions: IssuePostCommitAction[] = [];
|
|
await db.transaction(async (tx) => {
|
|
await issueService(db).update(
|
|
issueId,
|
|
{ status: "done" },
|
|
tx,
|
|
undefined,
|
|
postCommitActions,
|
|
);
|
|
});
|
|
|
|
const [markedRun] = await db.select({
|
|
status: heartbeatRuns.status,
|
|
contextSnapshot: heartbeatRuns.contextSnapshot,
|
|
}).from(heartbeatRuns).where(eq(heartbeatRuns.id, runId));
|
|
expect(markedRun).toMatchObject({
|
|
status: "running",
|
|
contextSnapshot: {
|
|
nativeQuestionCancellation: {
|
|
version: 1,
|
|
issueId,
|
|
issueStatus: "done",
|
|
},
|
|
},
|
|
});
|
|
|
|
// Simulate process exit before executeIssuePostCommitActions can run.
|
|
await heartbeat.reapOrphanedRuns();
|
|
|
|
const [persistedRun] = await db.select({
|
|
status: heartbeatRuns.status,
|
|
resultJson: heartbeatRuns.resultJson,
|
|
}).from(heartbeatRuns).where(eq(heartbeatRuns.id, runId));
|
|
expect(persistedRun).toMatchObject({
|
|
status: "cancelled",
|
|
resultJson: {
|
|
cancelledByIssueStatus: "done",
|
|
cancelledIssueId: issueId,
|
|
},
|
|
});
|
|
});
|
|
|
|
it("recovers an explicit question withdrawal committed with its cancellation intent", async () => {
|
|
await seed();
|
|
const interaction = await projectNativeRuntimeRequest({
|
|
db,
|
|
binding: binding(),
|
|
event: runtimeRequestEvent(),
|
|
});
|
|
await issueThreadInteractionService(db).withdrawInteraction(
|
|
{ id: issueId, companyId },
|
|
interaction!.id,
|
|
{ reason: "No longer needed" },
|
|
{ userId: "operator-1" },
|
|
{
|
|
afterResolveInTransaction: async (tx, withdrawn) => {
|
|
await expect(requestNativeQuestionRunCancellation(tx, withdrawn, {
|
|
kind: "interaction_withdrawn",
|
|
interactionId: withdrawn.id,
|
|
})).resolves.toBe(runId);
|
|
},
|
|
},
|
|
);
|
|
|
|
const [markedRun] = await db.select({ contextSnapshot: heartbeatRuns.contextSnapshot })
|
|
.from(heartbeatRuns)
|
|
.where(eq(heartbeatRuns.id, runId));
|
|
expect(markedRun?.contextSnapshot).toMatchObject({
|
|
nativeQuestionCancellation: {
|
|
version: 1,
|
|
kind: "interaction_withdrawn",
|
|
interactionId: interaction!.id,
|
|
issueId,
|
|
},
|
|
});
|
|
|
|
await heartbeat.reapOrphanedRuns();
|
|
|
|
const [cancelledRun] = await db.select({
|
|
status: heartbeatRuns.status,
|
|
resultJson: heartbeatRuns.resultJson,
|
|
}).from(heartbeatRuns).where(eq(heartbeatRuns.id, runId));
|
|
expect(cancelledRun).toMatchObject({
|
|
status: "cancelled",
|
|
resultJson: {
|
|
withdrawnInteractionId: interaction!.id,
|
|
cancelledIssueId: issueId,
|
|
},
|
|
});
|
|
});
|
|
|
|
it("removes the UI-only marker from a canonical custom response", async () => {
|
|
await seed();
|
|
const event = runtimeRequestEvent();
|
|
const request = event.payload.request as Record<string, unknown>;
|
|
const input = request.input as Record<string, unknown>;
|
|
input.questions = [{
|
|
id: "color",
|
|
prompt: "Which color?",
|
|
required: true,
|
|
answerMode: "single_select",
|
|
options: [{ id: "blue", label: "Blue" }],
|
|
customAnswer: { enabled: true, label: "Another color" },
|
|
}];
|
|
const interaction = await projectNativeRuntimeRequest({ db, binding: binding(), event });
|
|
const answer = {
|
|
answers: [{
|
|
questionId: "color",
|
|
optionIds: ["paperclip_custom_answer"],
|
|
otherText: "purple",
|
|
}],
|
|
};
|
|
validateNativeQuestionResponseInput(interaction!, answer);
|
|
const answered = await issueThreadInteractionService(db).answerQuestions(
|
|
{ id: issueId, companyId, status: "in_progress" },
|
|
interaction!.id,
|
|
answer,
|
|
{ userId: "operator-1" },
|
|
);
|
|
expect(answered.kind).toBe("ask_user_questions");
|
|
if (answered.kind !== "ask_user_questions") throw new Error("expected question interaction");
|
|
|
|
const queueCommand = vi.fn(() => ({ commandId: "question", controllerSeq: 1 }));
|
|
registerNativeQuestionCommandTarget({
|
|
binding: { companyId, issueId, runId, agentId },
|
|
queueCommand,
|
|
});
|
|
await expect(deliverNativeQuestionResponse(db, answered)).resolves.toBe("queued");
|
|
expect(queueCommand).toHaveBeenCalledWith(
|
|
"request.resolve",
|
|
{
|
|
requestId: "request-1",
|
|
response: {
|
|
schema: "paperclip.question_response.v1",
|
|
answers: { color: { selectedOptionIds: [], customText: "purple" } },
|
|
},
|
|
},
|
|
`question_${interaction!.id}`,
|
|
);
|
|
});
|
|
});
|