openclaw - 💡(How to fix) Fix [Ballast] Build vetting.mjs — B.5 pipeline gate [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#69866Fetched 2026-04-22 07:47:08
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Author
Participants

lib/shopify/vetting.mjs is the pipeline step that enforces the product vetting rubric before any listing is created. It sits between Agent A's catalog and the B.5 listing renderer.

Full spec: data/scripts/PRODUCT_VETTING_PROTOCOL.md Full B.5 plan: data/scripts/PLAN_AGENT_B_WELLNESS.md §5

Root Cause

lib/shopify/vetting.mjs is the pipeline step that enforces the product vetting rubric before any listing is created. It sits between Agent A's catalog and the B.5 listing renderer.

Full spec: data/scripts/PRODUCT_VETTING_PROTOCOL.md Full B.5 plan: data/scripts/PLAN_AGENT_B_WELLNESS.md §5

Code Example

// Signature
export async function runVetting(candidate, { apiKey, logger } = {})
// Returns
{
  sku_id, tier, tier_label,
  gates: { G1_mechanism, G2_threshold, G3_claim_safety, G4_supplier_quality },
  mechanism_one_sentence, evidence_refs, nonclaims, weak_evidence,
  threshold_spec, verdict, rationale
}
RAW_BUFFERClick to expand / collapse

Context

lib/shopify/vetting.mjs is the pipeline step that enforces the product vetting rubric before any listing is created. It sits between Agent A's catalog and the B.5 listing renderer.

Full spec: data/scripts/PRODUCT_VETTING_PROTOCOL.md Full B.5 plan: data/scripts/PLAN_AGENT_B_WELLNESS.md §5

Interface

// Signature
export async function runVetting(candidate, { apiKey, logger } = {})
// Returns
{
  sku_id, tier, tier_label,
  gates: { G1_mechanism, G2_threshold, G3_claim_safety, G4_supplier_quality },
  mechanism_one_sentence, evidence_refs, nonclaims, weak_evidence,
  threshold_spec, verdict, rationale
}

verdict is one of: approve | hitl_required | auto_reject

Steps inside runVetting()

  1. Tier assignment — LLM structured call using prompts/vetting_evidence.mjs. Returns candidate evidence_refs[]. Validate URLs with HEAD fetch (catch hallucinated PubMed links).
  2. G1 — derive mechanism_one_sentence from evidence refs. Fail if none.
  3. G2 — compare candidate.threshold_spec (from supplier data) to published therapeutic min. Auto-pass if product is not dose-dependent.
  4. G3 — LLM call generates ≥3 non-claims. Fail if generation returns < 3.
  5. G4 — check candidate.supplier_spec_sheet_url present; for devices, check candidate.regulatory_docs.
  6. Verdict matrix — per PRODUCT_VETTING_PROTOCOL.md §3.
  7. Cache result on candidate row (vetting_refreshed_at).

Tests (8 fixtures from PRODUCT_VETTING_PROTOCOL.md §9)

#FixtureExpected
1Silk eye mask, spec sheet presentapprove T2
2Red-light panel, 2 mW/cm² (below threshold)auto_reject G2
3Red-light panel, 12 mW/cm², 510(k) clearedapprove T1
4Crystal pendant, no mechanismauto_reject T4
5Magnesium bath flakes, observational onlyhitl_required T3
6Weighted blanket, spec sheet missingauto_reject G4
7Vagus device, 1 RCT, CE markedapprove T2
8Vagus device, 1 RCT, no CE/FCCauto_reject G4

Depends on

  • Initial SKU research pass (for real evidence refs to validate against)
  • lib/ollama_cloud.mjschatWithFallback (reuse, do not reinvent)
  • lib/schemas.mjs — add vetting verdict schema

Files to create

  • data/scripts/lib/shopify/vetting.mjs
  • data/scripts/lib/shopify/prompts/vetting_evidence.mjs
  • data/scripts/lib/shopify/vetting_ruleset.mjs (known product-class cache)
  • data/scripts/__tests__/unit/vetting.test.mjs (8 fixture tests)

extent analysis

TL;DR

Implement the runVetting function in lib/shopify/vetting.mjs according to the provided specification and interface to enforce the product vetting rubric.

Guidance

  • Review the PRODUCT_VETTING_PROTOCOL.md and PLAN_AGENT_B_WELLNESS.md documents to understand the vetting process and requirements.
  • Implement the 7 steps inside runVetting() as described, including tier assignment, gate checks, and verdict matrix.
  • Use the provided test fixtures to validate the implementation and ensure correct verdicts are returned for different scenarios.
  • Integrate with dependent libraries, such as lib/ollama_cloud.mjs and lib/schemas.mjs, to reuse existing functionality and validate vetting verdicts.

Example

// Example implementation of the runVetting function
export async function runVetting(candidate, { apiKey, logger } = {}) {
  // Tier assignment
  const evidenceRefs = await getEvidenceRefs(candidate);
  // Gate checks and verdict matrix
  const verdict = await applyVettingRules(candidate, evidenceRefs);
  return {
    // Return the vetting result
    sku_id: candidate.sku_id,
    tier: candidate.tier,
    tier_label: candidate.tier_label,
    gates: {
      G1_mechanism: candidate.G1_mechanism,
      G2_threshold: candidate.G2_threshold,
      G3_claim_safety: candidate.G3_claim_safety,
      G4_supplier_quality: candidate.G4_supplier_quality,
    },
    mechanism_one_sentence: candidate.mechanism_one_sentence,
    evidence_refs: evidenceRefs,
    nonclaims: candidate.nonclaims,
    weak_evidence: candidate.weak_evidence,
    threshold_spec: candidate.threshold_spec,
    verdict: verdict,
    rationale: candidate.rationale,
  };
}

Notes

The implementation of the runVetting function requires careful attention to the provided specification and test fixtures to ensure correct functionality. Additionally, the integration with dependent libraries and the reuse of existing functionality are crucial to avoid reinventing the wheel.

Recommendation

Apply the workaround by implementing the runVetting function according to the provided specification and testing it thoroughly with the given test fixtures to ensure correct verdicts are returned for different scenarios. This approach allows for a structured and systematic implementation of the product vetting rubric.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Ballast] Build vetting.mjs — B.5 pipeline gate [1 participants]