SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2607.11423 · 2026

TOFU: A White-Box, Token-Efficient Agent Harness for Researchers

Xin Chen, Chenglong Wang, Tong Xiao, Bei Li, Jingbo Zhu, Jingang Wang, Yongjing Yin, Yuchun Fan, Junhao Ruan, Yuan Ge

arXiv · PDF

Code that ran

27 of 44 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (4 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 1 violated it and 4 have no contract verdict; 21 failures of our instrument; 17 no recorded run), measured 2026-11-23; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2607.11423.json · badge: /api/ran/2607.11423.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
rangehow/overleaf-mcp canonical (classifier label)
classifier basis: census
9 ran · 3 no recorded run
NiuTrans/ToFu community
Papers with Code archive
18 ran · 14 no recorded run
FunctionStatusWhere it lives
AgentResult Ran
ran on a synthesized input · constructed an object; no result was computed
NiuTrans/ToFu/tofu_agent/runtime.py
code served (permissive licence) · get_code("bc7be2202a6bea3a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, AgentResult: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

from collections.abc import Mapping
from typing import Any

# Construct arguments for AgentResult
ARGS = {
    'id': 'agent-123',
    'task_id': 'task-456',
    'model': 'gpt-4',
    'status': 'done',
    'finish_reason': 'stop',
    'content': 'This is the agent response content.',
    'thinking': 'The agent thought about this problem.',
    'usage': {'prompt_tokens': 100, 'completion_tokens': 50, 'total_tokens': 150},
    'n_tool_rounds': 2,
    'error': None,
    'tool_calls': (
        {'id': 'call-1', 'function': 'search', 'arguments': {'query': 'python'}},
        {'id': 'call-2', 'function': 'calculate', 'arguments': {'expr': '2+2'}},
    ),
    'provider_id': 'openai',
    'trajectory_format': 'json',
    'trajectory': {'steps': [{'action': 'think'}, {'action': 'call_tool'}]},
    'raw': {'id': 'agent-123', 'task_id': 'task-456', 'model': 'gpt-4'},
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type AgentResult — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a AgentResult output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
ModelRoutingConfig Ran
ran on a synthesized input · constructed an object; no result was computed
NiuTrans/ToFu/tofu_agent/runtime.py
code served (permissive licence) · get_code("fd61bec9e8451d5c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, ModelRoutingConfig: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import json
from collections.abc import Mapping
from typing import Any

# Minimal mock for lib.model_routing to avoid import errors
class MockModelRoutingModule:
    class ModelRoutingError(Exception):
        pass
    
    @staticmethod
    def normalize_document(doc):
        if not isinstance(doc, Mapping):
            raise ValueError("document must be a mapping")
        # Ensure required fields exist
        result = dict(doc)
        if 'credentials' not in result:
            result['credentials'] = []
        if 'contract_version' not in result:
            result['contract_version'] = 'tofu.model-routing/v2'
        return result
    
    @staticmethod
    def parse_native_model_selection(config):
        # Validate structure
        if 'model' not in config or 'routing' not in config:
            raise ValueError("config must have 'model' and 'routing' keys")
        model = config['model']
        if not isinstance(model, Mapping):
            raise ValueError("model must be a mapping")
        return config

import sys
from unittest.mock import MagicMock

# Mock the lib.model_routing module
mock_routing = MagicMock()
mock_routing.ModelRoutingError = MockModelRoutingModule.ModelRoutingError
mock_routing.normalize_document = MockModelRoutingModule.normalize_document
mock_routing.parse_native_model_selection = MockModelRoutingModule.parse_native_model_selection

sys.modules['lib'] = MagicMock()
sys.modules['lib.model_routing'] = mock_routing

# Now construct the arguments
ARGS = {
    'document': {
        'contract_version': 'tofu.model-routing/v2',
        'credentials': [
            {
                'enabled': True,
                'kind': 'api_key',
                'secret_reference': 'api_key_1'
            }
        ]
    },
    'model': {
        'model_id': 'gpt-4',
        'provider': 'openai'
    },
    'routing': {
        'strategy': 'default'
    },
    'credential_secrets': {
        'api_key_1': 'sk-1234567890abcdef'
    }
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
lib — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ModelRoutingConfig — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a ModelRoutingConfig output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
PrincipalContext Ran
ran on a synthesized input · constructed an object; no result was computed
NiuTrans/ToFu/tofu_agent/runtime.py
code served (permissive licence) · get_code("ea149cb800075bd0")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, PrincipalContext: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from collections.abc import Iterable

torch.manual_seed(0)

# Construct valid arguments for PrincipalContext.__post_init__
ARGS = {
    'kind': 'user',
    'subject_id': 'user_123',
    'owner_user_id': 42,
    'tenant_id': 'tenant_abc',
    'scopes': frozenset(['read', 'write'])
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type PrincipalContext — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a PrincipalContext output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
_CapacityGate Ran
ran on a synthesized input · constructed an object; no result was computed
NiuTrans/ToFu/tofu_agent/runtime.py
code served (permissive licence) · get_code("f061ce56b14a78ff")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, _CapacityGate: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import threading

class _CapacityGate:
    """Small process-local admission gate with no external state backend."""

    def __init__(self, capacity: int) -> None:
        self.capacity = max(0, int(capacity))
        self._in_flight = 0
        self._lock = threading.Lock()

    def try_acquire(self) -> bool:
        with self._lock:
            if self.capacity and self._in_flight >= self.capacity:
                return False
            self._in_flight += 1
            return True

    def release(self) -> None:
        with self._lock:
            if self._in_flight:
                self._in_flight -= 1

    @property
    def in_flight(self) -> int:
        with self._lock:
            return self._in_flight


ARGS = {
    "capacity": 10
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type _CapacityGate — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a _CapacityGate output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
_contains_http_control Ran
ran, violated the contract we drafted
NiuTrans/ToFu/tofu_agent/runtime.py
code served (permissive licence) · get_code("6a3548fb558d24f6")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

def _contains_http_control(value: str) -> bool:
    return any((ord(character) < 32 or ord(character) == 127 for character in value))

ARGS = {
    "value": "hello world"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
_normalized_identifier Ran
ran; our contract draft was wrong, not the code
NiuTrans/ToFu/tofu_agent/runtime.py
code served (permissive licence) · get_code("713836793b89d00e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from typing import Any

# The function _normalized_identifier takes two parameters:
# 1. value: Any - will be converted to string and stripped
# 2. field: str - a keyword-only argument representing a field name

# Looking at the function body:
# - It converts value to string with str(value or '').strip()
# - It checks if identifier is empty or > 256 characters
# - It raises ValueError if constraints not met
# - Returns the normalized identifier string

# Test with valid inputs
ARGS = {
    'value': 'test_principal',
    'field': 'principal_id'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
_normalized_scopes Ran
ran; our contract draft was wrong, not the code
NiuTrans/ToFu/tofu_agent/runtime.py
code served (permissive licence) · get_code("3e6b9ec1560add57")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned frozenset. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from collections.abc import Iterable

torch.manual_seed(0)

# The function _normalized_scopes takes an Iterable of Any values
# It converts each to a string, strips whitespace, validates length (1-128 chars)
# and collects unique scopes into a frozenset

# Valid test case: list of strings that are valid scopes
ARGS = {
    "values": ["admin", "user", "moderator", "guest"]
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type frozenset — a frozenset output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a frozenset output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
_public_api_round_evidence Ran
ran; our contract draft was wrong, not the code
NiuTrans/ToFu/tofu_agent/runtime.py
code served (permissive licence) · get_code("b48e60d60fbb3007")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import copy

_PUBLIC_DISPATCH_EVIDENCE_FIELDS = frozenset({'model', 'provider_id', 'protocol', 'responses_profile', 'latency_ms', 'ttft_ms', 'stream_started_at_unix_ns', 'first_content_at_unix_ns', 'stream_completed_at_unix_ns', 'attempt', '429_retries', 'ttft_measurement', 'upstream_429_retries', 'slot_wait_cycles', 'queue_wait_ms', 'queue_wait_measurement'})

def _public_usage_evidence(value):
    """Detach exact billing/timing fields while removing routing secrets."""
    if not isinstance(value, dict):
        return copy.deepcopy(value)
    result = {key: copy.deepcopy(child) for key, child in value.items() if not (isinstance(key, str) and key.startswith('_wire_')) and key != '_dispatch'}
    dispatch = value.get('_dispatch')
    if isinstance(dispatch, dict):
        result['_dispatch'] = {key: copy.deepcopy(child) for key, child in dispatch.items() if key in _PUBLIC_DISPATCH_EVIDENCE_FIELDS}
    extra = result.get('_extra_billing_rounds')
    if isinstance(extra, list):
        result['_extra_billing_rounds'] = [{**row, 'usage': _public_usage_evidence(row.get('usage'))} if isinstance(row, dict) else copy.deepcopy(row) for row in extra]
    return result

def _public_api_round_evidence(value):
    if not isinstance(value, list):
        return []
    return [{**copy.deepcopy(row), 'usage': _public_usage_evidence(row.get('usage'))} if isinstance(row, dict) else {'invalidRound': True} for row in value]


# Build test data
test_round_1 = {
    'round_id': 1,
    'status': 'success',
    'usage': {
        'tokens': 100,
        'cost': 0.05,
        '_wire_secret': 'hidden_value',
        '_dispatch': {
            'model': 'gpt-4',
            'provider_id': 'openai',
            'latency_ms': 250,
            '_internal_routing': 'should_be_removed'
        },
        '_extra_billing_rounds': [
            {
                'round_number': 1,
                'usage': {
                    'tokens': 50,
                    '_wire_key': 'secret',
                    '_dispatch': {
                        'model': 'gpt-3.5',
                        'ttft_ms': 100
                    }
                }
            }
        ]
    }
}

test_round_2 = {
    'round_id': 2,
    'status': 'retry',
    'usage': {
        'tokens': 200,
        '_dispatch': {
            'attempt': 2,
            '429_retries': 1
        }
    }
}

test_round_invalid = 'not_a_dict'

ARGS = {
    'value': [test_round_1, test_round_2, test_round_invalid]
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
_public_usage_evidence Ran
ran; our contract draft was wrong, not the code
NiuTrans/ToFu/tofu_agent/runtime.py
code served (permissive licence) · get_code("c0c85b7b37ea9bb6")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import copy

_PUBLIC_DISPATCH_EVIDENCE_FIELDS = frozenset({'model', 'provider_id', 'protocol', 'responses_profile', 'latency_ms', 'ttft_ms', 'stream_started_at_unix_ns', 'first_content_at_unix_ns', 'stream_completed_at_unix_ns', 'attempt', '429_retries', 'ttft_measurement', 'upstream_429_retries', 'slot_wait_cycles', 'queue_wait_ms', 'queue_wait_measurement'})

def _public_usage_evidence(value):
    """Detach exact billing/timing fields while removing routing secrets."""
    if not isinstance(value, dict):
        return copy.deepcopy(value)
    result = {key: copy.deepcopy(child) for key, child in value.items() if not (isinstance(key, str) and key.startswith('_wire_')) and key != '_dispatch'}
    dispatch = value.get('_dispatch')
    if isinstance(dispatch, dict):
        result['_dispatch'] = {key: copy.deepcopy(child) for key, child in dispatch.items() if key in _PUBLIC_DISPATCH_EVIDENCE_FIELDS}
    extra = result.get('_extra_billing_rounds')
    if isinstance(extra, list):
        result['_extra_billing_rounds'] = [{**row, 'usage': _public_usage_evidence(row.get('usage'))} if isinstance(row, dict) else copy.deepcopy(row) for row in extra]
    return result


# Test case 1: Simple dict with public fields
test_value_1 = {
    'model': 'gpt-4',
    'provider_id': 'openai-123',
    'latency_ms': 250,
    'public_field': 'visible',
    '_wire_secret': 'hidden',
    '_dispatch': {
        'model': 'gpt-4',
        'provider_id': 'openai-123',
        'latency_ms': 250,
        '_private_dispatch_field': 'should_be_filtered'
    }
}

# Test case 2: Dict with _extra_billing_rounds containing nested usage
test_value_2 = {
    'attempt': 1,
    '429_retries': 0,
    '_dispatch': {
        'attempt': 1,
        'ttft_ms': 100
    },
    '_extra_billing_rounds': [
        {
            'usage': {
                'tokens': 50,
                '_wire_internal': 'secret',
                '_dispatch': {
                    'queue_wait_ms': 10
                }
            }
        }
    ]
}

# Test case 3: Non-dict value (should return deepcopy)
test_value_3 = [1, 2, 3, 'test']

ARGS = {
    'value': test_value_1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
apply_storage_free_runtime_policy Ran
ran; our contract draft was wrong, not the code
NiuTrans/ToFu/tofu_agent/runtime.py
code served (permissive licence) · get_code("ce6607004e26f067")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

# The function takes a config dict and modifies it in-place
# Looking at the function body, it:
# 1. Sets config['_storageFreeRuntime'] = True
# 2. Sets config['memoryEnabled'] = False
# 3. Sets config['schedulerEnabled'] = False
# 4. Returns the modified config

# We need to provide a minimal config dict with the keys that might be expected
config = {
    'agent_name': 'test_agent',
    'memoryEnabled': True,
    'schedulerEnabled': True,
    'tools': ['filesystem', 'network', 'mcp'],
}

ARGS = {
    'config': config
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
build_agent_config Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
NiuTrans/ToFu/tofu_agent/runtime.py
code served (permissive licence) · get_code("8d34624e924f456a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import logging
from unittest.mock import MagicMock, patch

# Set up logging to avoid import errors
logging.basicConfig(level=logging.DEBUG)

# Mock the apply_headless_personal_defaults function since it's imported from lib.agent_core.personal_scope
def mock_apply_headless_personal_defaults(config):
    """Mock implementation that does nothing."""
    pass

# Patch the import before calling build_agent_config
import sys
mock_module = MagicMock()
mock_module.apply_headless_personal_defaults = mock_apply_headless_personal_defaults
sys.modules['lib'] = MagicMock()
sys.modules['lib.agent_core'] = MagicMock()
sys.modules['lib.agent_core.personal_scope'] = mock_module

# Test case 1: Minimal valid arguments
model_id_1 = "gpt-4"
raw_config_1 = {
    "tools": "all",
    "thinking": "high",
    "search": True,
    "temperature": 0.7,
    "max_tokens": 2048
}
capabilities_legacy_1 = None

# Test case 2: With legacy capabilities
model_id_2 = "claude-3"
raw_config_2 = {
    "tools": ["search", "code_exec", "image_gen"],
    "memory": True,
    "mcp": True,
    "project": "/path/to/project"
}
capabilities_legacy_2 = {
    "search": "multi",
    "fetchEnabled": True
}

# Test case 3: Complex config with multiple options
model_id_3 = "llama-2"
raw_config_3 = {
    "tools": {
        "searchMode": "multi",
        "codeExecEnabled": True,
        "memoryEnabled": True
    },
    "thinking": "medium",
    "temperature": 0.5,
    "human_guidance": True,
    "scheduler": False,
    "browser": True,
    "plugins": ["plugin1", "plugin2"]
}
capabilities_legacy_3 = {}

# Test case 4: Minimal config
model_id_4 = "test-model"
raw_config_4 = {}
capabilities_legacy_4 = None

# Test case 5: With raw passthrough keys
model_id_5 = "advanced-model"
raw_config_5 = {
    "tools": ["fetch", "memory", "mcp"],
    "thinking": "ultra",
    "search": "multi",
    "customRawKey": "customValue",
    "anotherRawKey": 12345
}
capabilities_legacy_5 = None

# Choose one of the test cases as the primary ARGS
ARGS = {
    "model_id": model_id_1,
    "raw_config": raw_config_1,
    "capabilities_legacy": capabilities_legacy_1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
lib — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
collect_bibtex Ran
ran; our contract draft was wrong, not the code
rangehow/overleaf-mcp/src/overleaf_mcp/verify.py
code served (permissive licence) · get_code("82642b355243aaed")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import logging

logger = logging.getLogger('overleaf-mcp')

def collect_bibtex(read_fn, bib_paths) -> tuple[str, list[str]]:
    """Concatenate the text of every ``.bib`` path via ``read_fn``.

    ``read_fn(path) -> str`` is injected (the caller wires it to
    git_client.read_file bound to a project) so this stays I/O-seam-agnostic
    and trivially testable. Returns ``(combined_text, paths_read)``; a path
    that fails to read is logged and skipped (best-effort).
    """
    chunks: list[str] = []
    read: list[str] = []
    for path in bib_paths:
        try:
            text = read_fn(path)
        except Exception as e:
            logger.warning('[verify] failed to read %s: %s', path, e)
            continue
        if text:
            chunks.append(f'% ── {path} ──\n{text}')
            read.append(path)
    return ('\n\n'.join(chunks), read)


def mock_read_fn(path: str) -> str:
    """Mock read function that returns bibtex content for known paths."""
    mock_content = {
        "references.bib": "@article{smith2020,\n  author={Smith, J},\n  title={Example}\n}",
        "sources.bib": "@book{doe2021,\n  author={Doe, A},\n  title={Another Example}\n}",
        "empty.bib": "",
        "nonexistent.bib": None,
    }
    content = mock_content.get(path)
    if content is None:
        raise FileNotFoundError(f"Path {path} not found")
    return content


ARGS = {
    "read_fn": mock_read_fn,
    "bib_paths": ["references.bib", "sources.bib", "empty.bib", "nonexistent.bib"],
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
format_report Ran
ran; our contract draft was wrong, not the code
rangehow/overleaf-mcp/src/overleaf_mcp/verify.py
code served (permissive licence) · get_code("d94eaf375f12ece9")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

# Construct a valid result dict matching the expected structure
result = {
    'counts': {
        'verified': 5,
        'suspicious': 2,
        'unverifiable': 1
    },
    'total': 8,
    'suspicious': [
        {
            'key': 'Smith2020',
            'kind': 'doi',
            'identifier': '10.1234/invalid.doi',
            'reason': 'DOI did not resolve to a valid publication',
            'claimed_title': 'A Study on Machine Learning',
            'matched_title': None,
            'checked': 'CrossRef'
        },
        {
            'key': 'Jones2021',
            'kind': 'arxiv',
            'identifier': 'arxiv:9999.99999',
            'reason': 'ArXiv ID not found in database',
            'claimed_title': 'Advanced Neural Networks',
            'matched_title': 'Different Paper Title',
            'checked': 'ArXiv API'
        }
    ]
}

bib_paths = ['references.bib', 'additional.bib']

ARGS = {
    'result': result,
    'bib_paths': bib_paths
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_logger Ran
ran; our contract draft was wrong, not the code
NiuTrans/ToFu/tofu_agent/runtime.py
code served (permissive licence) · get_code("8a145e8f9fededf5")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Logger. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import logging

ARGS = {
    "name": "lib.llm"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Logger — a Logger output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Logger output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_section_content Ran
ran; our contract draft was wrong, not the code
rangehow/overleaf-mcp/src/overleaf_mcp/latex.py
code served (permissive licence) · get_code("950c6b318c00d721")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re
from typing import Any

SECTION_LEVELS = ['part', 'chapter', 'section', 'subsection', 'subsubsection', 'paragraph', 'subparagraph']

SECTION_PATTERN = re.compile('\\\\(' + '|'.join(SECTION_LEVELS) + ')(\\*?)\\s*\\{', re.MULTILINE)

def _extract_braced(content: str, open_idx: int) -> tuple[str, int] | None:
    """Given ``content[open_idx] == '{'``, return (body, index_after_close).

    Handles nested ``{}`` pairs, so ``\\section{Foo \\texttt{bar}}`` yields
    ``Foo \\texttt{bar}``. Backslash-escaped braces are treated as literal.
    Returns ``None`` if no matching close is found.
    """
    if open_idx >= len(content) or content[open_idx] != '{':
        return None
    depth = 1
    i = open_idx + 1
    n = len(content)
    while i < n:
        ch = content[i]
        if ch == '\\' and i + 1 < n:
            i += 2
            continue
        if ch == '{':
            depth += 1
        elif ch == '}':
            depth -= 1
            if depth == 0:
                return (content[open_idx + 1:i], i + 1)
        i += 1
    return None

def parse_sections(content: str) -> list[dict[str, Any]]:
    """Parse LaTeX content and extract all sectioning commands.

    Returns a list of dicts with keys:
      type, title, preview, start_pos, end_pos, level
    """
    matches = list(SECTION_PATTERN.finditer(content))
    parsed: list[tuple[re.Match, str, int]] = []
    for m in matches:
        open_idx = m.end() - 1
        extracted = _extract_braced(content, open_idx)
        if extracted is None:
            continue
        title, after_close = extracted
        parsed.append((m, title, after_close))
    sections: list[dict[str, Any]] = []
    for i, (m, title, header_end) in enumerate(parsed):
        sec_type = m.group(1)
        end = parsed[i + 1][0].start() if i + 1 < len(parsed) else len(content)
        body = content[header_end:end].strip()
        preview = body[:200] + '…' if len(body) > 200 else body
        sections.append({'type': sec_type, 'title': title, 'preview': preview, 'start_pos': m.start(), 'end_pos': end, 'level': SECTION_LEVELS.index(sec_type)})
    return sections

def get_section_content(content: str, title: str) -> str | None:
    """Return the full text (including header) of the section with *title*."""
    for sec in parse_sections(content):
        if sec['title'].lower() == title.lower():
            return content[sec['start_pos']:sec['end_pos']]
    return None

# Construct test arguments
latex_content = r"""
\chapter{Introduction}
This is the introduction section with some content here.

\section{Background}
Background information goes here with more details.

\subsection{Details}
Even more detailed information about the background.

\section{Related Work}
Related work discussion goes here with citations and references.
"""

ARGS = {
    "content": latex_content,
    "title": "Background"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
parse_sections Ran
ran; our contract draft was wrong, not the code
rangehow/overleaf-mcp/src/overleaf_mcp/latex.py
code served (permissive licence) · get_code("75b3e97ce3adb04f")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re
from typing import Any

SECTION_LEVELS = ['part', 'chapter', 'section', 'subsection', 'subsubsection', 'paragraph', 'subparagraph']

SECTION_PATTERN = re.compile('\\\\(' + '|'.join(SECTION_LEVELS) + ')(\\*?)\\s*\\{', re.MULTILINE)

def _extract_braced(content: str, open_idx: int) -> tuple[str, int] | None:
    """Given ``content[open_idx] == '{'``, return (body, index_after_close).

    Handles nested ``{}`` pairs, so ``\\section{Foo \\texttt{bar}}`` yields
    ``Foo \\texttt{bar}``. Backslash-escaped braces are treated as literal.
    Returns ``None`` if no matching close is found.
    """
    if open_idx >= len(content) or content[open_idx] != '{':
        return None
    depth = 1
    i = open_idx + 1
    n = len(content)
    while i < n:
        ch = content[i]
        if ch == '\\' and i + 1 < n:
            i += 2
            continue
        if ch == '{':
            depth += 1
        elif ch == '}':
            depth -= 1
            if depth == 0:
                return (content[open_idx + 1:i], i + 1)
        i += 1
    return None

def parse_sections(content: str) -> list[dict[str, Any]]:
    """Parse LaTeX content and extract all sectioning commands.

    Returns a list of dicts with keys:
      type, title, preview, start_pos, end_pos, level
    """
    matches = list(SECTION_PATTERN.finditer(content))
    parsed: list[tuple[re.Match, str, int]] = []
    for m in matches:
        open_idx = m.end() - 1
        extracted = _extract_braced(content, open_idx)
        if extracted is None:
            continue
        title, after_close = extracted
        parsed.append((m, title, after_close))
    sections: list[dict[str, Any]] = []
    for i, (m, title, header_end) in enumerate(parsed):
        sec_type = m.group(1)
        end = parsed[i + 1][0].start() if i + 1 < len(parsed) else len(content)
        body = content[header_end:end].strip()
        preview = body[:200] + '…' if len(body) > 200 else body
        sections.append({'type': sec_type, 'title': title, 'preview': preview, 'start_pos': m.start(), 'end_pos': end, 'level': SECTION_LEVELS.index(sec_type)})
    return sections

# Setup code
content = r"""
\chapter{Introduction}
This is the introduction chapter with some content here.

\section{Background}
Background section with more details about the topic.

\subsection{Details}
Some subsection with nested content \texttt{code} inside.

\section{Methods}
Methods section that goes on for quite a bit with a lot of text that spans multiple lines and contains various LaTeX commands and formatting to test how the preview truncation works when content exceeds two hundred characters in length.

\chapter{Results}
Results chapter starts here.
"""

ARGS = {
    'content': content
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
parse_synctex Ran
ran; our contract draft was wrong, not the code
rangehow/overleaf-mcp/src/overleaf_mcp/layout.py
code served (permissive licence) · get_code("93b53ddab8b3ff07")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re

# Minimal synctex content that exercises the parsing logic
# This includes Input declarations, page markers, and box records
raw_synctex = """Input:1:latex/./acl_latex.tex
Input:2:/compile/other_file.tex
{1
[(1,10:100,200:300,400,50
[(1,11:110,210:310,410,60
}
{2
[(2,5:50,150:250,350,40
}
"""

ARGS = {
    "raw": raw_synctex
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
project_agent_event_evidence Ran
ran; our contract draft was wrong, not the code
NiuTrans/ToFu/tofu_agent/runtime.py
code served (permissive licence) · get_code("899c89697c470e7b")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import copy

# Construct test data for project_agent_event_evidence function
event_dict = {
    'usage': {
        'tokens': 100,
        'cost': 0.05,
        '_wire_secret': 'hidden_value',
        '_dispatch': {
            'model': 'gpt-4',
            'provider_id': 'openai-123',
            'protocol': 'http',
            'responses_profile': 'streaming',
            'latency_ms': 250,
            'ttft_ms': 50,
            'stream_started_at_unix_ns': 1700000000000000000,
            'first_content_at_unix_ns': 1700000000050000000,
            'stream_completed_at_unix_ns': 1700000000300000000,
            'attempt': 1,
            '429_retries': 0,
            'ttft_measurement': 'wall_clock',
            'upstream_429_retries': 0,
            'slot_wait_cycles': 5,
            'queue_wait_ms': 10,
            'queue_wait_measurement': 'internal',
            '_wire_internal_id': 'secret_123',
        },
        '_extra_billing_rounds': [
            {
                'usage': {
                    'tokens': 50,
                    '_wire_debug': 'debug_info',
                    '_dispatch': {
                        'model': 'gpt-3.5',
                        'provider_id': 'openai-456',
                        'protocol': 'https',
                    }
                }
            },
            {
                'tokens': 25,
            }
        ]
    },
    'apiRounds': [
        {
            'status': 200,
            'usage': {
                'input_tokens': 50,
                'output_tokens': 50,
                '_wire_token': 'secret_token',
                '_dispatch': {
                    'model': 'gpt-4',
                    'latency_ms': 100,
                }
            }
        },
        {
            'status': 429,
            'usage': {
                'input_tokens': 10,
                '_wire_retry': 'retry_info',
            }
        },
        'invalid_round_entry',
    ],
    'event_id': 'evt_123',
    'timestamp': 1700000000,
}

ARGS = {
    'event': event_dict,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
project_agent_evidence Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
NiuTrans/ToFu/tofu_agent/runtime.py
code served (permissive licence) · get_code("555d24e2d55498e2")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import copy
import hashlib

# Mock the orchestration_adoption module since it's imported
class MockOrchestrationModule:
    @staticmethod
    def public_orchestration_decisions(task):
        return []

import sys
from unittest.mock import MagicMock
mock_orchestration = MagicMock()
mock_orchestration.public_orchestration_decisions = MockOrchestrationModule.public_orchestration_decisions
sys.modules['lib'] = MagicMock()
sys.modules['lib.orchestration_adoption'] = mock_orchestration

# Build a minimal task dict with all relevant fields
task = {
    'id': 'task-123',
    '_requestId': 'req-456',
    'model': 'gpt-4',
    'status': 'completed',
    'finishReason': 'stop',
    'created_at': 1234567890.5,
    'finished_at': 1234567900.5,
    'content': 'Hello, world!',
    'config': {
        'model': 'gpt-4-override',
        '_customToolsMode': 'replace',
        '_explicitToolSchemas': [
            {'name': 'tool1', 'description': 'A tool'},
            {'name': 'tool2', 'description': 'Another tool'}
        ]
    },
    'usage': {
        'prompt_tokens': 100,
        'completion_tokens': 50,
        'total_tokens': 150,
        '_wire_internal': 'should_be_filtered',
        '_dispatch': {
            'model': 'gpt-4',
            'provider_id': 'openai',
            'protocol': 'http',
            'latency_ms': 500,
            'ttft_ms': 100,
            'attempt': 1,
            '429_retries': 0,
            '_internal_secret': 'should_be_filtered'
        }
    },
    'apiRounds': [
        {
            'roundNum': 1,
            'usage': {
                'prompt_tokens': 50,
                'completion_tokens': 25,
                '_dispatch': {
                    'model': 'gpt-4',
                    'provider_id': 'openai',
                    'latency_ms': 250
                }
            }
        },
        {
            'roundNum': 2,
            'usage': {
                'prompt_tokens': 50,
                'completion_tokens': 25
            }
        }
    ],
    '_contextTelemetryRounds': [
        {'round': 1, 'context_size': 1000}
    ],
    '_contextCompactionEvents': [
        {'event_type': 'compaction', 'tokens_removed': 500}
    ],
    'compactionUsage': {
        'compaction_tokens': 500
    },
    '_toolExposureTelemetry': {
        'tools_exposed': 5
    },
    'programRuns': [
        {'program': 'main', 'status': 'success'}
    ]
}

ARGS = {
    'task': task,
    'model': 'gpt-4-final',
    'requested_id': 'req-789',
    'provider_id': 'anthropic'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
lib — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
project_agent_result Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
NiuTrans/ToFu/tofu_agent/runtime.py
code served (permissive licence) · get_code("affea727c763cd31")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import time
import uuid
from collections.abc import Mapping

ARGS = {
    'task': {
        'id': 'task-12345',
        'status': 'completed',
        'content': 'The answer is 42',
        'thinking': 'Let me think about this',
        'usage': {'input_tokens': 10, 'output_tokens': 5},
        'finishReason': 'stop',
        'toolRounds': [
            {
                'tool_calls': [
                    {'id': 'call-1', 'function': 'search', 'arguments': '{"query": "test"}'}
                ]
            }
        ],
        'compactionUsage': {'compressed_tokens': 8},
        'error': None
    },
    'model': 'gpt-4-turbo',
    'requested_id': 'run-abc123def456',
    'trajectory_fmt': None,
    'byo_provider': None,
    'provider_id': 'provider-xyz'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
lib — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
project_url Ran
ran; our contract draft was wrong, not the code
rangehow/overleaf-mcp/src/overleaf_mcp/config.py
code served (permissive licence) · get_code("ff773fc5d655997a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os
import re

_PROJECT_ID_RE = re.compile('^[0-9a-f]{24}$')

OVERLEAF_BASE_URL = os.environ.get('OVERLEAF_BASE_URL', 'https://www.overleaf.com')

def project_url(project_id: str) -> str:
    """Return the canonical web URL for a project on this deployment.

    Uses ``OVERLEAF_BASE_URL`` so self-hosted Overleaf instances produce
    correct links (the public default is ``https://www.overleaf.com``).
    Returns '' for a falsy/invalid id so callers can omit the link rather
    than emit a broken ``…/project/`` URL.
    """
    if not project_id or not _PROJECT_ID_RE.match(project_id):
        return ''
    return f"{OVERLEAF_BASE_URL.rstrip('/')}/project/{project_id}"


# Valid 24-character hex project ID
valid_project_id = "123456789abcdef0123456ab"

ARGS = {
    "project_id": valid_project_id
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
read_metadata Ran
ran; our contract draft was wrong, not the code
rangehow/overleaf-mcp/src/overleaf_mcp/metadata.py
code served (permissive licence) · get_code("7bb60ddee022c4f9")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import tempfile
import json
import os
from pathlib import Path

# Create a temporary directory for testing
temp_dir = tempfile.mkdtemp()

# Create a valid metadata file
metadata_file = Path(temp_dir) / '.overleaf-project.json'
metadata_content = {"project_id": "12345", "owner": "test_user"}
metadata_file.write_text(json.dumps(metadata_content), encoding='utf-8')

ARGS = {
    'root': temp_dir
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
require_user_id Ran
ran, honoured the contract we drafted
NiuTrans/ToFu/tofu_agent/runtime.py
code served (permissive licence) · get_code("d473f99d92ef7f33")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

# The function require_user_id takes two parameters:
# 1. value: Any - the value to validate as a user_id
# 2. context: str - optional keyword argument for error messages (default='operation')

# Valid test cases for value parameter:
# - Positive integer (main success case)
# - String representation of positive integer (will be converted via int())
# - Numpy integer type (will be converted via int())

ARGS = {
    'value': 42,
    'context': 'test_operation'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
short_id Ran
ran; our contract draft was wrong, not the code
NiuTrans/ToFu/tofu_agent/runtime.py
code served (permissive licence) · get_code("350201717d02549e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import uuid

ARGS = {
    'prefix': 'test_',
    'n': 24
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
terminal_finish_reason Ran
ran; our contract draft was wrong, not the code
NiuTrans/ToFu/tofu_agent/runtime.py
code served (permissive licence) · get_code("bb288e582e73d822")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from collections.abc import Mapping

# Construct valid task mappings to test the terminal_finish_reason function
# The function expects a Mapping with keys like 'finishReason', 'finish_reason', 'status'

# Test case 1: Task with explicit finishReason
task1 = {
    'finishReason': 'stop',
    'status': 'completed'
}

# Test case 2: Task with finish_reason (snake_case)
task2 = {
    'finish_reason': 'max_tokens',
    'status': 'completed'
}

# Test case 3: Task with status 'aborted'
task3 = {
    'status': 'aborted'
}

# Test case 4: Task with status 'truncated'
task4 = {
    'status': 'truncated'
}

# Test case 5: Task with no finish reason or status (should return 'error')
task5 = {
    'other_key': 'value'
}

# Test case 6: Task with None finishReason and valid status
task6 = {
    'finishReason': None,
    'finish_reason': 'length',
    'status': 'completed'
}

# Use the first task as the primary test argument
ARGS = {
    'task': task1
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
update_section Ran
ran; our contract draft was wrong, not the code
rangehow/overleaf-mcp/src/overleaf_mcp/latex.py
code served (permissive licence) · get_code("68e5f690dedc1239")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re
from typing import Any

SECTION_LEVELS = ['part', 'chapter', 'section', 'subsection', 'subsubsection', 'paragraph', 'subparagraph']

SECTION_PATTERN = re.compile('\\\\(' + '|'.join(SECTION_LEVELS) + ')(\\*?)\\s*\\{', re.MULTILINE)

def _extract_braced(content: str, open_idx: int) -> tuple[str, int] | None:
    """Given ``content[open_idx] == '{'``, return (body, index_after_close).

    Handles nested ``{}`` pairs, so ``\\section{Foo \\texttt{bar}}`` yields
    ``Foo \\texttt{bar}``. Backslash-escaped braces are treated as literal.
    Returns ``None`` if no matching close is found.
    """
    if open_idx >= len(content) or content[open_idx] != '{':
        return None
    depth = 1
    i = open_idx + 1
    n = len(content)
    while i < n:
        ch = content[i]
        if ch == '\\' and i + 1 < n:
            i += 2
            continue
        if ch == '{':
            depth += 1
        elif ch == '}':
            depth -= 1
            if depth == 0:
                return (content[open_idx + 1:i], i + 1)
        i += 1
    return None

def parse_sections(content: str) -> list[dict[str, Any]]:
    """Parse LaTeX content and extract all sectioning commands.

    Returns a list of dicts with keys:
      type, title, preview, start_pos, end_pos, level
    """
    matches = list(SECTION_PATTERN.finditer(content))
    parsed: list[tuple[re.Match, str, int]] = []
    for m in matches:
        open_idx = m.end() - 1
        extracted = _extract_braced(content, open_idx)
        if extracted is None:
            continue
        title, after_close = extracted
        parsed.append((m, title, after_close))
    sections: list[dict[str, Any]] = []
    for i, (m, title, header_end) in enumerate(parsed):
        sec_type = m.group(1)
        end = parsed[i + 1][0].start() if i + 1 < len(parsed) else len(content)
        body = content[header_end:end].strip()
        preview = body[:200] + '…' if len(body) > 200 else body
        sections.append({'type': sec_type, 'title': title, 'preview': preview, 'start_pos': m.start(), 'end_pos': end, 'level': SECTION_LEVELS.index(sec_type)})
    return sections

def update_section(content: str, title: str, new_body: str) -> str | None:
    """Replace the body of the named section, preserving the header.

    Returns the full updated file content, or ``None`` if the section
    was not found.
    """
    sections = parse_sections(content)
    for sec in sections:
        if sec['title'].lower() != title.lower():
            continue
        start_re = re.compile(f"\\\\{re.escape(sec['type'])}\\*?\\s*\\{{")
        hm = start_re.search(content, sec['start_pos'])
        if not hm:
            return None
        extracted = _extract_braced(content, hm.end() - 1)
        if extracted is None:
            return None
        _title, header_end = extracted
        return content[:header_end] + '\n' + new_body.strip() + '\n' + content[sec['end_pos']:]
    return None


# Setup code to construct valid arguments for update_section
latex_content = r"""
\chapter{Introduction}
This is the introduction chapter with some initial content.
More details here about the introduction.

\section{Background}
This section covers background material and context.
Additional background information goes here.

\subsection{Details}
Some detailed information in the subsection.
"""

section_title = "Background"
new_section_body = """This is the updated content for the Background section.
It contains new text that replaces the old body.
More lines of updated content can go here."""

ARGS = {
    'content': latex_content,
    'title': section_title,
    'new_body': new_section_body
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
validate_path Ran
ran; our contract draft was wrong, not the code
rangehow/overleaf-mcp/src/overleaf_mcp/git_client.py
code served (permissive licence) · get_code("8ee109e261cc58d1")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned PosixPath. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

from pathlib import Path
import tempfile

ARGS = {
    "base": Path("/tmp/repo"),
    "target": "src/module.py"
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type PosixPath — a PosixPath output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a PosixPath output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
AgentClosedError Not yet run
unverified (harvested, no recorded run)
NiuTrans/ToFu/tofu_agent/runtime.py
code served (permissive licence) · get_code("3f2d5d69e41412e5")
How it ran

no invocation recorded.

AgentConfigurationError Not yet run
unverified (harvested, no recorded run)
NiuTrans/ToFu/tofu_agent/runtime.py
code served (permissive licence) · get_code("860522550fdf48c6")
How it ran

no invocation recorded.

AgentExecution Not yet run
unverified (harvested, no recorded run)
NiuTrans/ToFu/tofu_agent/runtime.py
code served (permissive licence) · get_code("5dc134beeab5066c")
How it ran

no invocation recorded.

AgentOverloadedError Not yet run
unverified (harvested, no recorded run)
NiuTrans/ToFu/tofu_agent/runtime.py
code served (permissive licence) · get_code("b64630e7eed22ecf")
How it ran

no invocation recorded.

AgentRequest Not yet run
unverified (harvested, no recorded run)
NiuTrans/ToFu/tofu_agent/runtime.py
code served (permissive licence) · get_code("9aba9d801bfe046b")
How it ran

no invocation recorded.

AgentRuntime Not yet run
unverified (harvested, no recorded run)
NiuTrans/ToFu/tofu_agent/runtime.py
code served (permissive licence) · get_code("3c7fb39a344c8697")
How it ran

no invocation recorded.

AgentRuntimeError Not yet run
unverified (harvested, no recorded run)
NiuTrans/ToFu/tofu_agent/runtime.py
code served (permissive licence) · get_code("0e6dfa778257cc49")
How it ran

no invocation recorded.

AgentTimeoutError Not yet run
unverified (harvested, no recorded run)
NiuTrans/ToFu/tofu_agent/runtime.py
code served (permissive licence) · get_code("20298f5fa25e540b")
How it ran

no invocation recorded.

_alias_setters Not yet run
unverified (harvested, no recorded run)
NiuTrans/ToFu/tofu_agent/runtime.py
code served (permissive licence) · get_code("9f8765744e7c17e7")
How it ran

no invocation recorded.

_env_first Not yet run
unverified (harvested, no recorded run)
NiuTrans/ToFu/tofu_agent/runtime.py
code served (permissive licence) · get_code("96c3e35ffbbfbf96")
How it ran

no invocation recorded.

_set_if_truthy Not yet run
unverified (harvested, no recorded run)
NiuTrans/ToFu/tofu_agent/runtime.py
code served (permissive licence) · get_code("f288b8334f3d7f01")
How it ran

no invocation recorded.

_set_search Not yet run
unverified (harvested, no recorded run)
NiuTrans/ToFu/tofu_agent/runtime.py
code served (permissive licence) · get_code("ec84642642a948fd")
How it ran

no invocation recorded.

_set_thinking Not yet run
unverified (harvested, no recorded run)
NiuTrans/ToFu/tofu_agent/runtime.py
code served (permissive licence) · get_code("83ecbec2083039c0")
How it ran

no invocation recorded.

get_project Not yet run
unverified (harvested, no recorded run)
rangehow/overleaf-mcp/src/overleaf_mcp/config.py
code served (permissive licence) · get_code("2188b3bb22118d1c")
How it ran

no invocation recorded.

principal Not yet run
unverified (harvested, no recorded run)
NiuTrans/ToFu/tofu_agent/runtime.py
code served (permissive licence) · get_code("ab8cdd7c41d0cfa7")
How it ran

no invocation recorded.

run_verification Not yet run
unverified (harvested, no recorded run)
rangehow/overleaf-mcp/src/overleaf_mcp/verify.py
code served (permissive licence) · get_code("51b3ca11204643d0")
How it ran

no invocation recorded.

write_metadata Not yet run
unverified (harvested, no recorded run)
rangehow/overleaf-mcp/src/overleaf_mcp/metadata.py
code served (permissive licence) · get_code("92c427aa0cc4bac6")
How it ran

no invocation recorded.

Also present in other papers' code

Of 44 samples lifted from this paper's linked repositories, 44 carry a function identity and 0 do not. Of the 44 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 0 later) and 43 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
get_logger
brick of this paper's assembly: helper
8 other papers
8 dated earlier
2111.05897 (2021-11)
Persia: An Open, Hybrid System Scaling Deep Learning-based Recommenders up to 100 Trillion Parameters
2401.10491 (2024-01)
Knowledge Fusion of Large Language Models
2412.03187 (2024-12)
Weighted-Reward Preference Optimization for Implicit Model Fusion
and 5 more not named here

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Agentic coding tools present new opportunities to transform research workflows. The performance of agent systems built depends on both large language models (LLMs) and the harness around LLMs, which is the orchestration code that determines an agent's behavior. We present TOFU, an agentic harness for researchers that reads your codebase, edits files, runs commands, and integrates with your development tools. TOFU plays a dual role in research. As a research assistant, it supports practical research workflows with superior token efficiency, lower cost, and multilingual capability compared with existing agentic harnesses. Its release under the MIT License further enables local deployment for privacy-sensitive users. As a research object, TOFU provides a whitebox agentic harness that allows researchers to inspect, modify, and evaluate its orchestration logic, tool-use behavior, and harness design, while retaining strong benchmark performance and an application-level user experience. github.com/NiuTrans/ToFu

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2607.11423")
get_code_for_paper("2607.11423")
have("2607.11423")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2607.11423.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2607.11423.svg)](https://syntology.ai/paper/2607.11423)

Connect an agent — have() is free.