Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,29 @@ this file. The format follows Keep a Changelog, and versioned releases follow
Semantic Versioning where the repository publishes a release.

## [Unreleased]
- Remove `scripts/ci/select_nvidia_nim_model.py`: an orphaned helper that
opened a direct `HTTPSConnection` to `integrate.api.nvidia.com` with a raw
provider API key to resolve a live NVIDIA NIM model id, predating the
ADR-0003 gateway migration and wired into nothing (no workflow or script
referenced it — only its own dedicated test, `test_scheduled_autofix_routes_through_contextual_orchestrator`
already pins `https://integrate.api.nvidia.com/v1` as a **forbidden**
string in `pr-review-autofix.yml`). Removed with its test
(`tests/test_select_nvidia_nim_model.py`). Not the same thing as
`contextual-orchestrator`'s own legitimate internal support for NVIDIA NIM
as one of its five backend providers, which is unmodified and out of this
repository's scope. Corrected four stale pre-ADR-0003 "single hardcoded
`NVIDIA_NIM_API_KEY`" descriptions of the scheduled autofix worker's model
credential in `docs/doctoring/hourly-nvidia-nim-autofix.md` (dated
addendum, extensive historical detail kept as history),
`docs/doctoring/originweave-hourly-review-caller.md`,
`docs/doctoring/nonnest2-hourly-review-caller.md` (one stale sentence
each), and `docs/automation/hourly-review-repair.md` (summary bullet and
the Clearfolio credential paragraph) to describe the current five-secret
`contextual-orchestrator` gateway routing instead. Split out of
`ContextualWisdomLab/.github#1437` per its exact-head governance review's
fifth acceptance criterion: this cleanup is orthogonal to that PR's
Strix pool-gating behavior repair and belongs in its own,
independently-reviewable change.
- Raise `contextual_orchestrator_review_sidecar.sh`'s
`ORCHESTRATOR_CATALOG_FAMILY_CAP` default from 4 to 8: root-caused the
live "no provider route passed the Strix plain-chat preflight" outage
Expand Down
26 changes: 16 additions & 10 deletions docs/automation/hourly-review-repair.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ engine**.
contextual-orchestrator, Inkspan, or another CWL service with an explicit
repository and base branch.
- `pr-review-autofix.yml` is the bounded write-capable worker. It uses OpenCode
with NVIDIA NIM and does not approve or merge pull requests.
routed through the vendored contextual-orchestrator gateway and does not
approve or merge pull requests.

Orgmetra's caller remains provider-neutral. The intended model boundary is the
contextual-orchestrator gateway: provider keys stay in its KV registry and
automatic model discovery selects upstream models. A caller schedule is not
evidence that gateway credentials, discovery, or a live OpenCode tool loop are
available; those facts require exact worker-run evidence.
Every caller, including Clearfolio's, is provider-neutral by design. The model
boundary is the contextual-orchestrator gateway: provider keys stay in its KV
registry and automatic model discovery selects upstream models. A caller
schedule is not evidence that gateway credentials, discovery, or a live
OpenCode tool loop are available; those facts require exact worker-run
evidence.

Merge eligibility remains owned by the separate merge scheduler, branch
protection, required checks, independent review, and unresolved-thread policy.
Expand All @@ -44,8 +46,10 @@ not overlap its successor. At most one repair dispatch is created per run.

The caller passes only the established `PR_REVIEW_MERGE_TOKEN` and
`OPENCODE_APPROVE_TOKEN` scheduler credentials. It does not receive or forward
`NVIDIA_NIM_API_KEY`; the model credential is scoped exclusively to the two
OpenCode execution steps in the separately reviewed autofix worker.
any of the five gateway provider secrets (`BYTEZ_API_KEY`, `NVIDIA_NIM_API_KEY`,
`NVIDIA_NIM_API_KEY_SUB`, `OPENROUTER_API_KEY`, `OPENAI_API_KEY`); those stay
scoped exclusively to the contextual-orchestrator sidecar provisioning step in
the separately reviewed autofix worker.

## Orgmetra execution contract

Expand Down Expand Up @@ -199,7 +203,8 @@ organization-level queue inspection and bounded repair dispatch.
When a scheduled run fails, classify the result before rerunning:

- no actionable file-scoped feedback: expected no-op;
- missing `NVIDIA_NIM_API_KEY`: central secret configuration failure;
- missing gateway provider secrets or an unprovisioned contextual-orchestrator
sidecar: central secret/configuration failure;
- head changed: safe optimistic-concurrency refusal; inspect the new head rather
than retrying predecessor evidence;
- out-of-scope or ignored-path change: treat as a security failure and preserve
Expand All @@ -225,7 +230,8 @@ Permanent tests prove:
- the dispatch budget and same-head retry floor remain one;
- caller and reusable-workflow secrets are explicit and never use
`secrets: inherit`;
- immutable source, NVIDIA-only model authentication, child-process credential
- immutable source, gateway-only model authentication (no direct-provider
credential in the model child process), child-process credential
stripping, live-head guards, and independent reviewer identity remain intact;
- ordinary and conflict repair share the complete ignored-inclusive snapshot and
NUL-delimited allowlist boundary;
Expand Down
37 changes: 37 additions & 0 deletions docs/doctoring/hourly-nvidia-nim-autofix.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,42 @@
# Hourly NVIDIA NIM Review-Autofix Boundary

