Skip to content

FE-1410: Define the seeds-per-trial contract in the optimization manifest - #9224

Open
kube wants to merge 1 commit into
mainfrom
cf/fe-1410-optimization-manifest-define-the-seeds-per-trial-contract-in
Open

FE-1410: Define the seeds-per-trial contract in the optimization manifest#9224
kube wants to merge 1 commit into
mainfrom
cf/fe-1410-optimization-manifest-define-the-seeds-per-trial-contract-in

Conversation

@kube

@kube kube commented Aug 16, 2026

Copy link
Copy Markdown
Collaborator

🌟 What is the purpose of this PR?

Contract layer for running M seeded simulations per optimization trial (FE-1408, split into a stack). It defines what a multi-seed trial looks like in the manifest and the CLI protocol types, without changing any behaviour: manifests without the new field parse and run exactly as before, and the CLI is untouched.

Stack: this PRFE-1411 (async-safe protocol) → FE-1408 (worker pool) → arch-docs/bindings follow-ups.

🔗 Related links

  • FE-1410 (internal) — this PR
  • FE-1408 (internal) — parent: seeded trials in the CLI
  • FE-1273 (internal) — grandparent: M seeded runs per Optuna step

🔍 What does this change?

@hashintel/petrinaut-core only:

  • New optional execution.seedsPerTrial (integer 1–100, default 1) on the optimization manifest schema, including inputs restored from sessionStorage.
  • The total-work budget check counts every seed: stepsPerRun × seedsPerTrial × trials ≤ 5,000,000, with the issue anchored to execution.seedsPerTrial when the multiplier causes the excess.
  • PetrinautOptimizationDescribeResult.study gains an optional seedsPerTrial; PetrinautOptimizationEvaluateResult gains an optional replicates: [{ seed, objective }]. Both are optional so the CLI adopts them in the next layer of the stack without a lockstep merge.
  • deriveRunSeed (the Monte Carlo per-run seed derivation) is exported for the CLI to reuse, so optimization replicate seeds and Monte Carlo experiment seeds share one derivation.

Pre-Merge Checklist 🚀

🚢 Has this modified a publishable library?

This PR:

  • modifies an npm-publishable library and I have added a changeset file(s)

📜 Does this require a change to the docs?

The changes in this PR:

  • are not user-facing so no docs are required — behaviour is unchanged until the CLI layer lands; that PR carries the doc updates.

🕸️ Does this require a change to the Turbo Graph?

The changes in this PR:

  • do not affect the execution graph

🛡 What tests cover this?

  • optimization.test.ts — field bounds (rejects 0 / 1.5 / 101), the seeds-aware total-work budget (including the issue path), and unchanged parsing of manifests without the field.

❓ How to test this?

turbo run test:unit --filter @hashintel/petrinaut-core

🤖 Generated with Claude Code

@kube kube self-assigned this Aug 16, 2026
@vercel

vercel Bot commented Aug 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hash Ready Ready Preview Aug 18, 2026 12:42am
petrinaut Ready Ready Preview Aug 18, 2026 12:42am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hashdotdesign-tokens Ignored Ignored Preview Aug 18, 2026 12:42am

@github-actions github-actions Bot added area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team labels Aug 16, 2026
@kube
kube marked this pull request as ready for review August 17, 2026 23:52
Copilot AI balanced review requested due to automatic review settings August 17, 2026 23:52
@cursor

cursor Bot commented Aug 17, 2026

Copy link
Copy Markdown

PR Summary

Cursor Bugbot is generating a summary for commit 6b22c5e. Configure here.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Defines the multi-seed optimization contract without changing CLI execution behavior.

Changes:

  • Adds validated execution.seedsPerTrial support and seed-aware work limits.
  • Extends optimization protocol types for replicate results.
  • Exports the shared deterministic seed derivation.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
.changeset/optimization-seeds-per-trial.md Records the publishable API addition.
libs/@hashintel/petrinaut-core/src/index.ts Exports the new public APIs.
libs/@hashintel/petrinaut-core/src/optimization.test.ts Tests seed bounds and work budgeting.
libs/@hashintel/petrinaut-core/src/optimization.ts Defines the manifest and protocol contracts.
libs/@hashintel/petrinaut-core/src/simulation/index.ts Re-exports seed derivation.
libs/@hashintel/petrinaut-core/src/simulation/monte-carlo/index.ts Exposes seed derivation from Monte Carlo.
libs/@hashintel/petrinaut-core/src/simulation/monte-carlo/run-state.ts Makes seed derivation public.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread libs/@hashintel/petrinaut-core/src/optimization.ts Outdated
…fest

Adds an optional execution.seedsPerTrial field (1-100, default 1) to the
optimization manifest schema, counts every trial seed against the total
simulation-step budget, extends the describe/evaluate contract types with
the seeds-per-trial count and per-seed replicates (both optional so the
CLI can adopt them separately), and exports the Monte Carlo deriveRunSeed
derivation for the CLI to reuse. Manifests without the field parse and
behave exactly as before.
@kube
kube force-pushed the cf/fe-1410-optimization-manifest-define-the-seeds-per-trial-contract-in branch from 6b22c5e to a9554ae Compare August 18, 2026 00:33
Copilot AI review requested due to automatic review settings August 18, 2026 00:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

2 participants