Answer the prose review's first round
This commit is contained in:
@@ -47,7 +47,7 @@ def mirror(source: pathlib.Path, dest: pathlib.Path) -> Failure | None:
|
||||
return None
|
||||
|
||||
|
||||
# Every chunk of a project reuses its session id, so a name can recur with other content: only a file that grew from its copy replaces it.
|
||||
# Every chunk of a project reuses its session id, so an earlier chunk's file can share a name with this one's.
|
||||
def copy_for(copy: pathlib.Path, data: bytes) -> pathlib.Path | None:
|
||||
if not copy.is_file():
|
||||
return copy
|
||||
|
||||
@@ -45,7 +45,7 @@ def run_cycle(cycle: Cycle) -> Stop | None:
|
||||
def stopped(cycle: Cycle, stop: Stop) -> Stop:
|
||||
path = transcript_file(cycle.session)
|
||||
failure = archive(cycle.project_key, path, f"Task: {cycle.task}\n\nStopped: {'Ctrl-C' if stop.code == 130 else stop.reason}", cycle.paths) if path else None
|
||||
# A stop for a failed archive has just failed the same way again.
|
||||
# When the stop is itself a failed archive, archiving again fails the same way: say it once.
|
||||
return Stop(1, f"{failure.reason}\n{stop.reason}".rstrip()) if failure and failure.reason != stop.reason else stop
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ def rule(cycle: Cycle, transcript_path: str) -> Ruled | Stop:
|
||||
|
||||
|
||||
def ask(cycle: Cycle, transcript_path: str, question: str) -> Answered | Stop:
|
||||
# Archived before the interrupt appends to the transcript, so the copy carries the question beside it.
|
||||
# Archived now, so the transcript the question was asked on is kept with it; the interrupt appends the answer.
|
||||
if failure := archive(cycle.project_key, transcript_path, f"Task: {cycle.task}\n\nVerdict: interrupt\n\n{question}", cycle.paths):
|
||||
return Stop(1, failure.reason)
|
||||
return interrupt(cycle.root, cycle.session.id, cycle.models.worker, transcript_path, question, cycle.paths, cycle.effects) or Answered()
|
||||
|
||||
Reference in New Issue
Block a user