diff --git a/app/jobs/cascade.py b/app/jobs/cascade.py index 3e5ec7d..fa4e244 100644 --- a/app/jobs/cascade.py +++ b/app/jobs/cascade.py @@ -23,7 +23,10 @@ roles of each enabled agent, as deep and as low as that agent's own `limits` say; the second score then applies the gates to the columns it filled. Summarise follows, on the best roles by the same agent's summarise limits, and judge runs last, reading each agent's best roles against its CV by its -judge limits. +judge limits. The `enrich` cascade, which follows the rescore after an agent +is saved, ends with judge too, so a changed CV, prompt or like text is read +again at once rather than at the next pull; a pair whose `input_key` did not +change costs nothing. A batch that failed, or a stage somebody killed, does not stop the chain: the work comes round on the next pull, and a rescore of what did arrive is worth @@ -55,7 +58,7 @@ STEP = "app.jobs.cascade:step" CASCADES: dict[str, tuple[str, ...]] = { "pull": ("pull", "prep", "embed", "score", "enrich", "prep", "embed", "score", "extract", "score", "summarise", "judge"), - "enrich": ("enrich", "prep", "embed", "score"), + "enrich": ("enrich", "prep", "embed", "score", "judge"), } #: What follows `enrich` for the roles it filled, passed over when it filled none. diff --git a/tests/test_enrich.py b/tests/test_enrich.py index 831724e..8667d84 100644 --- a/tests/test_enrich.py +++ b/tests/test_enrich.py @@ -369,7 +369,7 @@ def test_nothing_filled_passes_over_the_prep_embed_and_score_behind_enrich() -> out = cascade.step(None, None, empty, {"cascade": "enrich", "task": "enrich", "at": 0}, context=context) - assert out["next"] == "" and len(context.made) == 2 + assert out["next"] == "judge" and context.made[2].carries["at"] == 4 class _Embedder: @@ -397,7 +397,7 @@ def test_the_enrich_job_reads_the_pages_then_embeds_and_scores_those_roles( jobs = sorted(queue.jobs.of_cascade(queue.jobs.last(enrich.KIND).cascade_id), # type: ignore[union-attr] key=lambda j: j.id) assert [j.result.get("task") for j in jobs if j.kind == FINAL] == \ - ["enrich", "prep", "embed", "score"] + ["enrich", "prep", "embed", "score", "judge"] assert [j.kind for j in jobs if j.kind != FINAL] == \ ["enrich", enrich.KIND, "prep", "embed", "score"] assert web["asked"] == [f"{BASE}/acme/1"]