@edgehero/pi-dispatch 1.10.0 → 1.10.1

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.mjs +13 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edgehero/pi-dispatch",
3
- "version": "1.10.0",
3
+ "version": "1.10.1",
4
4
  "type": "module",
5
5
  "description": "Self-hosted job harness for the pi coding agent: a BullMQ worker that drains the queue, mints scoped forge tokens, and runs one container per job — plus the pi-dispatch CLI (init, up, doctor, service).",
6
6
  "keywords": [
package/src/index.mjs CHANGED
@@ -693,12 +693,23 @@ export function makeProcessor({ cancelJob, stopContainer, containerName = (job)
693
693
  // job.data with no `.id` -- and the real wrapper is only in scope here, so inject it as
694
694
  // `queueJobId`, mirroring the collectChain injection above. Omitted when unwired so a bare
695
695
  // processor keeps runJob's plain (job, token) call.
696
- ...(deps.prepareWorkspace ? { prepareWorkspace: (j, t) => deps.prepareWorkspace(j, t, { queueJobId: job.id }) } : {}),
696
+ // The third argument is EXTENDED, never replaced. `runJob` calls this as
697
+ // `prepareWorkspace(job, token, { piVersion })`, so a wrapper passing only `{ queueJobId }`
698
+ // dropped it -- and `piVersion` defaults to `null`, which `readCanonical` treats as
699
+ // "never resume": `if (piVersion === null) return COLD("pi-version-changed")`. So EVERY
700
+ // `run.resume` cold-started, on every wired worker, while reporting success. The stamp
701
+ // `promoteSession` writes was correct the whole time; the comparison simply never happened.
702
+ // The processor tests inject `prepareWorkspace` directly and never see this wrapper, which is
703
+ // why nothing caught it (REQ-RESUMABLE-SESSION).
704
+ ...(deps.prepareWorkspace ? { prepareWorkspace: (j, t, opts) => deps.prepareWorkspace(j, t, { ...opts, queueJobId: job.id }) } : {}),
697
705
  // The one-shot pre-spend check (issue #231) needs the REAL BullMQ job's `.id` to excuse this
698
706
  // delivery's own earlier attempt -- runJob's effectiveJob has no `.id`, prepareWorkspace's
699
707
  // own injection above states why, and this one mirrors it. Omitted when unwired so a bare
700
708
  // processor keeps runJob's admit-everything default.
701
- ...(deps.checkOnceSpent ? { checkOnceSpent: (j) => deps.checkOnceSpent(j, { queueJobId: job.id }) } : {}),
709
+ // Same extend-don't-replace shape as `prepareWorkspace` above, for its reason: `runJob` passes
710
+ // this one no options today, so there is nothing to lose yet -- and the day it does, a
711
+ // replacing wrapper would lose it in the same silence.
712
+ ...(deps.checkOnceSpent ? { checkOnceSpent: (j, opts) => deps.checkOnceSpent(j, { ...opts, queueJobId: job.id }) } : {}),
702
713
  });
703
714
  recordRun({ job, result, startedAt, endedAt: new Date().toISOString() });
704
715
  return result;