Skip to content

docs: close out RESEARCH_227 v4 after fail-closed OpenRouter fetch - #962

Open
erikHtoo wants to merge 5 commits into
Augustas11:mainfrom
erikHtoo:docs/research-227-v4-closeout
Open

docs: close out RESEARCH_227 v4 after fail-closed OpenRouter fetch#962
erikHtoo wants to merge 5 commits into
Augustas11:mainfrom
erikHtoo:docs/research-227-v4-closeout

Conversation

@erikHtoo

@erikHtoo erikHtoo commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Documents the first authenticated OpenRouter pricing-engine run and the fail-closed result.
  • Adds the RESEARCH_227 v4 rate-card close-out memo.
  • Establishes the archive convention for future validated snapshots and proposals.
  • Documents daily refresh cadence, a 48-hour staleness threshold, and the fetch → compute workflow.

Live-run result

The authenticated fetch failed closed while resolving this dated OpenRouter identity:

z-ai/glm-5.2-20260616

  • Exit status: 2
  • Snapshot artifacts: none emitted
  • Proposal: intentionally not run
  • Rate-card and policy: unchanged

The engine did not guess an alias, invent a market price, emit a partial snapshot, or modify the live rate-card.

Verification

$env:PYTHONDONTWRITEBYTECODE='1'
python -m unittest -v scripts/tests/test_openrouter_pricing_engine.py
git diff --check

Result: 30 tests passed; whitespace check passed.

Follow-up

Repair or clarify the dated OpenRouter ranking identity versus catalog/endpoint identity contract, then rerun authenticated fetch. Only a successfully validated snapshot may be passed to compute.

Governance declaration

SPEC-GOVERNANCE-DECLARATION-BEGIN
{
"schema_version": "spec-pr-governance-v1",
"behavior_change": "yes",
"contract_change": "none",
"specs": ["SPEC-023"],
"requirements": ["SPEC-023-R001"],
"authority_domains": ["installer-autotune-policy"],
"arbitration": ["CODE_BUG"],
"tests": ["PYTHONDONTWRITEBYTECODE=1 python -m unittest -v scripts/tests/test_openrouter_pricing_engine.py"],
"journeys": ["not-required"]
}
SPEC-GOVERNANCE-DECLARATION-END

@Augustas11 Augustas11 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Changes requested — failed-run hand-back, not RESEARCH_227 close-out

The fail-closed behavior was correct: no alias was guessed, no partial/hand-built snapshot was emitted, compute was not run, and neither the policy nor live rate card was modified. However, this PR is not ready to merge as a RESEARCH_227 operational close-out.

Why the run failed

The current OpenRouter catalog maps the dated canonical slug z-ai/glm-5.2-20260616 to both:

  • z-ai/glm-5.2
  • z-ai/glm-5.2:batch

The engine resolver only has a narrow rule for selecting a regular paid model over an explicit :free variant. It does not distinguish the regular model from :batch, so both remain candidates and the resolver correctly fails closed with:

catalog response cannot uniquely resolve ranked model 'z-ai/glm-5.2-20260616' to an endpoint model id

Please record this concrete regular-versus-:batch canonical-slug collision in the memo, rather than describing only a generic dated-model ambiguity, and identify the resolver/test repair as the follow-up blocker.

Why the original goals were not achieved

Because fetch emitted no validated snapshot:

  • no first durable live snapshot was produced;
  • compute correctly could not run, so no first live proposal exists;
  • no trusted cheapest-active-endpoint inputs existed for priced-row movements;
  • no validated top-50 policy-coverage diff existed;
  • no demand-backed policy additions could be proposed.

The task explicitly permits a documented fail-closed hand-back, so this is a valid failure outcome. But it must be labelled a failed-run hand-back/blocker record, not an operational rate-card close-out. RESEARCH_227 remains blocked until the identity issue is repaired and a successful authenticated fetch → compute run produces the snapshot, proposal, priced-row movements, and candidate diff.

