feat: scoping is the first Phase, completed in conversation (iteration 9 step 2)
Some checks failed
validation / verify (push) Failing after 10s

Every Execution now begins by agreeing the scope, before requirements.

- A new Phase and Deliverable, produced by a scope analyst with two tools:
  scope_read shows what is settled and what is not; scope_set records fields
  with where each value came from (the request, the customer's answer, or an
  assumption with its reason). Code checks each value against the catalogue.
- With someone present the analyst asks for what is missing; with nobody
  present it assumes it, visibly. With no spec it drafts one from the request.
  A value the customer stated in the file is changed only by their own answer.
- A submission cannot leave an essential field unknown. Code writes the
  completed spec, the data every later Specialist reads, and the information
  register, from what was recorded.
- The spec's status follows the Execution: under review, approved, then
  locked as a Baseline. A Change request starts from the delivered scope.
- The requirements analyst derives from the agreed scope and no longer asks
  for what it settles.

About 80 tests assumed requirements came first; tests/scoped.py runs scoping
ahead of a test's own script, and tests about order and counts are updated.
Not run with real models.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-11 18:17:32 +01:00
parent afe78640f8
commit 545097530b
38 changed files with 1054 additions and 123 deletions

View File

@@ -10,11 +10,13 @@ import pytest
from langgraph.checkpoint.memory import InMemorySaver
from langgraph.checkpoint.sqlite.aio import AsyncSqliteSaver
from app.adk.fake_runtime import Call, FakeAgentRuntime, sample_submission
from app.adk.fake_runtime import Call, sample_submission
from app.adk.runtime import RoleSpec, ToolResult, ToolSpec
from app.agent import ExecutionEngine
from app.recorder import InMemoryRecorder
from app.workflows.deliverables import DEPENDENCY_GRAPH, DeliverableKind, PhaseId
from tests.scoped import ScopedEngine
from tests.scoped import ScopedRuntime as FakeAgentRuntime
K = DeliverableKind
P = PhaseId
@@ -71,7 +73,7 @@ def make_engine(tmp_path: Path, runtime, **overrides) -> ExecutionEngine:
"output_root": tmp_path,
}
options.update(overrides)
return ExecutionEngine(**options)
return ScopedEngine(**options)
def happy_path_turns(**extra_specialist_turns) -> dict:
@@ -132,7 +134,7 @@ async def test_pre_approved_execution_completes_and_writes_deliverables(tmp_path
assert recorder.statuses[result.execution_id][-1]["status"] == "completed"
assert {s["kind"] for s in recorder.submissions[result.execution_id]} == set(K)
recorded_types = [e.type for e in recorder.events[result.execution_id]]
assert recorded_types.count("approved") == 5
assert recorded_types.count("approved") == 6 # scoping, then the five after it
async def test_independent_specialists_run_together_between_orchestrator_turns(
@@ -161,6 +163,7 @@ async def test_specialist_receives_its_dependencies_content(tmp_path):
)
dependencies = describer_run.task.context["dependencies"]
assert list(dependencies) == [
"scope",
"requirements",
"technical_decomposition",
"product_selection",
@@ -718,7 +721,7 @@ async def test_pre_approved_questions_use_matching_scripted_answers(tmp_path):
]
}
)
engine = make_engine(tmp_path, runtime, max_orchestrator_turns=2)
engine = make_engine(tmp_path, runtime, max_orchestrator_turns=3)
result = await engine.start(
"Ingestion",