Give each role its own view of the transcript (M1.2)
CI / checks (push) Skipped
CI / checks (pull_request) Successful in 1m27s
CI / checks (push) Skipped
CI / checks (pull_request) Successful in 1m27s
A model no longer reads another role's turns as its own (#78). The log stays one record per work item; what a role is shown is projected from it by Transcript.view() (views.py), which the planner, executor and helper now build their context from: - own events unchanged; - operator messages labelled with their channel, e.g. [operator, Matrix] or [operator, comment on PR #165]; - orchestrator facts (a new `fact` event) as [orchestrator] statements; - the executor sees a helper's handback as [helper report], not its turns; - a helper sees the approved plan and the executor's milestone work as one-line narration; - the planner sees no other role's work at all. The orchestrator now writes facts at the points the models must know about: work item opened, plan approved or rejected, milestone started, finished or stopped, published (with PR number and URL) or not, review comment answered, next milestone, task completed or abandoned. 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
51e144e26b
commit
3fba958958
15 files changed
+517
-13
No files matched your search
@@ -33,6 +33,7 @@ from nisse_dev.canonical import (
|
||||
AssistantText,
|
||||
DelegationCompleted,
|
||||
DelegationStarted,
|
||||
PlanSubmitted,
|
||||
StoredEvent,
|
||||
ToolCall,
|
||||
ToolResult,
|
||||
@@ -328,6 +329,7 @@ class Delegation:
|
||||
touched: set[str] = set()
|
||||
did_work = False
|
||||
spent = 0
|
||||
after = _plan_scope(transcript)
|
||||
|
||||
for turn in range(self._caps.turns):
|
||||
if self._cancel.requested:
|
||||
@@ -350,7 +352,7 @@ class Delegation:
|
||||
)
|
||||
try:
|
||||
produced = self._client.complete(
|
||||
transcript.read(),
|
||||
transcript.view(after=after),
|
||||
tools=DELEGATE_TOOLS,
|
||||
model=self._model,
|
||||
system=system,
|
||||
@@ -580,6 +582,16 @@ def delegation_verdict(
|
||||
return "resume"
|
||||
|
||||
|
||||
def _plan_scope(transcript: Transcript) -> int:
|
||||
"""Where the helper's view begins: at the approved plan the work is under,
|
||||
so it sees the plan and this milestone, not earlier ones (L6)."""
|
||||
latest = 0
|
||||
for stored in transcript.read():
|
||||
if isinstance(stored.event, PlanSubmitted):
|
||||
latest = stored.id
|
||||
return max(latest - 1, 0)
|
||||
|
||||
|
||||
def _completed_after_start(events: list[StoredEvent]) -> bool:
|
||||
"""True when the last delegation event in the log is a completion."""
|
||||
for stored in reversed(events):
|
||||
|
||||
Reference in new issue
Block a user