stablyai/orca · error · Error

Zustand publication span ${publicationSpanMs}ms exceeds --sa

Error message

Zustand publication span ${publicationSpanMs}ms exceeds --sample-ms ${options.sampleMs}

What it means

Thrown by parseArgs when the computed Zustand publication span (max(0, zustandPublications-1) * zustandPublicationIntervalMs) exceeds sampleMs. The fixture cannot fit all requested store publications inside the sampling window, so the measurement would be truncated.

Source

Thrown at config/scripts/run-idle-cpu-benchmark.mjs:138

  options.lineageDepth = Math.floor(options.lineageDepth)
  options.agentsPerWorktree = Math.floor(options.agentsPerWorktree)
  options.zustandPublications = Math.floor(options.zustandPublications)
  options.zustandPublicationIntervalMs = Math.max(
    1,
    Math.floor(options.zustandPublicationIntervalMs)
  )
  options.syntheticVisibleSpinners = Math.max(0, Math.floor(options.syntheticVisibleSpinners))
  options.syntheticSpinnerSteps = Math.max(1, Math.floor(options.syntheticSpinnerSteps))
  if (!['smooth', 'steps'].includes(options.syntheticSpinnerAnimation)) {
    throw new Error(`Invalid --synthetic-spinner-animation: ${options.syntheticSpinnerAnimation}`)
  }
  if (options.lineageDepth > 0 && options.worktrees < 2) {
    throw new Error('--lineage-depth requires at least two --worktrees')
  }
  const publicationSpanMs =
    Math.max(0, options.zustandPublications - 1) * options.zustandPublicationIntervalMs
  if (publicationSpanMs > options.sampleMs) {
    throw new Error(
      `Zustand publication span ${publicationSpanMs}ms exceeds --sample-ms ${options.sampleMs}`
    )
  }
  return options
}
function printUsage() {
  console.log(
    `Usage: node config/scripts/run-idle-cpu-benchmark.mjs [options]\n\nOptions:\n  --warmup-ms <n>    Time to wait after app readiness before sampling (default ${DEFAULT_WARMUP_MS})\n  --sample-ms <n>    Sampling window duration (default ${DEFAULT_SAMPLE_MS})\n  --interval-ms <n>  Sampling cadence (default ${DEFAULT_INTERVAL_MS})\n  --worktrees <n>    Seed repo worktree count, including primary (default ${DEFAULT_WORKTREE_COUNT})\n  --lineage-depth <n>  Nest all worktrees under one expanded lineage, up to this depth\n  --agents-per-worktree <n>  Seed this many visible inline agent rows per worktree\n  --zustand-publications <n>  Publish exactly this many store updates during sampling\n  --zustand-publication-interval-ms <n>  Publication cadence (default ${DEFAULT_ZUSTAND_PUBLICATION_INTERVAL_MS})\n  --headful          Show the Electron window while measuring\n  --skip-build       Reuse out/main/index.js instead of building first\n  --output <path>    Write JSON report to this path\n  --disable-renderer-animations  Inject measurement-only CSS that disables animations/transitions\n  --synthetic-visible-spinners <n>  Measurement-only: add visible working spinners\n  --synthetic-spinner-animation <smooth|steps>  Spinner animation style (default smooth)\n  --synthetic-spinner-steps <n>  Step count for --synthetic-spinner-animation steps (default 12)\n`
  )
}
function run(command, args, options = {}) {
  execFileSync(command, args, { stdio: options.stdio ?? 'pipe', encoding: 'utf8', ...options })
}

function buildAppIfNeeded(root, skipBuild) {
  const mainPath = path.join(root, 'out', 'main', 'index.js')
  if (skipBuild && existsSync(mainPath)) {
    return mainPath

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Lower --zustand-publications or --zustand-publication-interval-ms so the span fits in --sample-ms.
  2. Increase --sample-ms to cover the full publication span.
  3. Compute span = (publications-1)*interval and ensure it is <= sample-ms before running.

Example fix

# before
node config/scripts/run-idle-cpu-benchmark.mjs --zustand-publications 100 --zustand-publication-interval-ms 1000 --sample-ms 30000
# after
node config/scripts/run-idle-cpu-benchmark.mjs --zustand-publications 100 --zustand-publication-interval-ms 1000 --sample-ms 120000
Defensive patterns

Strategy: validation

Validate before calling

const publicationSpanMs = Math.max(0, options.zustandPublications - 1) * options.zustandPublicationIntervalMs
if (publicationSpanMs > options.sampleMs) {
  throw new Error(`Zustand publication span ${publicationSpanMs}ms exceeds --sample-ms ${options.sampleMs}`)
}

Type guard

function publicationsFitInSample(options) {
  const span = Math.max(0, options.zustandPublications - 1) * options.zustandPublicationIntervalMs
  return span <= options.sampleMs
}

Try / catch

try {
  options = parseArgs(argv)
} catch (err) {
  if (/Zustand publication span/.test(err.message)) { printUsage(); process.exit(2) }
  throw err
}

Prevention

When it happens

Trigger: High --zustand-publications combined with a large --zustand-publication-interval-ms and a short --sample-ms, e.g. 100 publications * 1000ms interval > 30000ms sample.

Common situations: Scaling up publications without extending the sample window, or lowering sample-ms for a quick run.

Related errors


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/37d9c884c51c61a0. Report an issue: GitHub.