feat: external-cancel polling via heartbeat-runs endpoint (FAR-42)
Poll PAPERCLIP_API_URL/api/heartbeat-runs/{runId} at keepalive cadence
during log streaming. When status != "running", delete the Job with
propagationPolicy=Background and return errorCode="cancelled" as a
distinct result, matching the claude_k8s reference implementation.
Also includes: reattachOrphanedJobs config field that lets the adapter
reattach to a same-task Job left over from a prior server restart;
task-id and session-id K8s labels on Job manifests for observability.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -320,6 +320,9 @@ export function buildJobManifest(input: JobBuildInput): JobBuildResult {
|
||||
"paperclip.io/company-id": sanitizeLabelValue(agent.companyId, warnLabel),
|
||||
"paperclip.io/adapter-type": "opencode_k8s",
|
||||
};
|
||||
const taskId = asString(context.taskId ?? context.issueId, "").trim();
|
||||
if (taskId) labels["paperclip.io/task-id"] = sanitizeLabelValue(taskId, warnLabel);
|
||||
if (runtimeSessionId) labels["paperclip.io/session-id"] = sanitizeLabelValue(runtimeSessionId, warnLabel);
|
||||
for (const [key, value] of Object.entries(extraLabels)) {
|
||||
if (typeof value === "string") labels[key] = sanitizeLabelValue(value, warnLabel);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user