Repository navigation
feat(evolution): add evolutionary campaigns, Pareto archive, and bundle export - #56
Conversation
…ooling - Add @loopwright/evolution package using built-in node:sqlite with zero third-party deps. - Register packages/evolution across workspace build, test, pack, and self-upgrade tooling. - Update 12-package test fixtures, OpenCodeReview rules, and synced self-upgrade digests. - Add evolution scaffold tests verifying node:sqlite STRICT support and state schema parity. Signed-off-by: thxCode <thxcode0824@gmail.com>
…ade nodes - Allow advise_mutation_novelty, route_evolution_strategy, and advise_cascade_escalation intents. - Implement deterministic comment-stripped Jaccard novelty filter with System-One soft-band triage. - Add Roofline-backed evolution strategy router and smoke-to-full cascade escalation filter. - Stamp advisoryOnly and verificationCertified false on all outputs with unit tests. Signed-off-by: thxCode <thxcode0824@gmail.com>
…fier gate - Add optional HardwareMemoryScope with null-prototype schema preserving v1 storeDigest parity. - Enforce 6th hardware-evidence gate rejecting unproven hardwareScope facts and invariants. - Admit hardwareScope failure_observation entries cleanly and scope conflict overlap checks. - Filter selectActiveMemory, finalizer, and compaction by target accelerator and driverConstraint. Signed-off-by: thxCode <thxcode0824@gmail.com>
…and hardwareDiagnostics - Extend HardwareTargetSpec with optional Stage A static audit bounds preserving legacy digests. - Add bucketScope threshold enforcement across bucketMetrics in evaluateAcceptance. - Validate bounded bucketMetrics and closed-enum hardwareDiagnostics on Evidence.spec. - Export STAGE_A_STATIC_AUDIT_FAILED, TEAM_ENVELOPE_VIOLATION, and EXPORT_UNVERIFIED_FORBIDDEN diagnostics. Signed-off-by: thxCode <thxcode0824@gmail.com>
…gine, sampler, and scratchpad - Add null-prototype parsers for EvolutionCampaign, team-patch.v1, and dispatch-manifest.json. - Implement single-writer fenced campaign.sqlite store with 1000ms clock-drift and symlink guards. - Add deterministic NSGA-II ranking, exact hypervolume, Island Elitism, and UCB1 model bandit. - Add SecretScrubber-clean 16 KiB CAS scratchpad synthesizer with unit tests. Signed-off-by: thxCode <thxcode0824@gmail.com>
…te receipt forwarding - Register deterministic evolve-block-guard.v1 across handlers, registry, verifier protocol, and Merkle proof paths. - Enforce EVOLVE-BLOCK marker structure, allowedBlockIds, maxBlockBytes, and outside-byte SHA-256 invariance. - Forward Stage A static audit fields, bucketScope, bucketMetrics, and hardwareDiagnostics in benchmark-gate and reconcile. - Keep phaseSchedule untouched and verify 340 controller tests pass including new TDD coverage. Signed-off-by: thxCode <thxcode0824@gmail.com>
…rser, and GPU quarantine - Audit sealed Stage A ELF/PTX/SASS outputs for forbidden symbols and register/spill ceilings. - Parse bounded Stage B bucketMetrics and sanitized hardwareDiagnostics enforcing bucketScope thresholds. - Add NVIDIA/ROCm/NPU post-crash health probes verified against live RTX 4090 and RX 7800 XT hosts. - Transition workers into fail-closed WORKER_DEVICE_QUARANTINED (exit 3) before next lease poll. Signed-off-by: thxCode <thxcode0824@gmail.com>
…ir and oci-layout - Implement exportEvolutionBundle and verifyEvolutionBundle with atomic staging and byte-identical digests. - Enforce O_NOFOLLOW, nlink === 1, SHA-256, byteLength, and SecretScrubber CAS integrity checks. - Require passing physical hardware_execution HMAC receipts and portfolio verification before export. - Emit manifest.json, dispatch-manifest.json with baseline fallback, receipts, and OCI layout index. Signed-off-by: thxCode <thxcode0824@gmail.com>
…schema, and hardwareScope projection - Validate and compile evolve-block-guard.v1 checks, Stage A audit bounds, and bucketScope rules. - Preserve byte-identical TaskContract and TaskLock digests on legacy v2 taskpacks omitting new fields. - Project optional hardwareScope from matched hardware target.matrix cells into active memory selection. - Preserve hardwareScope across taskpack local finalization and github-app separate-PR memory proposals. Signed-off-by: thxCode <thxcode0824@gmail.com>
…io synthesis, and campaign orchestrator - Implement event-driven plateau and RunEval supervisor with read-only tools and archetype envelopes. - Implement multi-island campaign orchestrator with stepping-stone crossover, decisions filters, and resume. - Re-export full @loopwright/evolution API surface from index.ts preserving scaffold exports. - Bind per-run child lockHashes in bundle.ts and verify 30 evolution tests including loopback e2e. Signed-off-by: thxCode <thxcode0824@gmail.com>
…sure registration - Add loopwright evolve check|run|resume|status|inspect|export grammar and lazy imports - Wire Pi-backed CLI CandidateEvaluator preserving zero static evolution imports - Register @loopwright/evolution in closure OWNER_PACKAGES keeping 18/5 ledger intact - Add evolve-block-guard.v1 compilation support and parity tests in taskpack-runner Signed-off-by: thxCode <thxcode0824@gmail.com>
- Document EvolutionCampaign, evolve-block-guard.v1, Stage A/B audits, and hardwareScope - Update CLI, architecture, internals, memory, evidence, and decision-routing guides - Sync docs/README.md, README.md, AGENTS.md, and loopwright-overview skill - Add EvolutionCampaign metadata.name validation to check-docs.mjs and rules tests Signed-off-by: thxCode <thxcode0824@gmail.com>
…okups - Attach hardwareScope on memory facts only when hardware_execution evidence passed - Simplify redundant Xid regex check in hardware-runner provenance parser - Add optional environment lookup to controller loadTrustedConfiguration - Remove global process.env mutation in taskpack executeTurnkeyCycle Signed-off-by: thxCode <thxcode0824@gmail.com>
- Re-validate persisted team-patch.v1, preserve thinking/onRework, and fix D precheck - Enforce fail-closed HMAC verification and forward driverConstraint on bundle export - Wire isolated read-only LocalRunStore supervisor and pre-gate novelty screening - Fix disjoint repo checkout, role resourceIds, 1..64 specialists, and resume cleanup - Add on-demand live GPU SSH 2-generation physical-probe smoke test Signed-off-by: thxCode <thxcode0824@gmail.com>
…ology SVG - Reuse shared @loopwright/evolution helpers and preserve extraResources on roles - Wire read-only LocalRunStore Pi supervisor, novelty gate, and fail-closed HMAC export - Inherit active provider token in executeTurnkeyCycle when runtimeEnv omits it - Add three-zone network-boundary hardware-relay-flow.svg diagram and Relay docs - Document EvolutionCampaign bounds table, host env vars, and disjoint --state path Signed-off-by: thxCode <thxcode0824@gmail.com>
…pervisor checks - Synthesize dispatch-manifest rules from specialist winners in portfolio mode. - Resolve cross-provider team-patch role models from declared taskpack models. - Enforce supervisor cycle status, active provider env, and secret scrubbing. - Rename hardened test files and remove internal review identifiers. Signed-off-by: thxCode <thxcode0824@gmail.com>
…ad IDs - Bind per-provider credentials in CLI evolution evaluator for cross-provider roles. - Validate heldOutWorkloadId and portfolioHeldOutWorkloadId as strict identifiers. - Apply single-target heldOutWorkloadId overrides at runtime and bundle export. - Forward CLI --format on evolve auto-export and sync workspace lockfile. Signed-off-by: thxCode <thxcode0824@gmail.com>
- Advance evolutionary campaigns specification status from Built to Shipped. Signed-off-by: thxCode <thxcode0824@gmail.com>
|
🔍 OpenCodeReview found 1 issue(s) in this PR.
📄
|
| const parsed = await parseAndVerifyReceiptBytes(rawBytes, { | ||
| individualId: ind.individualId, | ||
| expectedTargetCellId: campaign.manifest.spec.targetCellId, |
There was a problem hiding this comment.
parseAndVerifyReceiptBytes performs the full expectRecord + HMAC check before checking options.expectedLockHash, but the outer loadAndVerifyReceipt never passes expectedLockHash (the campaign's lockHash is never cross-checked against receipt lockHash anywhere in the export flow, despite the per-receipt lockHash field being mandatory and validated). Add expectedLockHash: campaign.lockHash in loadAndVerifyReceipt so bundle exports pin receipts to the campaign baseline lock — without it, a receipt from a different lock epoch could be exported.
There was a problem hiding this comment.
Not changed (false positive): campaign.lockHash hashes the campaign manifest, whereas each individual's signed BenchmarkVerdictReceipt.lockHash is the per-run TaskLock hash of that individual's child controller run (distinct for every child run). Passing expectedLockHash: campaign.lockHash would reject every real multi-generation controller receipt. Receipts are instead bound via HMAC verification, expectedTargetCellId, ind.individualId, hardwareProvenance, and Stage A output artifact digests. Leaving this thread open for reviewer confirmation.
| const numeric = Number(rawToken); | ||
| if (!Number.isFinite(numeric) || Object.is(numeric, -0)) { | ||
| schemaInvalid('JSON number must be finite and non-negative-zero', path); | ||
| } |
There was a problem hiding this comment.
parseNullProtoJson (and sanitizeUntrustedValue) hard-reject -0, but -0 is a legal JSON number literal (JSON.stringify(Math.round(-0.4)) aside, external producers such as hardware-runner receipts can emit -0), and JSON.parse round-trips it. Any receipt or manifest authored upstream with -0 in a metrics/edges field will fail parsing here even though the value is semantically zero. Consider normalizing -0 to 0 at the parse boundary instead of failing closed, reserving rejection for NaN/Infinity.
Suggestion:
| const numeric = Number(rawToken); | |
| if (!Number.isFinite(numeric) || Object.is(numeric, -0)) { | |
| schemaInvalid('JSON number must be finite and non-negative-zero', path); | |
| } | |
| const numeric = Number(rawToken); | |
| if (!Number.isFinite(numeric)) { | |
| schemaInvalid('JSON number must be finite', path); | |
| } | |
| return Object.is(numeric, -0) ? 0 : numeric; |
There was a problem hiding this comment.
Not changed (intentional invariant): rejecting -0 fail-closed matches Loopwright's cross-package canonical JSON invariant (@loopwright/core, @loopwright/decisions, @loopwright/memory, @loopwright/hardware-runner) and existing negative-zero unit tests so canonical SHA-256 digests never drift across serializers. Leaving this thread open for reviewer confirmation.
| const effectiveEnv: Record<string, string | undefined> = Object.create(null) as Record<string, string | undefined>; | ||
| const baseEnv = options.runtimeEnv ?? process.env; | ||
| for (const [key, value] of Object.entries(baseEnv)) { | ||
| if (value !== undefined) { | ||
| effectiveEnv[key] = value; | ||
| } | ||
| } |
There was a problem hiding this comment.
Precedence silently flipped: previously runtimeEnv values only filled gaps where process.env[key] === undefined (process.env won), and LOOPWRIGHT_MAX_TURNS was read from options.runtimeEnv ?? process.env. Now baseEnv = options.runtimeEnv ?? process.env makes runtimeEnv authoritative for every key, so when a caller supplies both (e.g. a host that sets LOOPWRIGHT_MAX_TURNS or a provider token in the real environment and also passes a curated runtimeEnv), the value consumed by the cycle changes. If this inversion is intentional (stronger isolation), please note it explicitly; otherwise restore the old gap-filling semantics.
There was a problem hiding this comment.
Not changed (intentional isolation): making caller-supplied options.runtimeEnv authoritative over ambient process.env (while keeping the explicit read-only fallback for LOOPWRIGHT_ACTIVE_PROVIDER_TOKEN_ENV) eliminates concurrent process.env mutation races and prevents ambient host secrets from leaking into isolated cycles. Added a comment documenting this intentional precedence in 782d21d. Leaving this thread open for reviewer confirmation.
| if ( | ||
| entryScope.operatorFamily !== undefined | ||
| && targetScope.operatorFamily !== undefined | ||
| && entryScope.operatorFamily !== targetScope.operatorFamily | ||
| ) { | ||
| return false; | ||
| } |
There was a problem hiding this comment.
Field-strictness is asymmetric: driverConstraint mismatches when the entry has it and the target does not, but operatorFamily/boundPipeline only mismatch when both sides define them. An entry scoped to operatorFamily: 'cuda' therefore matches a target whose operator family is undefined/unknown, admitting a hardware-specific fact onto unverified hardware and weakening the hardware-evidence guarantee this PR introduces. Align the semantics (either all fields strict, or document why driver-only is strict). Note this also diverges from hardwareScopeOverlaps/hardwareScopesOverlap in finalizer.ts/verifier.ts, which treat an undefined side as universally compatible.
Suggestion:
| if ( | |
| entryScope.operatorFamily !== undefined | |
| && targetScope.operatorFamily !== undefined | |
| && entryScope.operatorFamily !== targetScope.operatorFamily | |
| ) { | |
| return false; | |
| } | |
| if (entryScope.operatorFamily !== undefined && entryScope.operatorFamily !== targetScope.operatorFamily) { | |
| return false; | |
| } | |
| if (entryScope.boundPipeline !== undefined && entryScope.boundPipeline !== targetScope.boundPipeline) { | |
| return false; | |
| } |
There was a problem hiding this comment.
Not changed (intentional design): driverConstraint fails closed when omitted on the target to prevent unverified driver transfers, whereas operatorFamily and boundPipeline are optional narrowers so an accelerator-level query ({ accelerator: 'sm_100a' }) can still retrieve sm_100a entries across operator families while excluding explicit mismatches (verified in packages/memory/test/hardware-scope.test.ts). Added a doc comment above hardwareScopeMatches in b260f75 clarifying this intentional asymmetry. Leaving this thread open for reviewer confirmation.
…and closure registration Signed-off-by: thxCode <thxcode0824@gmail.com>
…ners - Raise spawnSync timeout from 5s to 15s for --help subprocess checks. Signed-off-by: thxCode <thxcode0824@gmail.com>
…and closure registration Signed-off-by: thxCode <thxcode0824@gmail.com>
…mark-gate receipt forwarding Signed-off-by: thxCode <thxcode0824@gmail.com>
…nd cascade nodes Signed-off-by: thxCode <thxcode0824@gmail.com>
…r for dir and oci-layout Signed-off-by: thxCode <thxcode0824@gmail.com>
…portfolio synthesis, and campaign orchestrator Signed-off-by: thxCode <thxcode0824@gmail.com>
…line parser, and GPU quarantine Signed-off-by: thxCode <thxcode0824@gmail.com>
…on verifier gate Signed-off-by: thxCode <thxcode0824@gmail.com>
… audit schema, and hardwareScope projection Signed-off-by: thxCode <thxcode0824@gmail.com>
|
Round 2 review feedback addressed across 8 signed Fixed (14 of 17 inline threads + 1 failed-to-post high bug + 7 summary items + 1 CI flake)
Intentionally Left Open (3 of 17 inline threads)
Verification
|
…and closure registration Signed-off-by: thxCode <thxcode0824@gmail.com>
…line parser, and GPU quarantine Signed-off-by: thxCode <thxcode0824@gmail.com>
|
Round 3 review feedback addressed across 2 signed Fixed (all 3 inline threads + 1 summary item + 1 CI timeout flake)
Verification
|
…and closure registration Signed-off-by: thxCode <thxcode0824@gmail.com>
…line parser, and GPU quarantine Signed-off-by: thxCode <thxcode0824@gmail.com>
|
Round 4 review feedback addressed across 2 signed Fixed (both inline threads + CI timeout hardening)
Verification
|
What type of PR is this?
/kind feature
/area core
/area controller
/area taskpack-runner
/area memory
/area decisions
/area github-app
/area cli
/area docs
/area site
Summary
Adds bounded, verified evolutionary campaigns, a Pareto / MAP-Elites archive, plateau-driven bounded team synthesis, and deterministic
evolution-bundle.v1exports across Loopwright (governed byspecs/2026-11-23-evolutionary-campaigns-pareto-archive-and-bundle-export.md):@loopwright/evolution(12th workspace package, zero new third-party runtime dependencies):campaign.sqlitestore (node:sqliteSTRICTtables,DELETE/FULL,O_NOFOLLOW, single-writer queue, lease fencing, and<= 1000msclock-drift guard) leaving@loopwright/state(format_version = 1) and controller checkpoints (D <= 256) untouched.<= 16 KiBCAS scratchpad synthesis, and two-stagespecialist-then-portfolioorchestration (1..64specialist buckets plus held-out portfolio synthesis).RunEvalpathology supervisor running strictly read-only (tools: ["read"],scope.protected: ["**"], isolatedLocalRunStore, zeroheld_out_workloadsexposure) emittingteam-patch.v1validated fail-closed against the Archetype Capability Envelope (TEAM_ENVELOPE_VIOLATION) andD <= 256with automatictrialGenerationsrollback.evolution-bundle.v1exporter and verifier (dirandoci-layout) with fail-closed HMAC receipt verification, CASO_NOFOLLOW/nlink === 1/ SHA-256 verification,SecretScrubbergating, hardware compatibility metadata, anddispatch-manifest.json(1..64rules +fallback: "baseline").evolve-block-guard.v1deterministic mutable-region verifier enforcingEVOLVE-BLOCK-START/ENDsyntax,allowedBlockIds,maxBlockBytes, and outside-byte SHA-256 invariance across local and delegatedstepflows.@loopwright/hardware-runnerStage A static ELF/PTX/SASS forbidden-symbol and register/spill audits (STAGE_A_STATIC_AUDIT_FAILEDbefore any Stage B lease), boundedbucketMetrics+ sanitizedhardwareDiagnosticsparsing withbucketScope(aggregate/all_buckets/{ bucketId }), and post-crash accelerator health probes with fail-closed worker quarantine (WORKER_DEVICE_QUARANTINED).@loopwright/decisionsSystem-One advisory inner-loop filters (advise_mutation_novelty,route_evolution_strategy,advise_cascade_escalation), all stampedadvisoryOnly: trueandverificationCertified: false.hardwareScopememory isolation and 6thhardware-evidenceverification gate in@loopwright/memory, projected across@loopwright/taskpackand@loopwright/github-app.loopwright evolve check|run|resume|status|inspect|exportCLI subcommands with per-provider credential isolation, zero top-level static@loopwright/evolutionimports, updated documentation and site, and a three-zone network-boundary Blueprint SVG (docs/assets/diagrams/hardware-relay-flow.svg).Related Issues
NONE
Verification
npm run buildpassed cleanlynpm run typecheckpassed cleanlynpm run lintpassed cleanlynpm run lint:docspassed cleanly (27docs pages,37linked sources,0errors)npm run sitebuilt and verified with zero broken links (HUGO_BIN=/opt/homebrew/bin/hugo,16HTML pages,13Markdown exports)core,decisions,memory,controller,taskpack-runner,taskpack,github-app,hardware-runner,cli, and--concurrency 1onstate,agent-pi,evolution), plusclosure --verify-failures --json(18closedLocal,5unprovisionedExternal,14/14failure matrix) and.auto-sync/taskpack.yamldigest sync --checklinux-landlock+ seccomp-bpf and on-demand physical GPU smoke (packages/evolution/test/live-gpu-smoke.test.ts— physical provenance, health probes, Stage A static audit, 2-generation campaign, and HMACoci-layoutexport/verify withallowSyntheticProbe: false) verified on live CUDA and ROCm hosts; CI/local fixture runs skip live SSH smoke unless opt-in host env vars are set.github/workflows/maintains least-privilegepermissionsand remains protected against untrusted taskpack/sandbox writes (.github/workflows/untouched)Signed-off-by: Full Name <email>Developer Certificate of Origin (DCO) included on all commitsDoes this PR introduce a user-facing change?