Required changes

  1. Match the archive contract to actual engine filenames. docs/research/openrouter-snapshots/README.md:7-8 and docs/runbooks/openrouter-pricing-engine.md:34-35 document compact timestamps, no snapshot digest, and <digest8>. scripts/openrouter_pricing_engine.py:1208-1217 emits a hyphenated UTC timestamp plus a 16-character digest on both files. Document the exact executable naming grammar.

  2. Commit a sanitized machine-generated failed-run receipt. The prose at RESEARCH_227_RATE_CARD_V4_MEMO.md:29-60 is not independently auditable and conflicts with the new runbook's instruction to persist stdout, stderr, and exit status. Add a dated, credential-redacted receipt containing the UTC run time/ranking window, engine commit SHA, exact command, exit status, sanitized stderr, output-directory listing, and evidence digest. Do not create a placeholder snapshot or archive partial demand data as trusted input.

  3. Remove or sharply qualify conclusions from the unarchived “operator-provided top-50 table.” At memo lines 9, 15-21, and 101-131, the input is explicitly untrusted and has no durable provenance. It cannot support an exhaustive “only newcomer” or demand-gate conclusion. State that candidate-addition analysis is blocked pending a validated cohort; any Mistral work is illustrative offline research only.

  4. Correct Mistral NeMo evidence. At memo lines 108-119, safetensors.total = 1,914,065,920 was misread as 1.91 GB. The linked MLX repository stores approximately 6.89 GB / 6.42 GiB. Also correct the OpenRouter identity from mistral/mistral-nemo to mistralai/mistral-nemo.

  5. Source or qualify the Mistral TPS ranges. The 8-12 and 25-35 TPS values have no benchmark, calculation, or precise hardware basis. Cite the derivation or mark them explicitly as unverified estimates.

  6. Cite the exact Nemotron governing agreement. The NVIDIA base-model card identifies the NVIDIA Nemotron Open Model License, not the generic NVIDIA Open Model License currently cited at memo lines 140-142. Cite the exact model card (preferably pinned) and its linked license. The commercial-permission conclusion may remain, but note the pre-existing policy evidence mismatch for owner follow-up rather than silently applying a policy change.

  7. Describe the GLM blocker precisely. Record that z-ai/glm-5.2 and z-ai/glm-5.2:batch share canonical slug z-ai/glm-5.2-20260616, while the dated endpoint resolves to the regular identity. This makes the hand-back actionable.

  8. Change close-out language. Update the title/status/conclusion so this lands as a failed-run hand-back and blocker record. Do not claim that the first live rate-card run or RESEARCH_227 payoff is closed until validated snapshot and proposal artifacts exist.

Verification

  • Complete PR diff reviewed against base 0d524984feb3150548ea1ac3b38610ebb293b141.
  • OpenRouter pricing-engine tests: 30/30 passed.
  • make test: passed.
  • git diff --check: passed.
  • Required CI is green.
  • No secrets, money-path writes, rate-card writes, policy writes, or apply mode were introduced.

@Augustas11

Copy link
Copy Markdown
Owner

Clarification to requested changes: complete the original task in this PR

The requested-changes review described how to preserve the current attempt if it remains a failed-run hand-back. That is not the desired final scope for this PR.

Please continue from the diagnosed blocker and complete the original RESEARCH_227 v4 task. The PR will be ready for re-review when all of the following are present:

  1. Resolver repair, with tests. Resolve the z-ai/glm-5.2 versus z-ai/glm-5.2:batch shared-canonical-slug case using endpoint-confirmed identity—not a guessed alias or an unconditional rule that strips/ignores every :batch row. Accept the endpoint response ID only when it uniquely identifies a catalog candidate; otherwise continue to fail closed. Add tests for the successful regular/:batch case and unresolved/mismatched/malformed cases, while preserving existing :free and dated-alias behavior.

  2. Successful authenticated live fetch. Rerun the documented top-50/30-day fetch after the repair. Commit the untouched, digest-stamped engine snapshot under the archive path together with sanitized command/run evidence. If authenticated access is no longer available, flag that prerequisite immediately so the owner can run fetch and provide the committed snapshot; do not fabricate or reconstruct it.

  3. Successful compute. Run compute against exactly the fresh snapshot, current scripts/openrouter_pricing_policy.json, and current phase3-binary/catalog/autotune/rate-card.json. Commit the untouched proposal next to the snapshot. Do not apply it and do not edit the live rate card.

  4. Completed V4 memo. Replace the failed-run-only conclusions with the actual priced-row movements for all four policy models, the structured proposal interpretation, the validated top-50 versus policy coverage diff, realistic candidate additions in policy-row shape with verified serving path/license/profile evidence, the four exact license confirmations, and data-quality notes. Correct the Mistral and Nemotron evidence issues identified in the review.

  5. Accurate archive/runbook contract. Document the exact filenames emitted by the engine, the cadence/staleness rule, fetch→compute gating, and durable evidence layout.

The current failed run should remain documented as useful historical evidence, but a failed-run record alone does not close RESEARCH_227 v4. The legitimate close-out condition is:

resolver fix + successful authenticated fetch + committed snapshot + successful compute + committed proposal + completed movement/candidate memo.

Please keep the PR in changes-requested state until that end-to-end result is available for review.

@erikHtoo

erikHtoo commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the requested end-to-end close-out:

  • Added endpoint-confirmed resolver handling for the z-ai/glm-5.2 / z-ai/glm-5.2:batch canonical-slug collision, with success, mismatch, and malformed-response tests.
  • Completed an authenticated top-50 / 30-day fetch and committed the untouched digest-stamped snapshot plus sanitized fetch receipt.
  • Computed and committed the proposal from that exact snapshot, current policy, and current rate-card reference, plus sanitized compute receipt.
  • Replaced the failed-run-only memo with the actual proposal interpretation, coverage diff, license corrections, candidate screening, and data-quality notes.
  • Updated archive/runbook naming, evidence, staleness, fetch-to-compute gating, and resolver documentation.

Verification: 33 Python tests passed; git diff --check passed; receipt digests verified; no rate-card or policy changes were made.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants