Extract and summarise bounds are each agent's own limits, set on its form

agents.limits holds extract_top, extract_min, summarise_top and
summarise_min; the scope query reads them per ranked row, and a row saved
before this behaves like a fresh agent. The four global config keys go.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Fable 5.1 committed 2026-09-28 16:02:06 +02:00
1 parent e602eb3388
commit cebe62ddc9
20 files changed
+229 -147

No files matched your search

+9 -7
View File
@@ -12,6 +12,7 @@ import pytest
from app.config import Config
from app.jobs import cascade, summarise
from app.models import Limits
from app.storage import Store
from desk import modeltask
from desk.models import Item
@@ -63,18 +64,19 @@ def store(tmp_path: Path) -> Store:
@pytest.fixture
def config(tmp_path: Path) -> Config:
return Config(database=str(tmp_path / "roledesk.db"),
summarise={"enabled": True, "per_agent": 2})
return Config(database=str(tmp_path / "roledesk.db"), summarise={"enabled": True})
def ranked(store: Store, *ids: str, agent_name: str = "Backend",
enabled: bool = True) -> list[str]:
"""Store a role per id and score them for one agent, best first."""
"""Store a role per id and score them for one agent, best first. The
agent summarises its top two: the bound is the agent's own."""
uids = []
for sid in ids:
store.upsert_role(posting(sid))
uids.append(posting(sid).uid)
one = store.save_agent(agent_name, "python backend", enabled=enabled)
one = store.save_agent(agent_name, "python backend", enabled=enabled,
limits=Limits(summarise_top=2))
store.replace_scores(one.id, [(uid, 1.0 - n / 10, "") for n, uid in enumerate(uids)])
return uids
@@ -154,7 +156,7 @@ def test_a_role_with_no_text_is_skipped_not_sent(
summarise.run_batch(config, store, uids=[empty])
assert model.asked == []
assert store.summarise_pending(config.summarise.per_agent) == 0
assert store.summarise_pending() == 0
def test_a_named_uid_is_summarised_whatever_its_rank_or_the_switch(
@@ -182,10 +184,10 @@ def test_an_unknown_or_empty_answer_is_rejected_and_the_role_given_up_after_thre
assert result["rejected"] == ["not-in-the-batch", uid]
assert store.role(uid).summary == "" # type: ignore[union-attr]
assert store.summarise_pending(2) == 1
assert store.summarise_pending() == 1
modeltask.run(summarise.TASK, config, store)
modeltask.run(summarise.TASK, config, store)
assert store.summarise_pending(2) == 0, "given up after three unanswered replies"
assert store.summarise_pending() == 0, "given up after three unanswered replies"
def test_disabled_finds_nothing_and_asks_nobody(