## Update (2026-08-30): model execution migrated to the contextual-orchestrator gateway

This record's "Decision", "Provider contract", and "Credential boundary"
sections below describe the worker's design **as it stood before**
[ADR-0003](../adr/0003-contextual-orchestrator-vendored-free-zdr.md)
(2026-08-27): a single direct NVIDIA NIM provider
(`https://integrate.api.nvidia.com/v1`), the `mistralai/mistral-small-4-119b-2603`
writer model, and a lone `NVIDIA_NIM_API_KEY` credential bound to the two
OpenCode execution steps. That description is now superseded, not deleted —
kept below as the historical record of the write-scope/security work this
file documents, most of which (the allowlist, snapshot/verification, hook
suppression, and explicit push-destination controls) is provider-independent
and unchanged.

What actually changed: `pr-review-autofix.yml`'s OpenCode execution now
routes through the vendored `contextual-orchestrator` gateway sidecar
(`scripts/ci/contextual_orchestrator_review_sidecar.sh`), provisioned with
all five provider secrets (`BYTEZ_API_KEY`, `NVIDIA_NIM_API_KEY`,
`NVIDIA_NIM_API_KEY_SUB`, `OPENROUTER_API_KEY`, `OPENAI_API_KEY`) and the
fail-closed zero-cost virtual model `contextual-orchestrator/orchestrator/free`
for both the primary and small model. There is no direct
`https://integrate.api.nvidia.com/v1` base URL, no hardcoded
`mistralai/mistral-small-4-119b-2603` or `nvidia/nemotron-3-nano-30b-a3b`
model id, and no bare `NVIDIA_API_KEY`/`NVIDIA_NIM_API_KEY` environment
variable read anywhere in the workflow's execution steps — enforced by
`tests/test_pr_review_autofix_nvidia_nim_contract.py::test_scheduled_autofix_routes_through_contextual_orchestrator`,
which asserts the gateway strings are present and the direct-NVIDIA base URL
and legacy model ids are absent. Separately,
`scripts/ci/select_nvidia_nim_model.py` — a standalone helper that resolved a
live NVIDIA NIM model id by calling `integrate.api.nvidia.com` directly —
was found wired into nothing (no workflow or script referenced it, only its
own test) and removed as orphaned dead code predating this migration.

This does not change contextual-orchestrator's own internal use of NVIDIA NIM
as one of its five auto-discovered backend providers; that remains entirely
the gateway's concern, not this worker's.

## Decision

Materialize accepts only exact SHA-256 pins or a bounded relative `-r` include; a lone `--require-hashes` line is not lock evidence.
Expand Down
13 changes: 10 additions & 3 deletions docs/doctoring/nonnest2-hourly-review-caller.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,16 @@ OpenCode GitHub App token from GitHub OIDC when the mapped PAT is absent
forbids executing the caller with write or model privileges it does not
need (MITRE, 2026).

Model execution remains inside the central worker. The model credential
is the GitHub Secret `NVIDIA_NIM_API_KEY`; the caller does not receive or
forward it.
Model execution remains inside the central worker, which routes through the
vendored `contextual-orchestrator` gateway sidecar
(`scripts/ci/contextual_orchestrator_review_sidecar.sh`) using all five
provider secrets (`BYTEZ_API_KEY`, `NVIDIA_NIM_API_KEY`,
`NVIDIA_NIM_API_KEY_SUB`, `OPENROUTER_API_KEY`, `OPENAI_API_KEY`) and the
fail-closed zero-cost `orchestrator/free` pool (see
[ADR-0003](../adr/0003-contextual-orchestrator-vendored-free-zdr.md)); the
caller receives none of them. (Updated 2026-08-30: this paragraph originally
described a single hardcoded `NVIDIA_NIM_API_KEY` model credential, which
predates the ADR-0003 gateway migration.)

Before protected-master activation, the repository variable
`OPENCODE_REPOSITORY_DISPATCH_TARGETS` must contain the exact
Expand Down
13 changes: 10 additions & 3 deletions docs/doctoring/originweave-hourly-review-caller.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,16 @@ OpenCode GitHub App token from GitHub OIDC when the mapped PAT is absent
forbids executing the caller with write or model privileges it does not
need (MITRE, 2026).

Model execution remains inside the central worker. The model credential
is the GitHub Secret `NVIDIA_NIM_API_KEY`; the caller does not receive or
forward it.
Model execution remains inside the central worker, which routes through the
vendored `contextual-orchestrator` gateway sidecar
(`scripts/ci/contextual_orchestrator_review_sidecar.sh`) using all five
provider secrets (`BYTEZ_API_KEY`, `NVIDIA_NIM_API_KEY`,
`NVIDIA_NIM_API_KEY_SUB`, `OPENROUTER_API_KEY`, `OPENAI_API_KEY`) and the
fail-closed zero-cost `orchestrator/free` pool (see
[ADR-0003](../adr/0003-contextual-orchestrator-vendored-free-zdr.md)); the
caller receives none of them. (Updated 2026-08-30: this paragraph originally
described a single hardcoded `NVIDIA_NIM_API_KEY` model credential, which
predates the ADR-0003 gateway migration.)

Before protected-main activation, the repository variable
`OPENCODE_REPOSITORY_DISPATCH_TARGETS` must contain the exact
Expand Down
209 changes: 0 additions & 209 deletions scripts/ci/select_nvidia_nim_model.py

This file was deleted.

Loading
Loading