{
  "schema": "omnius.expanded-variant-repair-verification.v1",
  "date": "2026-10-17",
  "scope": "Source-only repair endpoint binding, honest diagnostic outcomes and independent loopback endpoint cooldown. Startup transcript/daemon diagnostic presentation is a separate integration owned by the parent/native frontend agent.",
  "baseline": {
    "gitHead": "56fceb0070166eb92e751d490d82295757de3fba",
    "sourceSha256": "c592ec81fd9f012604d928e6f2eedb8264cda0f2ada5f9a3dabc2e538cf7a632",
    "beforeEvidence": [
      "createExpandedVariantNamedAsync accepted no backendUrl, invoked a shell command and inherited OLLAMA_HOST/default despite reading metadata from a selected endpoint.",
      "Failed child creation was caught as null; stale-context, missing-tools and canonical-alias repair branches could count it as unchanged.",
      "readExpandedVariantState returned null for HTTP, invalid JSON and transport failures; sweep collapsed these with policy/base/create failures into one inaccurate startup warning."
    ]
  },
  "ownedPaths": [
    "packages/cli/src/tui/setup.ts",
    "packages/cli/src/tui/expanded-variant-sweep.ts",
    "packages/cli/tests/ollama-broker-model-identity.test.ts",
    "packages/cli/tests/expanded-variant-repair.test.ts",
    "packages/cli/tests/expanded-variant-sweep.test.ts",
    "docs/work-orders/evidence/expanded-variant-repair-20261017.json"
  ],
  "sourceHashes": {
    "packages/cli/src/tui/setup.ts": "e64691d02455c3ff1b691f3d4be4467e39bfbee3718fac85be248f8e3a3649d4",
    "packages/cli/src/tui/expanded-variant-sweep.ts": "65cdb17f9aaedf7aba27481a7818eb6251bb2192d0766dd2c4337813f30e13cb",
    "packages/cli/tests/ollama-broker-model-identity.test.ts": "927b0b76d9e588c19b7afa68ab488c9b428611d6d272b86e8f175d14dd058566",
    "packages/cli/tests/expanded-variant-repair.test.ts": "dfb2f96beed5eac75759a022b88c3733ef469bb6386f2aa33979122a3c721cc1",
    "packages/cli/tests/expanded-variant-sweep.test.ts": "a2bd245f0d10560950b66b56e5270f110210002d4f44a89e34ccf1dce20bee1e"
  },
  "verification": {
    "result": "PASS",
    "testFiles": 3,
    "tests": 58,
    "newCases": 36,
    "caseCounts": {
      "packages/cli/tests/ollama-broker-model-identity.test.ts": 22,
      "packages/cli/tests/expanded-variant-repair.test.ts": 17,
      "packages/cli/tests/expanded-variant-sweep.test.ts": 19
    },
    "counting": "One complete focused batch; 22 existing broker identity cases plus 17 new repair cases and 19 new endpoint/cadence cases. Do not add earlier overlapping test batches.",
    "testLog": "/tmp/omnius-expanded-repair-final-tests.log",
    "testLogSha256": "880733870231877e568a95226633f65911384466228b12f2975d281b9c43bc0d",
    "testCommand": "pnpm exec vitest run tests/expanded-variant-repair.test.ts tests/expanded-variant-sweep.test.ts tests/ollama-broker-model-identity.test.ts --maxWorkers=2 --minWorkers=1 --reporter=verbose",
    "typecheck": {
      "result": "PASS",
      "diagnostics": 0,
      "log": "/tmp/omnius-expanded-repair-final-typecheck.log",
      "command": "pnpm exec tsc -p tsconfig.json --noEmit --incremental false --composite false"
    },
    "sourcePatch": "/tmp/omnius-expanded-repair-source.patch",
    "sourcePatchSha256": "cfd49415516843e855e51f3a2eab1b102a53ee27b66c7cf59d30d370fab41194",
    "rootApplyCheck": "PASS before integration",
    "scopedDiffCheck": "PASS"
  },
  "contract": {
    "creation": "Every async wrapper-create caller explicitly passes the requested endpoint. execFile invokes ollama with an argument vector; the normalized HTTP(S) endpoint overrides OLLAMA_HOST only in a copied child environment. Global environment is unchanged. Credentials/query/fragment URLs are refused.",
    "failureReasons": [
      "metadata_http",
      "metadata_invalid",
      "metadata_unavailable",
      "missing_base",
      "broker_policy",
      "create_failed"
    ],
    "failureDetails": "Fixed host-owned diagnostic text and optional numeric HTTP status; no raw model response, thrown exception text, subprocess stdout/stderr or inherited credentials. A missing friendly base must be installed in the selected catalog before a repair is attempted.",
    "success": "Only a completed creation enters repaired. Required failed creates enter failed, not unchanged. Broker-managed aliases remain untouched.",
    "metadata": "The initial validated wrapper state also supplies the tools-capability decision, avoiding a redundant unchecked wrapper-state probe. A later authoritative read failure remains a typed failure.",
    "scheduler": "createExpandedVariantSweepScheduler(scan,{ttlMs?,now?}).run(backendType,url) returns one result Promise for a real scan or null for invalid/non-Ollama/nonloopback, in-flight or cooldown-suppressed repeats. Per-normalized-endpoint state is independent. Default cooldown is five minutes after success or rejection completes.",
    "loopback": "Exact localhost, 127.0.0.1 and IPv6 ::1 only, parsed as URL host; username/password, query, fragment, wildcard bind address and remote substring tricks are excluded.",
    "retention": "At most 32 completed endpoint entries; active scans retain their guards until settlement. Cadence is per scheduler instance, not a cross-process persistent lock."
  },
  "coveredBehaviors": [
    "Selected custom-port/basepath overrides unrelated inherited OLLAMA_HOST for stale-context, missing-tools and canonical-alias repairs.",
    "Public async new-wrapper creation uses the same endpoint binding.",
    "Failed creation in all three repair branches does not masquerade as unchanged.",
    "HTTP failure, invalid JSON, wrong/empty metadata structure and unavailable metadata remain distinct from missing base and broker refusal.",
    "Lost/missing friendly bases never trigger implicit registry lookup or create.",
    "Unchanged valid wrapper yields unchanged without any create call.",
    "Uppercase/trailing-slash/default-port normalization, IPv6 loopback and rejection of deceptive remote URLs.",
    "Duplicate in-flight suppression, independent new endpoints, cooldown after completion, failed-scan retry after cooldown and synchronous callback throw recovery."
  ],
  "verificationLimits": [
    "All fetch calls and exec/execFile/spawn entry points used by the new fixtures are mocked or rejected. Synthetic memory/device metadata does not claim actual GPU placement.",
    "No actual model creation, repair, model loading, inference, network request, CUDA workload, service change, shared build or publication was performed.",
    "The existing omnius-expanded-models.test.ts interactive source-string expectations are owned by the native frontend integration agent and are excluded from this patch; the first exploratory batch exposed their stale pre-existing interactive naming assertion.",
    "This change retains existing per-request metadata deadlines and sequential variant traversal. It does not introduce an overall sweep deadline or cross-process scheduling.",
    "Read-only local filesystem discovery found 20 wrapper manifests with valid JSON/present referenced blobs and 13 non-reversible base names, but did not execute the sweep or establish the specific seven runtime failures."
  ]
}
