Unify labels, byte units, snapshot numbers and spelling

This commit is contained in:
Ian Gulliver
2026-10-23 10:33:47 -07:00
parent 68e0cc3063
commit eba85a6a1a
27 changed files with 54 additions and 65 deletions
+1 -1
View File
@@ -52,7 +52,7 @@ func (m *Manager) MergeAfterReview(ctx context.Context, task api.Task, user api.
}
}
if reviewID == "" {
return api.Task{}, fmt.Errorf("%w: the review of snapshot %d of task %s isn't running", ErrConflict, latest.N, task.Id)
return api.Task{}, fmt.Errorf("%w: the review of snapshot #%d of task %s isn't running", ErrConflict, latest.N, task.Id)
}
if target == api.MergeTargetMain && title != task.MergeTitle {
+1 -1
View File
@@ -108,6 +108,6 @@ func (m *Manager) auditError(ctx context.Context, task api.Task, msg string) {
func auditBrief(branch, commit string) string {
return fmt.Sprintf("Audit of %s at %s. This isn't a review of a change: check the whole codebase as it stands against the project's standards and expectations, and fix what falls short. "+
"byre runs this task in the background: the human doesn't see it until you ask a question, call ready_for_merge or hit an error. "+
"Finish your stage with finish_stage as usual, even when you found nothing. Once your stage has finished and its review has come back, byre asks whether the task is ready to merge;"+
"Finish your stage with finish_stage as usual, even when you found nothing. Once your stage has finished and its review has come back, byre asks whether the task is ready to merge; "+
"if nothing needed changing, answer with suggest_discard.", branch, commit)
}
+3 -3
View File
@@ -24,7 +24,7 @@ func forkOrigin(t api.Task, from string) string {
if t.ForkedAt == nil {
return "continued from " + from
}
return fmt.Sprintf("forked from %s at snapshot %d", from, *t.ForkedAt)
return fmt.Sprintf("forked from %s at snapshot #%d", from, *t.ForkedAt)
}
func forkTitle(src api.Task, n int) string {
@@ -169,7 +169,7 @@ func (m *Manager) fork(ctx context.Context, src api.Task, project api.Project, n
return api.Task{}, "", err
}
if srcSess.Vendor == api.Antigravity {
return api.Task{}, "", fmt.Errorf("%w: snapshot %d of task %s is from an Antigravity session, and agy can't fork a conversation", ErrConflict, n, src.Id)
return api.Task{}, "", fmt.Errorf("%w: snapshot #%d of task %s is from an Antigravity session, and agy can't fork a conversation", ErrConflict, n, src.Id)
}
events, err := m.store.ForkEvents(ctx, src.Id, srcSess.Id)
if err != nil {
@@ -177,7 +177,7 @@ func (m *Manager) fork(ctx context.Context, src api.Task, project api.Project, n
}
at := forkPoint(events, snap.AgentSessionId, snap.EventSeq)
if at == "" {
return api.Task{}, "", fmt.Errorf("%w: snapshot %d of task %s has no recorded agent message at or before it to fork the conversation from", ErrConflict, n, src.Id)
return api.Task{}, "", fmt.Errorf("%w: snapshot #%d of task %s has no recorded agent message at or before it to fork the conversation from", ErrConflict, n, src.Id)
}
return m.forkSession(ctx, project, api.Task{
+1 -1
View File
@@ -154,7 +154,7 @@ func forkGuidance(task, src api.Task) string {
"Everything before this point happened in %s, which no longer exists: from now on read and change files only in %s, and use paths under it.",
src.Title, outcome, task.Branch, task.WorktreePath, src.WorktreePath, task.WorktreePath)
}
return fmt.Sprintf("\n- This conversation was forked from byre task %q at its snapshot %d, into a task of its own: branch %s, worktree %s, which held that snapshot's files when the fork was made. "+
return fmt.Sprintf("\n- This conversation was forked from byre task %q at its snapshot #%d, into a task of its own: branch %s, worktree %s, which held that snapshot's files when the fork was made. "+
"Everything before the fork happened in %s, which belongs to the other task: from now on read and change files only in %s, never in the other worktree, and use paths under it.",
src.Title, *task.ForkedAt, task.Branch, task.WorktreePath, src.WorktreePath, task.WorktreePath)
}
@@ -1,3 +1,5 @@
The fields of a workflow's definition, the object save_workflow takes and read_workflow returns: steps (stage, order, parallel, random), auto_merge and auto_discard, and how stages pass outputs along and branch.
# Workflow definitions
A workflow's definition is an object: an optional `description`, optional `auto_merge` and `auto_discard` booleans, then `steps`, which run in order. With `auto_merge`, when a stage task of a run calls `ready_for_merge`, byre merges it right away as the creator of the run, pressing the button the agent picked (`complete` or `continue`); with `auto_discard`, byre discards a stage task that calls `suggest_discard`. Without them the human decides, as for any task. The workflow's name is not in it. `save_workflow` takes it as its `definition` argument and `read_workflow` returns it, both as JSON. Unknown fields are refused.
+3 -3
View File
@@ -380,7 +380,7 @@ func (m *Manager) Observe(events []api.Event) {
go m.audit(*ev.ProjectId)
}
switch ev.Kind {
case "inbox.created", "inbox.updated", "task.created", "task.merge_queued", "task.merge_after_review", "task.merge_after_review_cancelled", "task.merge_after_review_dropped", "task.merge_started", "task.merged", "task.discarded", "turn.ended", "task.workflow_stage", "task.workflow_finished", "review.started", "review.finished", "task.state", "task.ready", "task.discard_suggested":
case "inbox.created", "inbox.updated", "task.created", "task.merge_queued", "task.merge_after_review", "task.merge_after_review_canceled", "task.merge_after_review_dropped", "task.merge_started", "task.merged", "task.discarded", "turn.ended", "task.workflow_stage", "task.workflow_finished", "review.started", "review.finished", "task.state", "task.ready", "task.discard_suggested":
case "task.ready_cleared":
if ev.Payload["reason"] == "merge" || ev.Payload["reason"] == "discard" {
continue
@@ -605,9 +605,9 @@ func (m *Manager) signalText(ctx context.Context, ev api.Event) (string, error)
return fmt.Sprintf("%s's merge was requested by %s and is held until the merge in progress in its project is done.", m.taskLabel(ctx, deref(ev.TaskId)), ev.Actor), nil
case "task.merge_after_review":
return fmt.Sprintf("%s was set by %s to merge once the reviews of snapshot %v finish with no findings.", m.taskLabel(ctx, deref(ev.TaskId)), ev.Actor, ev.Payload["snapshot_n"]), nil
return fmt.Sprintf("%s was set by %s to merge once the reviews of snapshot #%v finish with no findings.", m.taskLabel(ctx, deref(ev.TaskId)), ev.Actor, ev.Payload["snapshot_n"]), nil
case "task.merge_after_review_cancelled":
case "task.merge_after_review_canceled":
return fmt.Sprintf("%s's merge after review was canceled by %s.", m.taskLabel(ctx, deref(ev.TaskId)), ev.Actor), nil
case "task.merge_after_review_dropped":
+2 -2
View File
@@ -1092,8 +1092,8 @@ func transcriptLine(ev api.Event, root string) string {
case "task.merge_queued":
return fmt.Sprintf("merge held, requested by %s", ev.Actor)
case "task.merge_after_review":
return fmt.Sprintf("set by %s to merge after the review of snapshot %s", ev.Actor, text("snapshot_n"))
case "task.merge_after_review_cancelled":
return fmt.Sprintf("set by %s to merge after the review of snapshot #%s", ev.Actor, text("snapshot_n"))
case "task.merge_after_review_canceled":
return fmt.Sprintf("merge after review canceled by %s", ev.Actor)
case "task.merge_after_review_dropped":
return "didn't merge after the review: " + clip(text("reason"), 300)
+8 -8
View File
@@ -121,7 +121,7 @@ func (m *Manager) beginReviews(ctx context.Context, ref store.SnapshotRef) error
}
changes, err := git.Compare(ctx, project.RepoPath, project.DefaultBranch, snap.CommitSha, snap.TreeSha, "")
if err != nil {
return finished(api.ReviewStateFailed, project.ReviewWorkflow, fmt.Sprintf("byre couldn't compare snapshot %d with %s: %v", snap.N, project.DefaultBranch, err))
return finished(api.ReviewStateFailed, project.ReviewWorkflow, fmt.Sprintf("byre couldn't compare snapshot #%d with %s: %v", snap.N, project.DefaultBranch, err))
}
if len(changes.Files) == 0 {
slog.Info("review skipped, snapshot has no diff", "task", task.Id, "snapshot", snap.N)
@@ -243,7 +243,7 @@ func (m *Manager) reviewPrompt(ctx context.Context, task api.Task, project api.P
b := &strings.Builder{}
fmt.Fprintf(b, "Review the work of the agent on the byre task %q, as reviewer %q of the project's review workflow %q.\n\n%s\n\n", task.Title, stage, project.ReviewWorkflow, strings.TrimSpace(workflow.Get(def, stage).Prompt))
fmt.Fprintf(b, "It is snapshot %d of the task, commit %s, checked out in your working directory. The change is all of the task's work, `git diff %s %s` (from the merge-base with %s); %d files changed:\n",
fmt.Fprintf(b, "It is snapshot #%d of the task, commit %s, checked out in your working directory. The change is all of the task's work, `git diff %s %s` (from the merge-base with %s); %d files changed:\n",
snap.N, snap.CommitSha, changes.Base, snap.CommitSha, project.DefaultBranch, len(changes.Files))
for i, f := range changes.Files {
if i == maxReviewFiles {
@@ -425,7 +425,7 @@ func findingsMessage(n int, reviews []api.Review) string {
return ""
}
return fmt.Sprintf(findingsPreamble+"%d of your work has finished, and its reviewers raised the findings below. Reviewers can be wrong or miss context: check each one against the code and your brief. "+
"Before you change anything, answer each finding with respond_to_finding (snapshot %d, the reviewer's name and the finding's number): fixing if it holds up and you'll act on it, ignoring with your reason if you're leaving it. "+
"Before you change anything, answer each finding with respond_to_finding (snapshot #%d, the reviewer's name and the finding's number): fixing if it holds up and you'll act on it, ignoring with your reason if you're leaving it. "+
"The human sees your answers on the findings and can overrule an ignore.", n, n) + b.String()
}
@@ -480,16 +480,16 @@ func (m *Manager) respondToFindingTool(l *live) mcp.Tool {
}
}
if reviewID == "" {
return "", fmt.Errorf("%w: snapshot %d has no finished review by reviewer %q", ErrInvalid, args.Snapshot, args.Reviewer)
return "", fmt.Errorf("%w: snapshot #%d has no finished review by reviewer %q", ErrInvalid, args.Snapshot, args.Reviewer)
}
err = m.store.SetFindingResponse(ctx, reviewID, args.Finding-1, api.FindingResponse{Response: args.Response, Reason: reason}, agentActor)
if errors.Is(err, store.ErrNotFound) {
return "", fmt.Errorf("%w: reviewer %q's review of snapshot %d has no finding %d", ErrInvalid, args.Reviewer, args.Snapshot, args.Finding)
return "", fmt.Errorf("%w: reviewer %q's review of snapshot #%d has no finding %d", ErrInvalid, args.Reviewer, args.Snapshot, args.Finding)
}
if err != nil {
return "", err
}
return fmt.Sprintf("Recorded: %s finding %d of reviewer %q's review of snapshot %d.", args.Response, args.Finding, args.Reviewer, args.Snapshot), nil
return fmt.Sprintf("Recorded: %s finding %d of reviewer %q's review of snapshot #%d.", args.Response, args.Finding, args.Reviewer, args.Snapshot), nil
},
}
}
@@ -671,9 +671,9 @@ func (m *Manager) stopStuckReviewers(ctx context.Context, h Health) {
func reviewName(r api.Review) string {
if r.Stage == "" {
return fmt.Sprintf("review of snapshot %d", r.SnapshotN)
return fmt.Sprintf("review of snapshot #%d", r.SnapshotN)
}
return fmt.Sprintf("%q review of snapshot %d", r.Stage, r.SnapshotN)
return fmt.Sprintf("%q review of snapshot #%d", r.Stage, r.SnapshotN)
}
func reviewLine(r api.Review) string {
+1 -1
View File
@@ -152,7 +152,7 @@ func (m *Manager) takeSnapshot(ctx context.Context, t snapTarget, trigger api.Sn
}
n := last.N + 1
commit, err := git.CommitSnapshot(ctx, t.dir, tree, git.SnapshotRef(t.taskID, n), fmt.Sprintf("byre snapshot %d (%s)", n, trigger), git.IdentityEnv(t.gitName, t.gitEmail))
commit, err := git.CommitSnapshot(ctx, t.dir, tree, git.SnapshotRef(t.taskID, n), fmt.Sprintf("byre snapshot #%d (%s)", n, trigger), git.IdentityEnv(t.gitName, t.gitEmail))
if err != nil {
return nil, err
}
+1 -1
View File
@@ -119,7 +119,7 @@ func teamGuidance(sessions []api.AgentSession, member string, stage bool) string
lead := teamLead(sessions)
g := fmt.Sprintf("\n- This task is worked by a team of agents in this one worktree: %s. You are %q. "+
"The team talks through a shared board: post_to_board sends a post to every other agent (a working agent gets it after its next tool call; an idle one starts a turn with it), and read_board reads the posts so far. "+
"The human and the lead post there too. Post only when you add something: a finding, a proposal, an objection, a decision, a request. Don't post acknowledgements or thanks, since every post wakes every other agent. "+
"The human and the lead post there too. Post only when you add something: a finding, a proposal, an objection, a decision, a request. Don't post acknowledgments or thanks, since every post wakes every other agent. "+
"Your final message goes to the human, not to the team. The other agents change the same files: re-read a file before you edit it, and say on the board when you take on a file or an area.",
strings.Join(names, ", "), member)
if !stage {
@@ -0,0 +1 @@
UPDATE events SET kind = 'task.merge_after_review_canceled' WHERE kind = 'task.merge_after_review_cancelled';
+1 -1
View File
@@ -121,7 +121,7 @@ func readyPrompts(ctx context.Context, tx *sql.Tx, emit emitFunc) ([]ReadyPrompt
for _, r := range reviews {
if r.State == api.ReviewStateFailed && c.background {
err = emit(api.Event{Kind: "session.error", ProjectId: &c.projectID, TaskId: &c.TaskID, Actor: "byre", Payload: map[string]any{
"error": fmt.Sprintf("Review %q of snapshot %d failed: %s. The audit can't go on without you.", r.Stage, c.Snapshot, r.Error),
"error": fmt.Sprintf("Review %q of snapshot #%d failed: %s. The audit can't go on without you.", r.Stage, c.Snapshot, r.Error),
}})
if err != nil {
return nil, err
+1 -1
View File
@@ -137,7 +137,7 @@ func endReviews(ctx context.Context, tx *sql.Tx, emit emitFunc) ([]EndedReviewer
case !r.active:
reason = "the task was closed"
case r.n < r.current:
reason = fmt.Sprintf("superseded by snapshot %d", r.current)
reason = fmt.Sprintf("superseded by snapshot #%d", r.current)
case r.state != string(api.AgentSessionStateRunning):
reason = "the reviewer stopped before submitting a review"
default:
+1 -1
View File
@@ -687,7 +687,7 @@ func (s *Store) CancelMergeAfterReview(ctx context.Context, id, actor string) er
if err != nil {
return err
}
return emit(api.Event{Kind: "task.merge_after_review_cancelled", ProjectId: &projectID, TaskId: &id, Actor: actor, Payload: map[string]any{"id": id}})
return emit(api.Event{Kind: "task.merge_after_review_canceled", ProjectId: &projectID, TaskId: &id, Actor: actor, Payload: map[string]any{"id": id}})
})
}