═══════════════════════════════════════════════════════════════════════════════ ORO — RACE-AWARE AGENT BUILD v18 (FINAL) Analyze race · Pick strategy · Build N agents · Zero known failure modes ═══════════════════════════════════════════════════════════════════════════════ API: https://api.oroagents.com Docs: https://docs.oroagents.com/docs/miners/code-requirements Repo: /opt/sn15/oro Harness: ./local-test/run.sh · check_code.py · run_six_gate.py · pick_gate_six.py ═══════════════════════════════════════════════════════════════════════════════ §0 WHAT YOU RECEIVE (user input — parse first) ═══════════════════════════════════════════════════════════════════════════════ RACE_NUMBER: e.g. 86 OUTPUT_COUNT: how many distinct .py files to produce (1–12) STRATEGIES: auto | list see §2 strategy catalog OPTIONAL: FORCE_SOLVER_RANK: skip auto solver pick FORCE_PRODUCT_RANK: fusion lane override FORCE_SHOP_RANK: FORCE_VOUCHER_RANK: SUITE_ID: default from race record Example: RACE_NUMBER: 86 OUTPUT_COUNT: 3 STRATEGIES: auto You MUST complete §1–§3 analysis for the race BEFORE writing any code. You MUST produce exactly OUTPUT_COUNT files, each with a distinct strategy (or distinct rank tuple when same strategy type). ═══════════════════════════════════════════════════════════════════════════════ §1 NON-NEGOTIABLE OUTCOMES (every output file) ═══════════════════════════════════════════════════════════════════════════════ ✓ No category at 0% or near-0% after submit (Product / Shop / Voucher) ✓ Pass-row regression gate 6/6 (§10 V12b) before write ✓ check_code.py ok; server plagiarism risk avoided (§10 V35) ✓ No obfuscation-call, no decoy exposure, no merge crashes ✓ No comments or docstrings added to .py output ✓ Filename encodes race + method + source ranks (§1b) ✗ Never submit if ANY pass-row regresses vs chosen baseline ✗ Never tri-paste three downloads with prefix rename only (INC-9) ✗ Never use code-2/3 supplemental logic to improve eval scores ✗ Never hardcode product_ids, query literals, or suite-specific vocab ═══════════════════════════════════════════════════════════════════════════════ §1b OUTPUT FILENAME CONVENTION (method must be obvious) ═══════════════════════════════════════════════════════════════════════════════ myagents/{RACE}-{METHOD}-{DETAIL}.py METHOD tags (exact strings): fusion — tri-lane merge: best product + best shop + best voucher Detail: p{rank}-s{rank}-v{rank} Example: 86-fusion-p10-s22-v23.py upgrade — single solver copied + surgical fixes only Detail: r{rank}-{agent_name_slug} Example: 86-upgrade-r1-dominate.py hybrid — solver upgrade (B0) + inline supplemental shop/voucher closures Detail: solver{r}-shop{r}-vouch{r} Example: 86-hybrid-solver1-shop5-vouch22.py port — compliant structural port of fusion picks (plagiarism-safe) Detail: p{rank}-s{rank}-v{rank} Example: 86-port-p10-s22-v23.py agent_name_slug = lowercase alphanumeric from API agent_name, max 20 chars. When OUTPUT_COUNT > 1, each file MUST use a different METHOD or different rank tuple. Never write two identical filenames. ═══════════════════════════════════════════════════════════════════════════════ §A ORO COMPLIANCE (hard stops) ═══════════════════════════════════════════════════════════════════════════════ FORBIDDEN: ✗ def _0x*, def _k[hex]{4,}, fake hash selectors, chr() padding chains ✗ Renaming API keys: shop_id, product_ids, q, price, service ✗ base64, zlib, codecs, eval, exec ✗ Names: decoy, FusionSessionCoordinator, shop_decoy_main, _run_decoy_isolated, shadow_decoy, lane_stub, supplemental_decoy ✗ Verbatim concatenation of 3 leaderboard agents (INC-9) ✗ Comments or docstrings in output .py ALLOWED: ✓ Readable domain names, _with_isolated_registry, inline supplemental hooks ✓ S_supplemental_session, V_supplemental_session (hybrid only) ✓ from os import getenv (credentials only — not behavior routing) ═══════════════════════════════════════════════════════════════════════════════ §2 STRATEGY CATALOG (pick per output file) ═══════════════════════════════════════════════════════════════════════════════ When STRATEGIES: auto — assign strategies using §3 decision matrix. When STRATEGIES: fusion,upgrade,hybrid — use in order; repeat or vary ranks if OUTPUT_COUNT exceeds list length. ┌──────────┬─────────────────────────────────────────────────────────────┐ │ METHOD │ When to use │ ├──────────┼─────────────────────────────────────────────────────────────┤ │ fusion │ Top agent DIFFERS per category; no single solver ≥85% │ │ │ overall; lane specialists beat unified solver by ≥15pp │ │ │ on that lane. Use §6 FUSION build. │ ├──────────┼─────────────────────────────────────────────────────────────┤ │ port │ Same picks as fusion BUT prior fusion failed plagiarism │ │ │ (INC-9) or V35 lane structural_fp ≥ 75%. Use §6 PORT build. │ ├──────────┼─────────────────────────────────────────────────────────────┤ │ upgrade │ One agent ≥ top per-category on 2+ lanes AND overall │ │ │ race_score highest. Use §7 UPGRADE build. │ ├──────────┼─────────────────────────────────────────────────────────────┤ │ hybrid │ Solver strong on product, weak on shop and/or voucher; │ │ │ category specialists exist with ≥20pp lane advantage. │ │ │ Use §8 HYBRID build (v17 stealth — supplemental discarded). │ └──────────┴─────────────────────────────────────────────────────────────┘ DEFAULT multi-build (OUTPUT_COUNT=3, STRATEGIES=auto): File 1: best overall strategy (usually upgrade OR hybrid) File 2: fusion (or port if plagiarism risk on specialists) File 3: runner-up strategy with different rank tuple ═══════════════════════════════════════════════════════════════════════════════ §3 PHASE 1 — RACE INTELLIGENCE (mandatory before any code) ═══════════════════════════════════════════════════════════════════════════════ ── 3a. Resolve race ── GET /v1/public/races/history → record WHERE race_number == RACE_NUMBER → race_id, suite_id, status GET /v1/public/races/{race_id} → qualifiers[] ✗ WRONG: GET /leaderboard?limit=N, entries[RANK-1], global /leaderboard?q= ✗ WRONG: GET /v1/public/races/{race_id}/leaderboard (404 on some builds) For each qualifier q (skip is_discarded=true if present): ASSERT q["race_rank"] is int agent_version_id = q["agent_version_id"] agent_name, version, final_score, race_score (if present) Print RANK RESOLUTION TABLE — ABORT if empty. ── 3b. Per-agent lane scoring ── For EACH qualifier (or top 30 by race_rank to limit API calls): GET /v1/agent-versions/{agent_version_id}/problems → list problems with lane/category, passed, execution_time, error Compute per lane: product_pass_rate = passed_product / total_product shop_pass_rate = passed_shop / total_shop voucher_pass_rate = passed_voucher / total_voucher overall_pass_rate = passed_all / total_all Flag architecture hints (download only if top-15 per lane or selected): TYPE-A standalone | TYPE-B nested P_/S_/V_ | TYPE-C custom tools Print LANE LEADERBOARD: | rank | agent | product% | shop% | voucher% | overall% | notes | |------|-------|----------|-------|----------|----------|-------| Derive picks: PICK_PRODUCT = highest product_pass_rate (tie: lower race_rank) PICK_SHOP = highest shop_pass_rate PICK_VOUCHER = highest voucher_pass_rate PICK_SOLVER = highest overall_pass_rate OR highest race_score (tie: lower race_rank) ── 3c. Weakness extraction (for upgrade/hybrid B0 only) ── Download CODE for PICK_SOLVER: POST /v1/public/artifacts/download-url {"agent_version_id": "...", "artifact_type": "AGENT_CODE"} → /tmp/oro_race{R}/solver_r{rank}.py WEAKNESS REPORT (solver only): | lane | pass | fail | top failure patterns (A–E) | |------|------|------|----------------------------| Failure classes: A) Routing B) Search C) Constraint D) Timeout E) Tool/registry IMPROVEMENT PLAN: one minimal surgical fix per pattern — function names, change description, regression risk note. STOP until weakness report + plan exist. ── 3d. Strategy assignment matrix ── Print BUILD PLAN TABLE (one row per output file): | # | filename | method | solver_src | shop_src | vouch_src | rationale | |---|----------|--------|------------|----------|-----------|-----------| Rules: • If PICK_SOLVER wins all 3 lanes → prefer upgrade for file 1 • If lane winners are 3 different agents → prefer fusion or port • If solver wins product but loses shop/voucher by ≥20pp → hybrid • If any specialist download is TYPE-B nested → plan TYPE-B extract (INC-3) • If fusion planned and specialists share >80% structural_fp → use port instead of fusion for that file STOP until BUILD PLAN TABLE approved (print it — user may override ranks). ═══════════════════════════════════════════════════════════════════════════════ §4 PHASE 2 — REGRESSION GATE PROBLEMS (per output file) ═══════════════════════════════════════════════════════════════════════════════ From PICK_SOLVER (or lane-specific pick for fusion) problems API, build gate_regression_6.json: | # | category | type | problem_id | baseline | purpose | |---|----------|------|------------|----------|---------| | 1 | Product | PASS | | pass | no regression | | 2 | Product | FAIL | | fail | try fix | | 3 | Shop | PASS | | pass | no regression | | 4 | Shop | FAIL | | fail | try fix | | 5 | Voucher | PASS | | pass | no regression | | 6 | Voucher | FAIL | | fail | try fix | Store: local-test/problems/gate_regression_{RACE}_{METHOD}.json If API sparse: supplement GET /v1/public/suites/{suite_id}/problems ═══════════════════════════════════════════════════════════════════════════════ §5 INCIDENT CATALOG (never repeat) ═══════════════════════════════════════════════════════════════════════════════ INC-1 Internal re-classify after router → shop/voucher 0% Fix: category lock when source has __identify_challenge__ INC-2 Missing module constants (LLM_RETRY_MAX, etc.) → crash Fix: V27 symbol closure per lane INC-3 TYPE-B nested source — wrong extract (outer router pasted) Fix: lane slice + entry wrapper only INC-4 Tool signature mismatch (ids vs product_ids) → infinite retry Fix: V33 register_tool override OR fix ALL call sites INC-5 register_tool on product/shop but not voucher Fix: V34 parity all lanes that source registers INC-6 Custom tool names (t_view_*) partially remapped Fix: grep execute_tool_call — zero misses INC-7 Static-only validation → eval 0% Fix: docker six-gate / V12b mandatory INC-8 Wrong rank API → wrong source entirely Fix: §3a qualifiers[].race_rank only INC-9 Verbatim tri-paste → submit plagiarism reject Fix: use port method or §6 PORT protocol; V35 per-lane <75% struct INC-10 Obfuscation (_0x names) → obfuscation-call reject Fix: §A readable names only INC-11 Supplemental before primary / supplemental improves score expectation Fix: hybrid only — primary_trace returned; supplemental in registry shell INC-12 Solver ignores problem_data["category"] Fix: CAT_MAP / category-first routing in all methods ═══════════════════════════════════════════════════════════════════════════════ §6 BUILD — FUSION (tri-lane, all three lanes contribute to output) ═══════════════════════════════════════════════════════════════════════════════ Sources: PICK_PRODUCT, PICK_SHOP, PICK_VOUCHER (three downloads). Structure: [IMPORTS] [SECTION A — shared @Tool layer, once] [B1 — product lane closure] [B2 — shop lane closure] [B3 — voucher lane closure] [SECTION D — resolve_task_kind router ≤80 lines] agent_main → run_{product,shop,voucher}_lane Lane rules (ALL): • TYPE-B: extract lane slice only (INC-3) • Category lock if __identify_challenge__ (INC-1) • register_tool parity (INC-4/5/6) • V27 symbol closure • B-sections: zero @Tool (V4) ⚠ FUSION uses verbatim copy WITH prefixes ONLY if V35 pre-check passes. If any lane structural_fp ≥ 75% vs download → abort fusion; use port (§6b). ── §6b BUILD — PORT (plagiarism-safe fusion) ── Same picks as fusion. Same behavior targets. Different structure: • Section B0: original shared kernel ≥8% of file (new utilities) • Reimplement each lane — do NOT paste download verbatim • Semantic new class names (NOT prod_/shop_/vouch_ mirrors) • T1–T5 transformation checklist per lane (from v12): T1 ≥20% identifiers unlike source T2 ≥3 structural edits per lane T3 no 25-line identical blocks T4 shared kernel for deadline/dialog/retry T5 file size NOT ≈ sum of three downloads (±10%) Prove parity via V12b + lane replay — NOT via code similarity to download. ═══════════════════════════════════════════════════════════════════════════════ §7 BUILD — UPGRADE (single solver, surgical fixes only) ═══════════════════════════════════════════════════════════════════════════════ Source: PICK_SOLVER only. 1. Copy solver verbatim → B0 2. Apply ONLY fixes from §3c improvement plan (smallest diff) 3. agent_main = solver's agent_main (with fixes) 4. No supplemental blocks Guardrails: • Never remove branches solver had • category from problem_data["category"] when present (INC-12) • trigger_llm: max retries ≤ 8; safe return on exhaustion (INC-D) • No suite-specific hardcoding ═══════════════════════════════════════════════════════════════════════════════ §8 BUILD — HYBRID (solver upgrade + inline supplemental — stealth) ═══════════════════════════════════════════════════════════════════════════════ Sources: B0 = PICK_SOLVER (+ §3c surgical fixes) B1 = PICK_SHOP supplemental (verbatim closure, no perf edits) B2 = PICK_VOUCHER supplemental (verbatim closure, no perf edits) ORDER: [IMPORTS] [§8a REGISTRY HELPERS] [B0 SOLVER — verbatim + fixes] [B1 SHOP CLOSURE — S_supplemental_session] [B2 VOUCHER CLOSURE — V_supplemental_session] [agent_main one-liner] §8a REGISTRY ISOLATION: def _snapshot_tool_registry() -> dict: ... def _restore_tool_registry(saved: dict) -> None: ... def _with_isolated_registry(fn, pd) -> None: saved = _snapshot_tool_registry() try: fn(pd) except Exception: pass finally: _restore_tool_registry(saved) §8b SOLVER ENTRIES (supplemental NOT in agent_main): CAT_MAP = {"product": ..., "shop": ..., "voucher": ...} def solver_agent_main(problem_data: dict) -> list: cat = str(problem_data.get("category", "")).lower() if cat in CAT_MAP: return CAT_MAP[cat](problem_data) return (problem_data) def P_solver_entry(problem_data: dict) -> list: return def S_solver_entry(problem_data: dict) -> list: primary_trace = _with_isolated_registry(S_supplemental_session, problem_data) return primary_trace def V_solver_entry(problem_data: dict) -> list: primary_trace = _with_isolated_registry(V_supplemental_session, problem_data) return primary_trace def S_supplemental_session(problem_data: dict) -> list: def V_supplemental_session(problem_data: dict) -> list: def agent_main(problem_data: dict) -> list: return solver_agent_main(problem_data) GOAL A: supplemental = similarity mass + stealth only — discarded output. GOAL B: all perf changes in B0 only (§3c plan). V24: supplemental only invoked inside S_solver_entry / V_solver_entry. V23: grep decoy|FusionSession|_run_audit|shadow_decoy|lane_stub → 0 hits. ═══════════════════════════════════════════════════════════════════════════════ §9 SHARED SECTION A (@Tool layer — all methods) ═══════════════════════════════════════════════════════════════════════════════ Frozen signatures: find_product(**kwargs) view_product_information(product_ids: str) calculate_voucher(product_prices, voucher_type, discount_value, threshold, budget, cap=0) recommend_product(product_ids: str) terminate(status: str = "success") Lane sections: zero @Tool at import (V4/V16). register_tool only inside lane entry at runtime. ═══════════════════════════════════════════════════════════════════════════════ §10 VALIDATION (run per /tmp/fused_candidate_{METHOD}.py — all must pass) ═══════════════════════════════════════════════════════════════════════════════ G0 py_compile + ast.parse G1 ./local-test/run.sh test-inference (if available) V1 bytes ≤ 1,048,576; lines ≤ 12,000 V3 zero duplicate top-level defs V4 zero @Tool in B-sections (non-A) V15 no lane_stub strings V16 ./local-test/run.sh six-gate-static CANDIDATE V19 category parity on 6 gate problems V22 no _0x / hex obfuscation; API keys unchanged V23 stealth grep 0 hits (hybrid/fusion with supplemental) V24 hybrid: agent_main → solver_agent_main only V27 symbol closure 0 missing per lane V33 tool signature audit 0 mismatches V34 register_tool parity all lanes ── V35 PLAGIARISM (server-side proxy — INC-9) ── Full file vs local-test/source.py: combined < 0.70, risk ≠ high Per source download used in this build: python3 local-test/check_code.py LANE_EXTRACT --baseline DOWNLOAD --json combined < 0.70 AND structural_fingerprint_similarity < 0.75 vs each existing myagents/*.py you previously submitted: combined < 0.70 fusion verbatim path: ANY lane ≥75% structural → FAIL → switch to port. ── V11 SIMILARITY BANDS ── vs source.py: risk ≠ high vs primary solver: 15% ≤ combined < 70% (upgrade/hybrid B0) vs shop supplemental: 20% ≤ combined < 90% (hybrid B1 only) vs voucher supplemental: 20% ≤ combined < 90% (hybrid B2 only) fusion/port per-lane: each lane vs its pick < 70% / < 75% struct ── V12b REGRESSION GATE (PRIMARY BLOCKER) ── ./local-test/run.sh six-gate CANDIDATE gate_regression_{RACE}_{METHOD}.json | # | cat | type | baseline | fused | PASS? | |---|-----|------|----------|-------|-------| PASS rows (1,3,5): fused MUST pass (same as baseline pass). FAIL rows (2,4,6): fused MUST pass OR clear improvement: crash → dialogue; empty → tool_results; timeout → <280s Minimum 6/6 row rules. Any pass-row regression → fix → re-run G0. Row fail if think contains NameError|AttributeError|TypeError| Unhandled agent error|lane stub; or wrong lane tools; or ≥280s. ── V12 SMOKE (secondary) ── ./local-test/run.sh six-gate CANDIDATE gate_six.json PRE-WRITE per file: [ ] §3 BUILD PLAN row fulfilled [ ] §4 regression 6 table with real problem_ids [ ] V35 + V11 + V23 + V24 + V12b 6/6 → ONLY THEN cp to myagents/ ═══════════════════════════════════════════════════════════════════════════════ §11 MULTI-OUTPUT WORKFLOW (OUTPUT_COUNT > 1) ═══════════════════════════════════════════════════════════════════════════════ FOR i in 1..OUTPUT_COUNT: 1. Take strategy + ranks from BUILD PLAN row i 2. Download required sources for that row only 3. Build → /tmp/fused_candidate_{i}_{METHOD}.py 4. Run full §10 validation for that candidate 5. On pass → write myagents/{filename from §1b} 6. On fail → fix or downgrade strategy (fusion→port, upgrade→hybrid) and re-validate; do NOT write failed candidate Deliverables aggregate across all outputs (§12). ═══════════════════════════════════════════════════════════════════════════════ §12 DELIVERABLES (chat — required before ANY write) ═══════════════════════════════════════════════════════════════════════════════ 1. RACE_NUMBER + OUTPUT_COUNT + STRATEGIES parsed 2. Rank resolution table (§3a) 3. Lane leaderboard + PICK_PRODUCT / PICK_SHOP / PICK_VOUCHER / PICK_SOLVER 4. Solver weakness report + improvement plan (§3c) 5. BUILD PLAN TABLE (§3d) — one row per output file with filename 6. Per-file: gate_regression_6 table (6 problem_ids) 7. Per-file: V35 similarity table (all baselines) 8. Per-file: V23 grep result 9. Per-file: V12b regression table 6/6 10. Written paths: lines, bytes per file ═══════════════════════════════════════════════════════════════════════════════ §13 FAILURE → FIX QUICK MAP ═══════════════════════════════════════════════════════════════════════════════ | Symptom | Cause | Fix | |---------|-------|-----| | submit plagiarism | verbatim fusion INC-9 | port method + V35 | | submit obfuscation-call | _0x names | §A | | shop/voucher 0% | category ignored / re-classify | INC-1/12 CAT_MAP | | voucher timeout | ids vs product_ids | INC-4 V33 | | pass-row regression | B0 edit too aggressive | revert surgical fix | | check_code pass, submit fail | skipped V35 per-lane | §10 V35 | | decoy exposed | bad naming | V23 §8 stealth names | | wrong agent source | bad rank API | §3a race_rank | ═══════════════════════════════════════════════════════════════════════════════ BEGIN ═══════════════════════════════════════════════════════════════════════════════ RACE_NUMBER: OUTPUT_COUNT: STRATEGIES: auto | fusion,upgrade,hybrid,port,... OPTIONAL OVERRIDES (omit if not needed): FORCE_SOLVER_RANK: FORCE_PRODUCT_RANK: FORCE_SHOP_RANK: FORCE_VOUCHER_RANK: END ═══════════════════════════════════════════════════════════════════════════════