Skip to content
13 changes: 0 additions & 13 deletions tests/agents/test_progress_watchdog.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
from tests.support.session_run_test_support import (
agent_with_submit as _agent_with_submit,
)
from tests.support.tool_execution_test_support import build_sensor_use_case as _use_case


def _captured():
Expand Down Expand Up @@ -273,18 +272,6 @@ def test_watchdog_forced_turn_ignored_escalates_once_then_commits():
assert llm.calls[1]["tool_choice"] == _FORCED_SUBMIT_CHOICE
assert submit.captured is not None

class ScriptedTool:
def __init__(self, name, outputs):
self.name = name
self._outputs = list(outputs)

async def execute_with_runtime(self, args, runtime):
return self._outputs.pop(0) if self._outputs else ""

def _run_one(state, tool, name, args):
call = {"id": "c1", "function": {"name": name, "arguments": args}}
run(_use_case(state, tool).process([call])).apply_to(state)

def test_steps_since_progress_resets_on_user_turn():
state = SessionState(messages=[])
state.turn.steps_since_progress = 5
Expand Down
14 changes: 0 additions & 14 deletions tests/agents/test_session_characterization.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,20 +416,6 @@ def test_no_tool_calls_marks_done_and_emits_text_delta(local_environment_factory
]
assert tracer.steps[3]["payload"]["content"] == "plain answer"

def test_session_accepts_explicit_llm_client(local_environment_factory):
fake_llm = FakeLLMClient([
llm_response(content="explicit llm answer", input_tokens=2, output_tokens=3),
])
session = Session(env=local_environment_factory(), agent=FakeAgent(), llm=fake_llm)

assert session._llm is fake_llm
assert session.runner.llm is fake_llm

result = run(session.run_loop())

assert result == "explicit llm answer"
assert fake_llm.calls

