Skip to content

The "required refinement source with nothing to refine it" guard tests only refiner_model, so refiner_max_per_engagement 0 and a failed-runs policy still stall silently

Id: TD-PPagop-26082704 · Status: resolved · Filed: 2026-08-27 · Resolved: 2026-09-22 · Ref: https://github.com/Pullwright/agent-ops/pull/1765

Noticed reviewing agent-ops#828 (the model-tier floor, requirement 1c).

config_required_refinement_sources_without_refiner (lib/config-schema.sh) refuses to start a cycle when a refinement_policy source resolves to "required" while refiner_model is empty. Its stated contract — requirement 1c’s “Resolving refiner_model’s optionality”, and the function’s own comment — is broader than that: a "required" source with nothing that can ever refine it is a configuration nobody can act on, because prompts/coordinator.md’s “Per-source refinement policy” skips such an item entirely and does not report it in needs_refinement, so its items wait forever with no label, no block record and nothing on the dashboard to say why.

Two configurations reach exactly that state and pass the guard:

  1. refiner_max_per_engagement: 0 with refiner_model set. refiner_engagement_set (lib/refinement.sh:870) slices .[0:0], and maybe_run_refiner returns at its (( n_eligible > 0 )) gate (lib/refinement.sh:1003), so no candidate is ever refined. README.md documents 0 as “switches proactive refinement off” and the pipeline spec as “removes the class from engagements entirely” — the same end state the guard rejects when it is spelled refiner_model: "".
  2. failed-runs: "required". failed-runs is the one source with no candidate array at all, so the Refiner’s candidate gathering can never reach it. prompts/coordinator.md says so directly (“nothing ever refines an unrefined item there, and an installation setting "required" on it should know its items will simply wait”) — a prose caveat where the neighbouring case is a hard fail.

Low severity today: neither configuration is live — config.json leaves refiner_max_per_engagement unset (default 5) and sets a policy for issues and tech-debt only. The cost is that the invariant #822 set out to make checkable is checkable against one of its three spellings, so the guard reads as complete when it is not, and the two remaining spellings fail in the quietest way this pipeline has: a source that simply stops producing work, with no signal anywhere that it has.

Extend config_required_refinement_sources_without_refiner to take refiner_max_per_engagement alongside refiner_model and treat 0 the same as an empty model, and to treat a "required" failed-runs as unrefinable outright. Both callers (agent-cycle.sh’s startup guard and scripts/doctor.sh) already pass the resolved values they would need.

The reason this was not simply fixed inside #828 is that it is a deployment trade-off rather than a mechanical gap: a maintainer who sets refiner_max_per_engagement: 0 to pause refinement would get a pipeline that refuses to start until they also flip every "required" policy back, which is its own footgun and belongs to whoever runs the fleet to choose. Whatever is chosen, requirement 1c in docs/IMPLEMENTATION-PIPELINE-SPEC.md and config.schema.json’s refinement_policy/refiner_max_per_engagement descriptions state the current, narrower rule and would move with it.

Referenced from: agent-ops#828 (review comment), requirement 1c.

Migrated to https://github.com/Poetic-Poems/agent-ops/issues/1003.