nisse-review: read long files in parts; a retry starts afresh
CI / checks (push) Skipped
CI / checks (pull_request) Successful in 1m51s
CI / e2e (pull_request) Successful in 4m38s

From its failed review of #156: read_file stopped at 20,000 characters
with no way on, so the reviewer hunted each file's end a definition at a
time and ran out of turns; its retry carried every read before it, and a
model call timed out. Both drafts were lost.

- read_file takes a start line and says where the next part starts.
- Each run's view starts at its brief (Transcript.since); the log keeps
  the rest.
- A run out of turns with points drafted posts them as a partial review.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J5Utyfzw7gF7UhjRDEtjTk
This commit is contained in:
dongarandClaude Opus 5.5 committed 2026-10-17 06:48:47 +00:00
1 parent 082631eafe
commit 1a7836167d
7 files changed
+141 -12

No files matched your search

+12 -2
View File
@@ -554,10 +554,13 @@ class Transcript:
nor write without attribution.
"""
def __init__(self, store: StateStore, work_item: str | None, actor: str) -> None:
def __init__(
self, store: StateStore, work_item: str | None, actor: str, start: int = 0
) -> None:
self._store = store
self.work_item = work_item
self.actor = actor
self._start = start # the view begins after this event (``since``)
def append(self, event: CanonicalEvent) -> int:
"""Committed and fsynced before return, like every durable write."""
@@ -570,7 +573,14 @@ class Transcript:
def view(self, after: int = 0) -> list[StoredEvent]:
"""The log as this actor is shown it: what a model's context is
built from (L6). See ``views``."""
return project(self.read(after), self.actor, self._store.SHOWN)
return project(
self.read(max(after, self._start)), self.actor, self._store.SHOWN
)
def since(self, event_id: int) -> "Transcript":
"""The same transcript, its view starting after ``event_id``: a run
that starts afresh, while the log keeps everything before it."""
return Transcript(self._store, self.work_item, self.actor, event_id)
def as_actor(self, actor: str) -> "Transcript":
"""The same work item, written by another role: e.g. the executor
+14
View File
@@ -121,3 +121,17 @@ def test_newer_schema_is_refused(db: Path) -> None:
pass
with pytest.raises(StateSchemaError, match="newer"):
StateStore(db, schema_version=1)
def test_a_transcript_since_an_event_views_only_what_follows(tmp_path: Path) -> None:
from nisse_core.log.canonical import Fact
with StateStore(tmp_path / "s.db") as store:
store.open_work_item("w", title="t", scope="r", position="p", cause="t")
whole = store.transcript("w", "orchestrator")
first = whole.append(Fact(text="the failed attempt"))
whole.append(Fact(text="the retry's brief"))
fresh = whole.since(first)
assert [e.event.text for e in fresh.view()] == ["the retry's brief"]
assert len(fresh.read()) == 2 # the log keeps everything
assert len(whole.view()) == 2