@akagilnc/pi-workflow-roles 0.1.4620 → 0.1.4631

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -361,9 +361,6 @@ export function createPiRoleTurnHost(config) {
361
361
  && process.env.AK_ROLE_AUDITOR_SUBJECT.trim() !== "") {
362
362
  env.AK_ROLE_AUDITOR_SUBJECT = process.env.AK_ROLE_AUDITOR_SUBJECT;
363
363
  }
364
- if (request.correlationId !== undefined && request.correlationId.trim() !== "") {
365
- env.AK_CORRELATION_ID = request.correlationId;
366
- }
367
364
  if (config.recordLaunchedRolePackageIdentity !== undefined &&
368
365
  config.observeLaunchedRolePackageIdentity !== undefined) {
369
366
  await config.recordLaunchedRolePackageIdentity(request.runDirectory, await config.observeLaunchedRolePackageIdentity(config.packageRoot, roleEntry));
@@ -18,6 +18,7 @@ import { join } from "node:path";
18
18
  import { roleRunArtifactsDirectory } from "../role-run-placement.js";
19
19
  import { AUTO_RESUME_LIMIT, describeErrorIdentity, acquireRunWriterLease, markRunResumable, markRunTerminal, RunWriterLeaseHeldError, } from "./run-lifecycle.js";
20
20
  import { parseAutoResumeLimit } from "./config.js";
21
+ import { processCancelSignalName } from "./process-cancel.js";
21
22
  import { isLawfulTypedTerminalOutcome, formatTerminalResult } from "./terminal.js";
22
23
  import { attachRecordedSubmissions, presentFailureTerminal, presentStructuralRejection, resolveControlledFailureResumeObservation, } from "./settlement.js";
23
24
  const dummyIo = { stdout: () => { }, stderr: () => { } };
@@ -423,6 +424,12 @@ export async function runWithAutoResumeLoop(options) {
423
424
  presentTerminal(terminal, options.io);
424
425
  return result;
425
426
  }
427
+ // #855: process cancel — stop even if dispatch forgot skipAutoResume.
428
+ if (processCancelSignalName(options.signal) !== undefined) {
429
+ if (terminal !== undefined)
430
+ presentTerminal(terminal, options.io);
431
+ return result;
432
+ }
426
433
  }
427
434
  if (result !== undefined) {
428
435
  const terminal = result.terminal;
@@ -457,6 +464,25 @@ export async function runWithAutoResumeLoop(options) {
457
464
  terminal,
458
465
  };
459
466
  }
467
+ // #855: process cancel on the throw path — do not re-dispatch; name the signal.
468
+ const cancelName = processCancelSignalName(options.signal);
469
+ if (cancelName !== undefined) {
470
+ const terminal = await attachDispatchExceptionTerminal(options.admitted, dispatchExceptionFailureTerminal({
471
+ role: options.admitted.role,
472
+ runId: options.admitted.runId,
473
+ causeError: lastThrownError,
474
+ errorFiles: retainedErrorFiles,
475
+ autoResumeAttempts,
476
+ endReason: `ak-role terminated by ${cancelName}`,
477
+ everyAttemptThrew,
478
+ }), options.io);
479
+ await finalizeExceptionRunBestEffort(options.admitted.runDirectory, options.io);
480
+ presentTerminal(terminal, options.io);
481
+ return {
482
+ exitCode: 1,
483
+ terminal,
484
+ };
485
+ }
460
486
  if (!(await isPrincipalAvailable(options.admitted.principal))) {
461
487
  const terminal = await attachDispatchExceptionTerminal(options.admitted, dispatchExceptionFailureTerminal({
462
488
  role: options.admitted.role,