def test_session_event_sink_wires_through_to_runtime(local_environment_factory):
fake_llm = FakeLLMClient([
llm_response(content="event sink answer"),
Expand Down
38 changes: 0 additions & 38 deletions tests/agents/test_session_construction.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
from opencollab.application.autosave import AutoSaveSubscriber
from opencollab.application.scheduler_types import LaunchSpec
from opencollab.application.session import SessionRuntime
from opencollab.application.session_run import SessionRunUseCase
from opencollab.application.tool_execution import ToolExecutionUseCase
from opencollab.bootstrap import build_session as Session
from opencollab.bootstrap import load_session, snapshot_session
from tests.support.environment_test_support import local_environment_factory as local_environment_factory
Expand Down Expand Up @@ -60,15 +58,6 @@ def _new_session(local_environment_factory, **overrides) -> Session:
kwargs["env"] = local_environment_factory()
return Session(**kwargs)

def test_session_builds_runtime_collaborators_eagerly():
session = Session(agent=_FakeAgent(), llm=_FakeLLM())
try:
assert isinstance(session.tool_execution, ToolExecutionUseCase)
assert isinstance(session.runner, SessionRunUseCase)
assert isinstance(session.store, SessionStore)
finally:
run(session.env.cleanup())

def test_session_pending_cleanup_includes_tool_execution_owners(local_environment_factory):
async def scenario():
session = _new_session(local_environment_factory)
Expand All @@ -91,26 +80,6 @@ def test_session_seed_user_messages_follow_system_prompt(local_environment_facto
{"role": "user", "content": "Task:\nbuild it"},
]

def test_session_wires_a_default_shaper_pipeline(local_environment_factory):
from opencollab.application.shaping import ShaperPipeline

session = _new_session(local_environment_factory)
assert isinstance(session.runner.shaper, ShaperPipeline)

def test_session_event_bus_reaches_injected_sink(local_environment_factory):
from opencollab.domain.events import SessionRuntimeEvent as SessionEvent

seen: list = []

async def sink(event):
seen.append(event)

session = _new_session(local_environment_factory, event_sink=sink)
event = SessionEvent(type="marker", data={"k": 1})
run(session.event_bus.emit(event))

assert seen == [event]

def test_session_runtime_preserves_legacy_positional_optional_fields():
subscriber = AutoSaveSubscriber(lambda: None)
runtime = SessionRuntime(
Expand All @@ -122,13 +91,6 @@ def test_session_runtime_preserves_legacy_positional_optional_fields():
assert runtime.owns_llm is True
assert runtime.run_id is None

def test_session_with_auto_save_path_subscribes_autosave_subscriber(local_environment_factory, tmp_path):
path = tmp_path / "auto.jsonl"
session = _new_session(local_environment_factory, auto_save_path=str(path))

subs = [t for t in session.event_bus._targets if isinstance(t, AutoSaveSubscriber)]
assert len(subs) == 1

def test_session_without_auto_save_path_does_not_subscribe_autosave(local_environment_factory):
session = _new_session(local_environment_factory)
subs = [t for t in session.event_bus._targets if isinstance(t, AutoSaveSubscriber)]
Expand Down
16 changes: 0 additions & 16 deletions tests/agents/test_session_run_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,6 @@ def test_runner_rejects_unbounded_per_call_timeout(per_call_timeout):
with pytest.raises(ValueError, match="finite positive"):
build_runner(per_call_timeout=per_call_timeout)

def test_run_loop_budget_exceeded_emits_error_and_sets_phase():
events, bus = collect_events()
state = SessionState(messages=[{"role": "system", "content": "sys"}], used_tokens=10)
llm = FakeLLM()
runner = build_runner(state=state, llm=llm, event_bus=bus, max_budget_tokens=10)
result = run(runner.run_loop())
assert result == ""
assert llm.calls == []
assert state.phase is SessionPhase.STOPPED
assert state.terminal_reason == "budget exceeded: 10 tokens used"
assert state.messages[-1] == {
"role": "system",
"content": "[Budget exceeded: 10 tokens used. Session stopped.]",
}
assert events == [("error", {"reason": "budget exceeded: 10 tokens used", "aid": -1})]

def test_remaining_budget_caps_next_model_output_request():
messages = [{"role": "system", "content": "sys"}]
input_tokens = _reserved_first_call_input(messages)
Expand Down
14 changes: 0 additions & 14 deletions tests/agents/test_session_submit_ends_the_turn.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,6 @@ def test_a_step_that_did_not_submit_still_loops_back_to_another_call():
assert answer == "done exploring"
assert len(llm.calls) == 2

def test_submit_is_a_success_terminal_not_a_stop():
runner, _ = _runner(
submitted=True,
responses=[llm_response(tool_calls=[tool_call("t1", "submit", '{"summary": "s"}')])],
)

run(runner.run_loop())

# STOPPED is the controlled-halt terminal and the scheduler turns it into
# "Error: agent stopped"; an agent that said it was finished must not be
# reported as one that was cut off.
assert runner.state.phase is not SessionPhase.STOPPED
assert runner.state.phase is SessionPhase.DONE

@pytest.mark.parametrize("content", [None, SUMMARY, SUMMARY + "\n", "I have checked the requested change."])
@pytest.mark.parametrize("aid", [0, 7])
async def test_public_session_delivers_submitted_text_once_to_its_agent(tmp_path, content, aid):
Expand Down
12 changes: 0 additions & 12 deletions tests/agents/test_team_role_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

from opencollab.adapters.tools.single2 import SINGLE2_BASH_OUTPUT_CHARS
from opencollab.application.event_bus import EventBus
from opencollab.bootstrap.agent_profiles import resolve_agent_profile
from opencollab.bootstrap.context_builder import ContextBuilder, SpawnConfig
from opencollab.bootstrap.single2_prompt import SINGLE2_SYSTEM_PROMPT
from opencollab.bootstrap.team_config import RoleConfig, TeamConfig, load_team_config
Expand Down Expand Up @@ -157,17 +156,6 @@ def test_an_unknown_profile_is_refused_at_load(tmp_path) -> None:
load_team_config(path=str(path))


def test_default_means_opencollabs_own_agent(tmp_path) -> None:
path = tmp_path / "team.yaml"
path.write_text(
"entry: solo\nroles:\n solo:\n prompt: hi\n profile: default\n",
encoding="utf-8",
)
assert load_team_config(path=str(path)).roles["solo"].profile is None
assert _builder(None)._profile_for(load_team_config(path=str(path)).roles["solo"]) is None
assert resolve_agent_profile(None).name == "single2"


def test_a_team_file_reports_the_profile_each_seat_declares(tmp_path) -> None:
"""The profile identifies the base agent independently of the appended role card."""
path = tmp_path / "team.yaml"
Expand Down
16 changes: 0 additions & 16 deletions tests/interfaces/test_cli_turn_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,22 +272,6 @@ def test_a_partial_answer_already_in_scrollback_is_not_printed_again():
assert "partial answer" not in printed
assert "Agent 2 stopped: token budget exhausted" in printed

@pytest.mark.asyncio
async def test_piped_input_finishes_all_turns_before_eof():
prompt = _FakePrompt(['first', 'second'])
prompt.interactive = False
completed = []

async def turn(line, aid, cancel):
await asyncio.sleep(0.01)
completed.append(line)

queue = TurnQueue(turn)
await cli_main._drive(
queue, reader=cli_main._read_loop(prompt, queue, _tui(), object()),
until_drained=False,
)
assert completed == ['first', 'second']

@pytest.mark.asyncio
async def test_piped_reply_belongs_to_the_current_agent_question():
Expand Down
17 changes: 1 addition & 16 deletions tests/interfaces/test_public_teams_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from __future__ import annotations

from opencollab.domain.scheduler import per_agent_cap
from opencollab.teams import (
declared_context_policy,
declared_role_budgets,
Expand All @@ -20,19 +19,6 @@ def test_the_declared_roles_are_the_file_s_roles_in_order() -> None:
assert declared_role_names(str(EXPERIMENT_TEAM)) == ("analyst", "coder", "tester")


def test_a_pool_of_n_seats_gives_each_seat_one_solo_agent_s_budget() -> None:
solo_budget = 1_000_000
roles = declared_role_names(str(EXPERIMENT_TEAM))

cap = per_agent_cap(solo_budget * len(roles), len(roles))

# This is the whole point of the count: multiply by it and a seat is worth
# exactly what the same agent is given alone. Pass the solo figure as the
# pool instead and the seat is worth a third of it.
assert cap == solo_budget
assert per_agent_cap(solo_budget, len(roles)) == solo_budget // 3


ICLR_EXPERIMENT_TEAM = REPO_ROOT / "tests" / "fixtures" / "teams" / "team.handoff.primary-legacy.yaml"


Expand Down Expand Up @@ -110,8 +96,7 @@ def test_roles_that_share_a_card_share_a_digest() -> None:


def test_a_file_without_allowances_declares_no_role_budgets() -> None:
# Empty means the run keeps one shared pool, which the caller sizes itself
# by the rule above.
# Empty leaves one shared pool whose size is chosen by the caller.
assert declared_role_budgets(str(EXPERIMENT_TEAM)) == {}


Expand Down
4 changes: 0 additions & 4 deletions tests/interfaces/test_tui_brand_motion.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from opencollab.adapters.tui.brand_motion import (
DOT_GLYPH,
PulseDot,
dot_color,
pulse_brightness,
)
from tests.interfaces.tui_style_support import assert_visible_text_has_non_white_style as _assert_all_non_white
Expand All @@ -17,9 +16,6 @@ def test_pulse_breathes_between_trough_and_peak():
assert peak > trough
assert 0.0 <= trough < peak <= 1.0

def test_dot_color_changes_as_time_advances():
assert dot_color(0.0) != dot_color(0.7)

def test_frame_changes_between_elapsed_values():
early = PulseDot(show_seconds=False, elapsed=0.0).render()
later = PulseDot(show_seconds=False, elapsed=0.7).render()
Expand Down
7 changes: 0 additions & 7 deletions tests/runtime/test_eager_tool_clear_shaper.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,6 @@ def test_monotonic_one_more_exchange_flips_exactly_one_and_keeps_old_stubs():
assert _tool_content(turn_n, tid) == _tool_content(turn_n1, tid)
assert _is_stub(_tool_content(turn_n1, tid))

def test_monotonic_never_unstubs():
sh = EagerToolOutputClearShaper(keep_recent=3)
once = sh.shape(_history(8))
again = sh.shape(once)
for tid in ("t1", "t2", "t3", "t4", "t5"):
assert _is_stub(_tool_content(again, tid))

def test_idempotent_shape_of_shape_equals_shape():
messages = _history(9)
once = _shaper().shape(messages)
Expand Down
28 changes: 0 additions & 28 deletions tests/runtime/test_llm_chat_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,34 +159,6 @@ def tool_delta(
call["type"] = "function"
return {"tool_calls": [call]}

async def test_stream_off_sends_no_stream_keys_to_create():
completion = ChatCompletion.model_validate({
"id": "chatcmpl-1",
"object": "chat.completion",
"created": 1,
"model": MODEL,
"choices": [
{
"index": 0,
"message": {"role": "assistant", "content": "391"},
"finish_reason": "stop",
}
],
"usage": USAGE,
})
client = FakeClient([completion])

await complete_openai(client, MODEL, MESSAGES, None, 0.0, 0)

assert "stream" not in client.calls[0]
assert "stream_options" not in client.calls[0]

async def test_stream_on_adds_stream_and_include_usage():
_, client = await run_stream(text_script())

assert client.calls[0]["stream"] is True
assert client.calls[0]["stream_options"] == {"include_usage": True}

async def test_streamed_and_non_streamed_answers_parse_identically():
completion = ChatCompletion.model_validate({
"id": "chatcmpl-1",
Expand Down
1 change: 1 addition & 0 deletions tests/runtime/test_llm_chat_streaming_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ async def test_switch_on_streams_and_records_reasoning_over_real_sse():
"stream",
"stream_options",
}
assert requests[0]["stream"] is True
assert requests[0]["stream_options"] == {"include_usage": True}
assert response.reasoning == "17*23 = 391"
assert response.content == "391"
Expand Down
10 changes: 2 additions & 8 deletions tests/runtime/test_llm_first_token_latency.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,21 +269,15 @@ async def create(**_kwargs: Any) -> Any:
_SCRIPTED_TESTER_BUNDLE = ("bash", "file_read", "git_diff", "grep", "run_tests", "submit")
_READING_ANALYST_BUNDLE = ("bash", "file_read", "grep", "run_tests", "submit")

# Enumerate every seat from OpenCollab-Eval experiment/arm_registry.py role_tool_names.
# Distinct tool bundles and agent ids from OpenCollab-Eval experiment/arm_registry.py.
ARM_SEATS: tuple[tuple[str, str, tuple[str, ...], int], ...] = (
("single", "swe_agent", _SINGLE_BUNDLE, 0),
("best-of-n", "swe_agent", _SINGLE_BUNDLE, 0),
("team", "analyst", _TEAM_WORKING_BUNDLE, 0),
("team", "coder", _TEAM_WORKING_BUNDLE, 1),
("team", "tester", _TEAM_TESTER_BUNDLE, 2),
("self-collaboration", "analyst", _SINGLE_BUNDLE, -1),
("self-collaboration", "coder:r1", _SINGLE_BUNDLE, -1),
("self-collaboration", "tester:r1", _SCRIPTED_TESTER_BUNDLE, -1),
("self-collaboration", "analyst:adjudicate:r1", _SINGLE_BUNDLE, -1),
("self-collaboration-reading-analyst", "analyst", _READING_ANALYST_BUNDLE, -1),
("self-collaboration-reading-analyst", "coder:r1", _SINGLE_BUNDLE, -1),
("self-collaboration-reading-analyst", "tester:r1", _SCRIPTED_TESTER_BUNDLE, -1),
("self-collaboration-reading-analyst", "analyst:adjudicate:r1", _SINGLE_BUNDLE, -1),
)

class _ToolStub:
Expand Down Expand Up @@ -317,7 +311,7 @@ def _client_over(fake: _FakeChatClient, *, stream: bool) -> LLMClient:
ARM_SEATS,
ids=[f"{arm}:{seat}" for arm, seat, _tools, _aid in ARM_SEATS],
)
def test_every_arm_seat_records_transport_timing_on_its_llm_call(
def test_seat_execution_inputs_record_transport_timing_on_llm_call(
arm: str, seat: str, tool_names: tuple[str, ...], aid: int, stream: bool
):
tracer = FakeTracer()
Expand Down
6 changes: 0 additions & 6 deletions tests/runtime/test_local_env_processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,12 +668,6 @@ async def test_local_temp_files_have_owned_cleanup(local_environment_factory, tm
await env.remove_file(path)
assert not os.path.exists(path)

async def test_local_temp_cleanup_removes_registered_path(local_environment_factory, tmp_path) -> None:
env = local_environment_factory(str(tmp_path))
path = await env.write_temp_file("owned", prefix="probe-", suffix=".txt")
await env.remove_file(path)
assert not os.path.exists(path)

async def test_local_temp_cleanup_rejects_replaced_workspace_symlink(local_environment_factory, tmp_path) -> None:
workspace = tmp_path / "workspace"
outside = tmp_path / "outside"
Expand Down
5 changes: 0 additions & 5 deletions tests/runtime/test_model_capability_table_iclr.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@
from opencollab.adapters.llm.types import ModelCapabilities, model_capabilities


def test_qwen_flash_refuses_forced_tool_choice():
capabilities = model_capabilities("qwen3.8-flash")

assert capabilities.supports_forced_tool_choice is False

def test_qwen_flash_leaves_every_unprobed_dimension_at_its_default():
"""Unprobed dimensions must retain defaults instead of inheriting a neighbouring row."""
capabilities = model_capabilities("qwen3.8-flash")
Expand Down
Loading
Loading