fix(cancel-poll): use ctx.authToken instead of process.env for cancel polling
The cancel poll was sending empty Authorization headers because PAPERCLIP_API_KEY is not set on the Paperclip server pod. Use the per-run authToken from ctx instead, which is the JWT issued by Paperclip for this execution. PAPERCLIP_DEV_API_KEY still overrides for dev instances. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -569,9 +569,9 @@ async function streamAndAwaitJob(
|
||||
await new Promise<void>((resolve) => setTimeout(resolve, KEEPALIVE_INTERVAL_MS));
|
||||
if (logStopSignal.stopped || cancelSignal.cancelled) break;
|
||||
try {
|
||||
// Prefer PAPERCLIP_DEV_API_KEY if set (allows dev instance key to be
|
||||
// distinct from the main-instance run JWT in PAPERCLIP_API_KEY).
|
||||
const apiKey = process.env.PAPERCLIP_DEV_API_KEY ?? process.env.PAPERCLIP_API_KEY ?? "";
|
||||
// Prefer PAPERCLIP_DEV_API_KEY if set (dev override), otherwise use
|
||||
// the per-run authToken issued by Paperclip for this execution.
|
||||
const apiKey = process.env.PAPERCLIP_DEV_API_KEY ?? ctx.authToken ?? "";
|
||||
const resp = await fetch(`${apiUrl}/api/issues/${issueId}`, {
|
||||
headers: { Authorization: `Bearer ${apiKey}` },
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user