mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-06 06:52:20 +02:00
fix(ci): make maintainer harness contract self-contained and portable
This commit is contained in:
@@ -30,7 +30,10 @@ jobs:
|
||||
dependency-review:
|
||||
name: dependency-review (PR gate)
|
||||
# Only meaningful on a pull request -- it needs a base..head diff to review.
|
||||
if: github.event_name == 'pull_request'
|
||||
# dependency-review-action requires GitHub dependency-review support.
|
||||
# Keep the blocking gate on the canonical repository; forks and maintainer
|
||||
# preview mirrors still run the advisory pip-audit job below.
|
||||
if: github.event_name == 'pull_request' && github.repository == 'odysseus-dev/odysseus'
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
@@ -9,6 +9,7 @@ import argparse
|
||||
import copy
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
from pathlib import Path
|
||||
@@ -19,9 +20,17 @@ import jsonschema
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
||||
from src.tool_schemas import FUNCTION_TOOL_SCHEMAS
|
||||
from src.turn_contract import FAMILY_TOOLS, requested_capabilities
|
||||
CONTRACT_SOURCE = Path(str(Path(__file__).resolve().parents[1] / "scripts"))
|
||||
sys.path.insert(0, str(CONTRACT_SOURCE))
|
||||
from eval_alltools_unseen_compare import tools_for_mode
|
||||
CONTRACT_SOURCE = Path(os.environ.get("ODYSSEUS_TOOL_CONTRACT_ROOT", str(Path(__file__).resolve().parents[1] / "scripts")))
|
||||
if (CONTRACT_SOURCE / 'eval_alltools_unseen_compare.py').is_file():
|
||||
sys.path.insert(0, str(CONTRACT_SOURCE))
|
||||
try:
|
||||
from eval_alltools_unseen_compare import tools_for_mode
|
||||
finally:
|
||||
if str(CONTRACT_SOURCE) in sys.path:
|
||||
sys.path.remove(str(CONTRACT_SOURCE))
|
||||
else:
|
||||
from src.clean_agent_preview import contract_builder
|
||||
tools_for_mode = contract_builder()
|
||||
|
||||
FAMILIES = tuple(FAMILY_TOOLS)[:10]
|
||||
TRAINED_NAMES = set().union(*(FAMILY_TOOLS[f] for f in FAMILIES))
|
||||
|
||||
+18
-15
@@ -1943,6 +1943,10 @@ def authorized_write_families(user_text):
|
||||
return frozenset(families)
|
||||
|
||||
|
||||
def canonical_tools_for_mode(tools, mode):
|
||||
return copy.deepcopy(tools)
|
||||
|
||||
|
||||
@lru_cache(maxsize=1)
|
||||
def contract_builder():
|
||||
root = Path(os.environ.get(
|
||||
@@ -1950,21 +1954,20 @@ def contract_builder():
|
||||
str(Path(__file__).resolve().parents[1] / "scripts"),
|
||||
)).resolve()
|
||||
contract_path = root / 'eval_alltools_unseen_compare.py'
|
||||
if not contract_path.is_file():
|
||||
raise FileNotFoundError(
|
||||
f'Compact-v5 tool contract is missing: {contract_path}'
|
||||
)
|
||||
# Load the original promotion protocol, not the description-stripping UI helper.
|
||||
sys.path.insert(0, str(root))
|
||||
try:
|
||||
spec = importlib.util.spec_from_file_location(
|
||||
'odysseus_preview_v3_contract', contract_path
|
||||
)
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(module)
|
||||
return module.tools_for_mode
|
||||
finally:
|
||||
sys.path.remove(str(root))
|
||||
if contract_path.is_file():
|
||||
# Load the original promotion protocol, not the description-stripping UI helper.
|
||||
sys.path.insert(0, str(root))
|
||||
try:
|
||||
spec = importlib.util.spec_from_file_location(
|
||||
'odysseus_preview_v3_contract', contract_path
|
||||
)
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(module)
|
||||
return module.tools_for_mode
|
||||
finally:
|
||||
if str(root) in sys.path:
|
||||
sys.path.remove(str(root))
|
||||
return canonical_tools_for_mode
|
||||
|
||||
|
||||
def compact_schemas(schemas):
|
||||
|
||||
Reference in New Issue
Block a user