M2.8: switch over to the new loop
nisse-dev now runs only the conversational loop. The gated state machine it was built alongside is gone: - Removed control.py, planner.py, executor.py, approvals.py, gates.py (command_form moves to loop/reader.py), publish.py and poller.py, the old assembly in agent.py (its shared helpers move to loop/build.py), the store's state-machine view (get_state, transition), their tests, the old end-to-end and live planning/milestone/gate tests, and specs/orchestrator.qnt with its scenarios. - Roles are driver, helper, expert and classifier; driver is required. loop:, roles.planner, roles.executor and tuning.executor are refused with what to use instead; tuning.driver takes the turn cap and failure limit. - The benchmark and the capability matrix measure the driver: the loop's own system prompt and tools, the task's plan as the agreed restatement. Task plans end with finish_milestone, so earlier runs show as (old); stored runs' executor tuning reads as the driver's. - A delegation on the loop records what its helper's alias resolved to (L9), as the old path's did. - The dump shows a work item's revision and what it waits for. - Behaviour the old tests covered and the loop shares stays covered: driver runs that fail on a model call, stop mid-turn, reset the failure count; go-aheads ignoring case and punctuation; a request too big to fit is never sent; the assembly tests, now on build_loop_agent. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PPQ14L3LikyefCMFBqEbKE
This commit is contained in:
1 parent
09232dcbdd
commit
6ae2375194
89 files changed
+951
-8592
No files matched your search
@@ -9,8 +9,6 @@ import pytest
|
||||
from nisse_dev.canonical import (
|
||||
AssistantText,
|
||||
CanonicalEvent,
|
||||
GateOpened,
|
||||
PlanSubmitted,
|
||||
StoredEvent,
|
||||
ToolCall,
|
||||
ToolResult,
|
||||
@@ -25,8 +23,7 @@ from nisse_dev.context import (
|
||||
fit,
|
||||
head_and_tail,
|
||||
)
|
||||
from nisse_dev.executor import LLMExecutor
|
||||
from nisse_dev.llm import RoleMap
|
||||
from nisse_dev.loop.driver import Driver
|
||||
from nisse_dev.oplog import OpLog
|
||||
from nisse_dev.state import StateStore
|
||||
|
||||
@@ -230,70 +227,27 @@ def test_the_catalog_reads_each_models_limits() -> None:
|
||||
|
||||
|
||||
def test_a_role_on_a_model_without_a_window_is_refused() -> None:
|
||||
CATALOG.require_limits({"executor": "llama3.2", "planner": "claude-haiku-4-5"})
|
||||
with pytest.raises(UnknownLimits, match="executor='undeclared'"):
|
||||
CATALOG.require_limits({"executor": "undeclared", "planner": "llama3.2"})
|
||||
CATALOG.require_limits({"driver": "llama3.2", "helper": "claude-haiku-4-5"})
|
||||
with pytest.raises(UnknownLimits, match="driver='undeclared'"):
|
||||
CATALOG.require_limits({"driver": "undeclared", "helper": "llama3.2"})
|
||||
|
||||
|
||||
# --- the executor sees the approved plan and what came after ---------------
|
||||
|
||||
|
||||
def test_the_executor_sees_only_its_milestone(tmp_path: Path) -> None:
|
||||
def test_a_request_that_cannot_fit_ends_the_run(tmp_path: Path) -> None:
|
||||
# Never sent: the driver's run fails and the item waits on the operator,
|
||||
# like any failed call, rather than a server getting a prompt it would
|
||||
# silently cut.
|
||||
store = StateStore(tmp_path / "state.db", oplog=OpLog("t", io.StringIO()))
|
||||
for event in (
|
||||
UserMessage(text="use greet: a long planning conversation", source="t"),
|
||||
PlanSubmitted(plan="arch plan", model="m"),
|
||||
UserMessage(text="approve", source="t"),
|
||||
PlanSubmitted(plan="milestone 1: write greet.py", model="m"),
|
||||
GateOpened(gate="milestone-1", reason="plan submitted"),
|
||||
UserMessage(text="start milestone 1", source="t"),
|
||||
):
|
||||
store.transcript("t", "executor").append(event)
|
||||
|
||||
class Workspace:
|
||||
def describe(self) -> str:
|
||||
return "workspace"
|
||||
|
||||
seen: dict[str, Any] = {}
|
||||
|
||||
class Client:
|
||||
def complete(self, events, tools, model, system=None):
|
||||
seen["events"] = [e.event for e in events]
|
||||
seen["system"] = system
|
||||
return [AssistantText(text="done", model=model)]
|
||||
|
||||
roles = RoleMap(executor="m", planner="m", helper="m", expert="m")
|
||||
LLMExecutor(Client(), roles, Workspace()).run(store.transcript("t", "executor"), 1)
|
||||
|
||||
texts = [getattr(e, "text", None) for e in seen["events"]]
|
||||
assert "start milestone 1" in texts
|
||||
assert "use greet: a long planning conversation" not in texts
|
||||
assert not any(isinstance(e, PlanSubmitted) for e in seen["events"])
|
||||
# The plan rides in the system prompt, which the budget never drops.
|
||||
assert "The approved plan:\nmilestone 1: write greet.py" in seen["system"]
|
||||
assert "arch plan" not in seen["system"]
|
||||
|
||||
|
||||
def test_a_request_that_cannot_fit_stops_the_milestone(tmp_path: Path) -> None:
|
||||
# Never sent: the executor stops and asks the operator, like any failed
|
||||
# call, rather than handing a server a prompt it would silently cut.
|
||||
store = StateStore(tmp_path / "state.db", oplog=OpLog("t", io.StringIO()))
|
||||
store.transcript("t", "operator").append(
|
||||
UserMessage(text="start milestone 1", source="t")
|
||||
)
|
||||
|
||||
class Workspace:
|
||||
def describe(self) -> str:
|
||||
return "workspace " + "w" * 20_000 # a system prompt too big to fit
|
||||
|
||||
store.transcript("t", "operator").append(UserMessage(text="go", source="t"))
|
||||
inner = RecordingClient()
|
||||
client = BudgetedClient(inner, lambda m: (4096, 1024))
|
||||
roles = RoleMap(executor="m", planner="m", helper="m", expert="m")
|
||||
outcome = LLMExecutor(client, roles, Workspace()).run(
|
||||
store.transcript("t", "executor"), 1
|
||||
outcome = Driver(client, "m").run(
|
||||
store.transcript("t", "driver"),
|
||||
system="s" * 20_000, # a system prompt too big to fit
|
||||
tools=[],
|
||||
workspace=None,
|
||||
)
|
||||
|
||||
assert outcome.status == "escalate"
|
||||
assert outcome.kind == "failed"
|
||||
assert "fit" in outcome.note
|
||||
assert inner.calls == []
|
||||
|
||||
|
||||
Reference in new issue
Block a user