feat: Change requests against a Baseline (ADR-0006)

A caller restates a request to say how requirements have changed, naming a
completed Execution of the same Customer case as the Baseline.

- app/baseline.py reads a Baseline from its files and refuses one that
  does not exist, did not complete or belongs to another case, before
  anything runs or is recorded. A Baseline is never modified.
- Requirements carry a change (unchanged, added, changed, removed) and a
  reason. Submission is refused when a Baseline requirement disappears, an
  id is reused, or an unchanged requirement's text differs. A removed
  requirement stays on record and asks nothing downstream.
- Each Specialist starts from its delivered version; the graph and the code
  are its working copy, and the description is carried over when the
  design's shape is the same.
- app/workflows/changes.py compares versions by id and traces what each
  changed requirement reaches; anything else that changed is listed as
  unrequested. Approvals show the change for their Phase, and changes.json
  is written with the full Deliverables.
- Intake no longer starts a message read as a change: it names the
  Execution to give as the Baseline.
- A fifth evaluation case runs a request and then a change to it, with
  four checks that the change is recorded, reaches Checks, stays contained
  and costs less than its Baseline.

Tested with scripted agents only; no Change request has run with real
models.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-09 11:38:15 +01:00
parent db28d02f56
commit 5ef434d00e
32 changed files with 1824 additions and 40 deletions

View File

@@ -32,6 +32,7 @@ from app.adk.runtime import (
SubmissionReview,
ToolFactory,
)
from app.baseline import load_baseline
from app.checkpointing import open_checkpointer
from app.config import Settings
from app.customer_case import record_intent
@@ -125,13 +126,25 @@ class ExecutionEngine:
allow_cloud_read: bool | None = None,
execution_id: str | None = None,
scripted_answers: Sequence[Sequence[str]] = (),
baseline: str | None = None,
) -> Interaction:
"""Start an Execution. `scripted_answers` are (regex, answer[, asker]) entries a
pre-approved Execution uses to answer questions, for evaluation runs."""
pre-approved Execution uses to answer questions, for evaluation runs.
`baseline` names a completed Execution of the same Customer case and makes
this a Change request (ADR-0006): the request says what has changed, and the
Execution starts from that Baseline's Deliverables. It is refused, before
anything runs or is recorded, when the Baseline cannot be one.
"""
customer_case = check_customer_case(customer_case)
execution_id = execution_id or str(uuid.uuid4())
if await self._exists(execution_id):
raise ValueError(f"Execution {execution_id} already exists")
loaded = (
load_baseline(self._output_root, customer_case, baseline)
if baseline
else None
)
if pre_approved and allow_cloud_read is None:
allow_cloud_read = False
session_id = session_id or str(uuid.uuid4())
@@ -141,6 +154,7 @@ class ExecutionEngine:
execution_id=execution_id,
session_id=session_id,
workflow_request=workflow_request,
baseline=baseline or None,
)
initial: dict[str, Any] = {
"execution_id": execution_id,
@@ -148,6 +162,8 @@ class ExecutionEngine:
"customer_case": customer_case,
"intent_version": intent_version,
"workflow_request": workflow_request,
# The Baseline of a Change request, as read from its files; else None.
"baseline": loaded,
"pre_approved": pre_approved,
"allow_cloud_read": allow_cloud_read,
"ledger": Ledger(