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:
@@ -5,8 +5,10 @@ Execution's prompt. Approvals and permissions count only as structured data part
|
||||
never as free text.
|
||||
|
||||
Before a new task starts anything its message is read (app/nodes/intake.py): a
|
||||
question is answered and starts nothing, and a change to delivered work is started
|
||||
as a new request with a note saying so, until Change requests are built.
|
||||
question is answered and starts nothing. A message that reads as a change to
|
||||
delivered work also starts nothing: the caller is told which Execution it would
|
||||
change and how to name it as the Baseline, because a Change request never starts
|
||||
from earlier work on a guess (ADR-0006).
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -29,7 +31,7 @@ from google.protobuf import json_format
|
||||
|
||||
from app.agent import ExecutionEngine, Interaction
|
||||
from app.nodes.execution_nodes import GUIDE_FILENAME
|
||||
from app.nodes.intake import ABOUT, CHANGE_NOTE, CHANGE_REQUEST, QUESTION, Intake
|
||||
from app.nodes.intake import ABOUT, CHANGE_REQUEST, QUESTION, Intake, change_note
|
||||
from app.presentation import describe_prompt
|
||||
from app.workflows.deliverables import DeliverableKind
|
||||
|
||||
@@ -47,7 +49,6 @@ class SolutionArchitectExecutor(AgentExecutor):
|
||||
task_id = context.task_id or ""
|
||||
updater = TaskUpdater(event_queue, task_id, context.context_id or "")
|
||||
new = context.current_task is None
|
||||
note: str | None = None
|
||||
try:
|
||||
if new:
|
||||
history = [context.message] if context.message is not None else []
|
||||
@@ -62,7 +63,12 @@ class SolutionArchitectExecutor(AgentExecutor):
|
||||
await updater.start_work()
|
||||
options = _options(context)
|
||||
# A pre-approved caller is a batch job: it sends work, not questions.
|
||||
if self._intake and not options.get("pre_approved"):
|
||||
if (
|
||||
self._intake
|
||||
and not options.get("pre_approved")
|
||||
and not options.get("baseline")
|
||||
and not options.get("new_request")
|
||||
):
|
||||
reading = await self._intake.read(
|
||||
context.get_user_input(),
|
||||
options.get("customer_case"),
|
||||
@@ -80,12 +86,27 @@ class SolutionArchitectExecutor(AgentExecutor):
|
||||
)
|
||||
)
|
||||
return
|
||||
if reading.kind == CHANGE_REQUEST:
|
||||
note = CHANGE_NOTE
|
||||
if reading.kind == CHANGE_REQUEST and reading.latest:
|
||||
await updater.complete(
|
||||
updater.new_agent_message(
|
||||
[
|
||||
new_text_part(change_note(reading.latest)),
|
||||
new_data_part(
|
||||
{
|
||||
"status": "answered",
|
||||
"intake": CHANGE_REQUEST,
|
||||
"baseline": reading.latest,
|
||||
}
|
||||
),
|
||||
]
|
||||
)
|
||||
)
|
||||
return
|
||||
interaction = await self._engine.start(
|
||||
context.get_user_input(),
|
||||
session_id=context.context_id,
|
||||
customer_case=options.get("customer_case"),
|
||||
baseline=options.get("baseline"),
|
||||
execution_id=task_id,
|
||||
pre_approved=bool(options.get("pre_approved", False)),
|
||||
allow_cloud_read=options.get("allow_cloud_read"),
|
||||
@@ -105,7 +126,7 @@ class SolutionArchitectExecutor(AgentExecutor):
|
||||
)
|
||||
)
|
||||
return
|
||||
await self._publish(interaction, updater, note if new else None)
|
||||
await self._publish(interaction, updater)
|
||||
|
||||
async def cancel(self, context: RequestContext, event_queue: EventQueue) -> None:
|
||||
# The checkpoint stays; cancelling only ends the A2A task.
|
||||
@@ -114,15 +135,12 @@ class SolutionArchitectExecutor(AgentExecutor):
|
||||
)
|
||||
await updater.cancel()
|
||||
|
||||
async def _publish(
|
||||
self, interaction: Interaction, updater: TaskUpdater, note: str | None = None
|
||||
) -> None:
|
||||
async def _publish(self, interaction: Interaction, updater: TaskUpdater) -> None:
|
||||
if interaction.status == "awaiting_user" and interaction.prompt is not None:
|
||||
prompt = dict(interaction.prompt)
|
||||
await updater.requires_input(
|
||||
updater.new_agent_message(
|
||||
[
|
||||
*([new_text_part(note)] if note else []),
|
||||
new_text_part(describe_prompt(prompt)),
|
||||
new_data_part({"prompt": prompt}),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user