Protocol 31: keep timed-out work only for an instance that knows it
Astra round 1 on the branch (two P1, three P2): - P1: a new runner pushed a timed-out step's work to an older instance, which drops step_timeout on a done step and would take the work for finished. Protocol 31 (ProtocolUnfinishedWork) says the instance knows unfinished work; the runner keeps a timed-out step's work only when the instance speaks it now, and otherwise fails step_timeout as before. No frame changes shape. - P1: the person's Retry of a failed push (a republish) published the timed-out commit as finished. How an Engineering commit finished is now its phase (committed_unfinished, committed_no_shell), which stays on the attempt's row; a republish takes it from the attempt it publishes, and a restart before the push reads it too. - P2: a fix round without a working shell lost its mark on a restart or republish: it is the same phase now. - P2: a Copy commit on top of unfinished work hid the mark from Review: the candidate carries it through Copy commits. - P2: many long unit names could crowd whole units out of the feedback: every unit is named before any log takes a share, and a unit named in the CI output is not listed again. The size budget records grow to what the branch measures.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
24 files changed,
+254
−70
.rastrillo/budgets.txt+5 −5internal/equipo/chat/review.go+16 −8internal/equipo/chat/unfinished_test.go+30 −0internal/runner/thin/engineer.go+40 −22internal/runner/thin/engineer_time_test.go+55 −1internal/runner/thin/judge_hosted_test.go+24 −0internal/runner/thin/run.go+1 −1internal/runner/thin/step.go+31 −4internal/thintest/hosted_checks_contract_test.go+1 −1internal/thintest/triage_contract_test.go+1 −1internal/wire/assistant_test.go+1 −1internal/wire/cilogs.go+28 −13internal/wire/injection_test.go+2 −2internal/wire/mixed_protocol_test.go+1 −1internal/wire/models_test.go+1 −1internal/wire/opencode_test.go+1 −1internal/wire/pinned_release_test.go+1 −1internal/wire/publish_test.go+1 −1internal/wire/runners.go+9 −1internal/wire/runners_test.go+1 −1internal/wire/schedule_test.go+1 −1internal/wire/stuck_test.go+1 −1internal/wire/usage_test.go+1 −1internal/wire/warm_test.go+1 −1
diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt| index 593a3a01..dae31c67 100644 |
| --- a/.rastrillo/budgets.txt |
| +++ b/.rastrillo/budgets.txt |
| @@ -14,8 +14,8 @@ perf GET /* skip Unknown private paths render 404; this fallback contains no scr |
| time internal/equipo/team 60s Plan 3 loaded CI measured 45.985s; niced serial reruns measured 18.079s and 22.031s. Keep migration, recovery, accounting and concurrency assertions; 60s leaves 30 percent headroom above loaded CI. |
| time internal/equipotest 300s Final fix package rerun measured 187.035s (review 172.4s); 300s gives 60 percent headroom for HTTP, sandbox, authority and final regression coverage. |
| -size internal/equipo 22615 - Stuck tasks' Retry and timeline (2026-11-25), merge_credential copy (2026-11-26), no-access merges ask no retry (2026-11-26); measured 22615 source lines. |
| -size internal/wire 7088 - Native task evidence fields, merge_credential and amadan_unreachable reasons (2026-11-26); measured 7088 source lines. |
| +size internal/equipo 22616 - Stuck tasks, merge_credential copy, no-access merges (2026-11-26); a timed-out step's pushed work on the timeline (2026-11-26); measured 22616 source lines. |
| +size internal/wire 7268 - Native task evidence, merge reasons (2026-11-26); protocol 31 unfinished work, shell_unavailable, CI unit logs (2026-11-26); measured 7268 source lines. |
| size internal/equipotest - 12017 Task 21 repairs historical migration and conversation fixtures after Plan 3, and the Rastrillo upgrade contract comparing served assets with what Assets serves; measured 0/12017 source/test lines. |
| time internal/runner/checks 90s CI worker measured 44.553s (44.6s rounded); |
| time internal/runner 330s Plan 3 CI repair measured 292.120s for the full package (controller CI 472.184s). |
| @@ -38,7 +38,7 @@ time internal/runner/provider 15s Plan 3 CI repair measured 10.346s for the full |
| perf GET /releases/* skip Verified runner release file downloads, not browser GET screens. |
| perf GET /install.sh skip Mac runners: the one-line bootstrap a terminal pipes to sh, not a browser screen. |
| time internal/runner/containment 15s Plan 3 loaded CI measured 10.817s; |
| -size internal/runner/thin 28724 23336 Protocol 30 scanner health and stuck-task tools, merge credential fallback and write scope (2026-11-26); measured 28724/23336. |
| +size internal/runner/thin 28906 23621 Protocol 30 tools, merge credential (2026-11-26); step limit, kept timed-out work, shell use, CI unit shares (2026-11-26); measured 28906/23621. |
| time internal/thintest 240s Thin contract and page tests, the Assistant's and the models' included, share one harness. Measured 202s on a shared 16 CPU box (2026-11-13); CI runs two lanes. |
| time internal/runner/mac 30s Mac runners (Darwin worker): real process groups killed after a grace and proven gone (SIGTERM, SIGKILL, the marker sweep), and the probes run end to end with fake srt and xcodebuild, P6 killing. |
| time internal/runner/thin 45s Thin v1 slice 4 review: real git repositories for the merge and squash checks, a stalled fetch, and a 16 MiB candidate streamed through the review diff and the checks pack (about 5s). |
| @@ -56,7 +56,7 @@ perf GET /api/v1/tasks/{id} skip Thin v1 person API: bearer-only JSON for device |
| perf GET /api/v1/assistant/snapshot skip Assistant person API: bearer-only JSON for Base's chat, not a browser screen. |
| perf GET /api/v1/assistant/messages skip Assistant person API: bearer-only JSON for Base's chat, not a browser screen. |
| perf GET /api/v1/assistant/events skip Assistant event stream (Server-Sent Events), bearer-only and long-lived; not a screen. |
| -size internal/equipo/chat 34916 9710 Native task hosted projection and stable completion time; no-access merges never invite a retry; measured 34916/9710 (2026-11-26). |
| +size internal/equipo/chat 34975 9740 Native task projection, no-access merges; unfinished candidates, free shell-less rounds, CI unit feedback (2026-11-26); measured 34975/9740. |
| perf GET /api/v1/questions/{id} skip Thin v1 person API: bearer-only JSON for devices; the browser reads questions on /tasks/{id}. |
| perf GET /api/v1/steps/{id}/log skip Thin v1 person API: bearer-only JSON for devices; the browser shows the log tail on /tasks/{id}. |
| perf GET /api/v1/connections/preference skip Connections slice 1 person API: bearer-only JSON for devices; the browser shows the preference on /conversation/connections. |
| @@ -71,7 +71,7 @@ perf GET /tasks/{id}/files/{file} skip Research kept images: the bytes of one im |
| perf GET /api/v1/runners skip Mac runners person API: bearer-only JSON for devices; the browser shows runners in the Team section. |
| time cmd/equipo-runner 60s TestReleaseRunnerHasNoFakeWorker builds the release runner and the thin package under testbuild (about 12s locally). |
| size internal/headless - 11437 Grant scenarios for a named repository (hub #48); the sign-in's account email at 1280 and 390; measured 11437 test lines. |
| -size internal/thintest - 35157 Stuck-task contracts, paused-job fixed-clock coverage, the no-access merge job contract (2026-11-26); measured 35157 test lines. |
| +size internal/thintest - 35342 Stuck-task, paused-job, no-access merge contracts; held retries, unfinished work, shard feedback, free rounds (2026-11-26); measured 35342 test lines. |
| perf GET /api/v1/projects/{id}/merge-policy skip Merge authority person API: bearer-only JSON for devices; the browser reads the policy on /projects/{id}. |
| perf GET /api/v1/usage skip Thin v1 person API: bearer-only JSON for devices; the browser reads usage through /usage. |
diff --git a/internal/equipo/chat/review.go b/internal/equipo/chat/review.go| index c23586cf..d68234c4 100644 |
| --- a/internal/equipo/chat/review.go |
| +++ b/internal/equipo/chat/review.go |
| @@ -41,8 +41,11 @@ type progress struct { |
| // explore: the task is an exploration (progressFor). |
| explore bool |
| // free is how many fix rounds do not count against the task's |
| - // automatic rounds (freeRounds). |
| + // automatic rounds (freeRound). |
| free int |
| + // unfinishedWork: the candidate holds the work of an Engineering step |
| + // that ran out of time, with any Copy commit on top. |
| + unfinishedWork bool |
| } |
| // freeRound: s is a pushed fix round without a working shell |
| @@ -100,6 +103,7 @@ func progressOfKind(steps []stepRecord, kind string) progress { |
| p.eng = s |
| if s.Pushed && s.CandidateSHA != "" { |
| p.candidate, p.checks, p.review, p.merge = s.CandidateSHA, nil, nil, nil |
| + p.unfinishedWork = s.State == wire.StepDone && s.Reason == reasonUnfinished |
| } |
| case wire.SpecialistCopy: |
| if s.State == wire.StepDone && s.Pushed && s.CandidateSHA != "" { |
| @@ -399,12 +403,18 @@ func feedbackBudget(p progress, limit int) string { |
| var h wire.HostedResult |
| _ = json.Unmarshal([]byte(c.HostedCI), &h) |
| fmt.Fprintf(&b, "The repository's hosted CI failed on %s.\n", short(p.candidate)) |
| - if len(h.Failed) > 0 { |
| - for _, failed := range h.Failed { |
| + _, units := wire.SplitCIUnits(c.Output, h.Failed) |
| + logged := map[string]bool{} |
| + for _, u := range units { |
| + logged[u.Name] = true |
| + } |
| + for _, failed := range h.Failed { |
| + // A unit with a log is named in the CI output, once. |
| + if !logged[failed] { |
| writeFeedbackData(&b, limit, "CI failed job", failed) |
| } |
| } |
| - if _, units := wire.SplitCIUnits(c.Output, h.Failed); len(units) > 0 { |
| + if len(units) > 0 { |
| // Every failing unit's share, its failing lines first |
| // (stopped-jobs audit, fix 4: the last lines reached only the |
| // last unit). |
| @@ -498,10 +508,8 @@ func (t *txn) stepBrief(k taskRecord, s stepRecord) (string, error) { |
| const reasonUnfinished = "step_timeout" |
| // unfinished: the candidate is the work of an Engineering step that ran |
| -// out of time before it finished. |
| -func unfinished(p progress) bool { |
| - return p.eng != nil && p.eng.State == wire.StepDone && p.eng.Pushed && p.eng.CandidateSHA == p.candidate && p.eng.Reason == reasonUnfinished |
| -} |
| +// out of time before it finished (a Copy commit on top keeps it so). |
| +func unfinished(p progress) bool { return p.candidate != "" && p.unfinishedWork } |
| // unfinishedReview is Review's part of the brief for such a candidate |
| // (model text, not copy). |
diff --git a/internal/equipo/chat/unfinished_test.go b/internal/equipo/chat/unfinished_test.go| new file mode 100644 |
| index 00000000..ab019ca2 |
| --- /dev/null |
| +++ b/internal/equipo/chat/unfinished_test.go |
| @@ -0,0 +1,30 @@ |
| +package chat |
| + |
| +import ( |
| + "testing" |
| + |
| + "amadan.net/oficina/equipo/internal/wire" |
| +) |
| + |
| +// A candidate is unfinished when the Engineering step that made it ran |
| +// out of time; a Copy commit on top keeps it unfinished (Review is still |
| +// told), and the next Engineering round that finishes clears it. |
| +func TestUnfinishedSurvivesCopy(t *testing.T) { |
| + timedOut := stepRecord{Specialist: wire.SpecialistEngineering, State: wire.StepDone, Pushed: true, CandidateSHA: "eng", Reason: "step_timeout"} |
| + copied := stepRecord{Specialist: wire.SpecialistCopy, State: wire.StepDone, Pushed: true, CandidateSHA: "copy"} |
| + finished := stepRecord{Specialist: wire.SpecialistEngineering, State: wire.StepDone, Pushed: true, CandidateSHA: "fix", Round: 1} |
| + for name, c := range map[string]struct { |
| + steps []stepRecord |
| + want bool |
| + }{ |
| + "timed out": {[]stepRecord{timedOut}, true}, |
| + "copy on top": {[]stepRecord{timedOut, copied}, true}, |
| + "finished after": {[]stepRecord{timedOut, copied, finished}, false}, |
| + "finished": {[]stepRecord{finished}, false}, |
| + "copy on a finished": {[]stepRecord{finished, copied}, false}, |
| + } { |
| + if got := unfinished(progressOf(c.steps)); got != c.want { |
| + t.Errorf("%s: unfinished %v, want %v", name, got, c.want) |
| + } |
| + } |
| +} |
diff --git a/internal/runner/thin/engineer.go b/internal/runner/thin/engineer.go| index 45ac414e..19de3961 100644 |
| --- a/internal/runner/thin/engineer.go |
| +++ b/internal/runner/thin/engineer.go |
| @@ -104,6 +104,8 @@ type Engineer struct { |
| MaxStep time.Duration |
| // Note is appended to the prompt (tests steer the fake CLI with it). |
| Note string |
| + // Spoken is the protocol the instance speaks now (0: not connected). |
| + Spoken func() int |
| // Healthy reports an account binding's last refresh (nil: all are). |
| Healthy func(id string) bool |
| // Conns chooses connections for Engineering and Review (nil: the |
| @@ -171,11 +173,7 @@ func (e *Engineer) Exec(ctx context.Context, r stepRow, progress func(wire.StepR |
| } |
| if committed(r.Phase) { |
| // Only the push was left when the runner stopped. |
| - rep = e.publish(ctx, r, rep) |
| - if r.Phase == phaseCommittedUnfinished && rep.Pushed { |
| - rep.Reason = "step_timeout" |
| - } |
| - return rep |
| + return withCommitReason(e.publish(ctx, r, rep), r.Phase) |
| } |
| if !slices.Contains(e.Owners, r.Person) || !forgekey.ValidHub(r.Repo) || !wire.ValidTaskBranch(r.Branch) || r.Specialist != wire.SpecialistEngineering { |
| return fail("policy_rejected", true) |
| @@ -197,13 +195,21 @@ func (e *Engineer) Exec(ctx context.Context, r stepRow, progress func(wire.StepR |
| // Retry of a failed push: the commit an earlier attempt recorded is |
| // published again; the specialist does not run. |
| if from := e.fromTree(r); from != "" { |
| - if err := e.O.State.setStepPhase(ctx, r, phaseCommitted, r.BaseSHA, r.CandidateSHA); err != nil { |
| + // The commit is published as its attempt finished it: unfinished |
| + // work stays unfinished. |
| + phase := phaseCommitted |
| + if was, err := e.O.State.stepPhase(ctx, r.StepID, r.FromAttempt); err != nil { |
| + return fail("provider_failed", true) |
| + } else if committedReason(was) != "" { |
| + phase = was |
| + } |
| + if err := e.O.State.setStepPhase(ctx, r, phase, r.BaseSHA, r.CandidateSHA); err != nil { |
| return fail("provider_failed", true) |
| } |
| r.Base, r.Candidate = r.BaseSHA, r.CandidateSHA |
| rep.BaseSHA, rep.CandidateSHA = r.Base, r.Candidate |
| progress(rep) |
| - return e.publish(ctx, r, rep) |
| + return withCommitReason(e.publish(ctx, r, rep), phase) |
| } |
| e.log("step republish", errors.New("the recorded commit is gone; running the step again")) |
| } |
| @@ -347,15 +353,21 @@ func (e *Engineer) Exec(ctx context.Context, r stepRow, progress func(wire.StepR |
| // A step that ran out of time keeps what it changed (stopped-jobs |
| // audit, 2026-11-25): committed and pushed under the same rules as a |
| // finished step, and reported done with the reason step_timeout, so |
| - // checks and review judge it and nothing takes it for finished. A |
| - // rebase's half-resolved conflicts are never kept. |
| - unfinished := res.reason == "step_timeout" && !r.Rebase |
| + // checks and review judge it and nothing takes it for finished. Only |
| + // for an instance that knows unfinished work (ProtocolUnfinishedWork); |
| + // a rebase's half-resolved conflicts are never kept. |
| + unfinished := res.reason == "step_timeout" && !r.Rebase && e.keepsUnfinished() |
| if res.reason != "" && !unfinished { |
| return fail(res.reason, true) |
| } |
| message, phase := commitMessage(r, summary), phaseCommitted |
| - if unfinished { |
| + switch { |
| + case unfinished: |
| message, phase = unfinishedMessage(r), phaseCommittedUnfinished |
| + case res.noShell && r.Round >= 1 && !r.Rebase: |
| + // A fix round without a working shell: the instance does not |
| + // count it against the task's rounds. |
| + phase = phaseCommittedNoShell |
| } |
| sha, err := tree.Commit(ctx, message, commitName, commitEmail) |
| switch { |
| @@ -385,21 +397,27 @@ func (e *Engineer) Exec(ctx context.Context, r stepRow, progress func(wire.StepR |
| } |
| r.Base, r.Candidate, rep.CandidateSHA = base, sha, sha |
| progress(rep) |
| - rep = e.publish(ctx, r, rep) |
| - switch { |
| - case !rep.Pushed: |
| - case unfinished: |
| - rep.Reason = res.reason |
| - case res.noShell && r.Round >= 1 && !r.Rebase: |
| - // A fix round without a working shell: the instance does not |
| - // count it against the task's rounds. |
| - rep.Reason = wire.ReasonShellUnavailable |
| - } |
| + rep = withCommitReason(e.publish(ctx, r, rep), phase) |
| // The person can ask Engineering about the change it pushed. |
| rep.Askable = kept && rep.Pushed |
| return rep |
| } |
| +// withCommitReason is a publish's report with the reason its commit's |
| +// phase carries, once pushed. |
| +func withCommitReason(rep wire.StepReport, phase string) wire.StepReport { |
| + if reason := committedReason(phase); reason != "" && rep.Pushed { |
| + rep.Reason = reason |
| + } |
| + return rep |
| +} |
| + |
| +// keepsUnfinished: the instance takes a timed-out step's pushed work as |
| +// unfinished (it speaks ProtocolUnfinishedWork now). |
| +func (e *Engineer) keepsUnfinished() bool { |
| + return e.Spoken != nil && e.Spoken() >= wire.ProtocolUnfinishedWork |
| +} |
| + |
| // refused records a refused attempt (quota: limited; credential: sign |
| // in again), keeps the first switched line, and advances the step to its |
| // next attempt durably with the refused attempt's usage. false: the |
| @@ -639,7 +657,7 @@ const stepEmptyRepo = "The repository has no commits yet, and /workspace is empt |
| // audit, example 2). |
| func (e *Engineer) stepChecks() string { |
| return "Use the read-only Go toolchain at /opt/go and module cache at /opt/go-mod when available. Run targeted tests; the Checks step runs the full gate after you finish, so do not run it here. Stay offline; report missing cached dependencies. For Makefiles that select another Go version, pass GOTOOLCHAIN=local.\n" + |
| - fmt.Sprintf("You have %d minutes for this step, and nothing tells you when they run out: finish and reply well within them. If the step runs out of time, Equipo keeps what you changed as unfinished work.\n", max(1, int(e.maxStep().Round(time.Minute)/time.Minute))) |
| + fmt.Sprintf("You have %d minutes for this step, and nothing tells you when they run out: finish and reply well within them. \n", max(1, int(e.maxStep().Round(time.Minute)/time.Minute))) |
| } |
| // maxStep is one Engineering step's limit. |
diff --git a/internal/runner/thin/engineer_time_test.go b/internal/runner/thin/engineer_time_test.go| index b3e4e612..265317ee 100644 |
| --- a/internal/runner/thin/engineer_time_test.go |
| +++ b/internal/runner/thin/engineer_time_test.go |
| @@ -39,6 +39,7 @@ func TestTimeoutKeepsChanges(t *testing.T) { |
| r := newPiRig(t, fakePiInstall(t), bigBudget) |
| r.urgent() |
| r.e.MaxStep = 3 * time.Second |
| + r.e.Spoken = func() int { return wire.ProtocolUnfinishedWork } |
| remote := r.e.Forge.(*hubForge).dir |
| // The rig's remote names a task branch at HEAD; a hub names main. |
| gitOut(t, remote, "--git-dir="+remote, "symbolic-ref", "HEAD", "refs/heads/main") |
| @@ -57,12 +58,31 @@ func TestTimeoutKeepsChanges(t *testing.T) { |
| r = newPiRig(t, fakePiInstall(t), bigBudget) |
| r.urgent() |
| r.e.MaxStep = 3 * time.Second |
| + r.e.Spoken = func() int { return wire.ProtocolUnfinishedWork } |
| rep = r.engineering("tk2", "e2", "nothing to do sleep:60000") |
| if rep.State != wire.StepFailed || rep.Reason != "step_timeout" || rep.Pushed || rep.CandidateSHA != "" { |
| t.Fatalf("timed out with nothing: %+v", rep) |
| } |
| } |
| +// An instance that does not know unfinished work (below |
| +// ProtocolUnfinishedWork), or none connected, would take the pushed work |
| +// for finished: the step fails step_timeout as before and pushes nothing. |
| +func TestTimeoutKeepsNothingForAnOlderInstance(t *testing.T) { |
| + for _, spoken := range []int{0, wire.ProtocolStuckTasks} { |
| + r := newPiRig(t, fakePiInstall(t), bigBudget) |
| + r.urgent() |
| + r.e.MaxStep = 3 * time.Second |
| + r.e.Spoken = func() int { return spoken } |
| + remote := r.e.Forge.(*hubForge).dir |
| + gitOut(t, remote, "--git-dir="+remote, "symbolic-ref", "HEAD", "refs/heads/main") |
| + rep := r.engineering("tk1", "e1", "edit:README.md|teh|the sleep:60000") |
| + if rep.State != wire.StepFailed || rep.Reason != "step_timeout" || rep.Pushed || rep.CandidateSHA != "" { |
| + t.Fatalf("protocol %d: %+v", spoken, rep) |
| + } |
| + } |
| +} |
| + |
| // EQUIPO_RUNNER_MAX_STEP sets Engineering's step limit, a Go duration of |
| // 5 to 60 minutes (the stall sweep takes back a step running 90); any |
| // other value, or none, leaves the default 20. |
| @@ -100,7 +120,7 @@ func TestTimeoutKeptAcrossRestart(t *testing.T) { |
| gitOut(t, filepath.Dir(f.dir), "clone", "-q", "--bare", f.dir, gitDir) |
| tree := gitOut(t, filepath.Dir(f.dir), "--git-dir="+gitDir, "rev-parse", base+"^{tree}") |
| r.Base, r.Candidate = base, gitOut(t, filepath.Dir(f.dir), "--git-dir="+gitDir, "commit-tree", tree, "-p", base, "-m", "unfinished") |
| - for phase, reason := range map[string]string{phaseCommittedUnfinished: "step_timeout", phaseCommitted: ""} { |
| + for phase, reason := range map[string]string{phaseCommittedUnfinished: "step_timeout", phaseCommittedNoShell: wire.ReasonShellUnavailable, phaseCommitted: ""} { |
| r.Phase = phase |
| rep := e.Exec(context.Background(), r, func(wire.StepReport) {}) |
| if rep.State != wire.StepDone || !rep.Pushed || rep.Reason != reason || rep.CandidateSHA != r.Candidate { |
| @@ -108,3 +128,37 @@ func TestTimeoutKeptAcrossRestart(t *testing.T) { |
| } |
| } |
| } |
| + |
| +// The person's Retry of a timed-out step whose push failed publishes the |
| +// same commit as its attempt finished it: still unfinished (or still a |
| +// round without a working shell). |
| +func TestRepublishKeepsHowTheStepFinished(t *testing.T) { |
| + for phase, reason := range map[string]string{phaseCommittedUnfinished: "step_timeout", phaseCommittedNoShell: wire.ReasonShellUnavailable, phaseCommitted: ""} { |
| + e, f, r, _ := hubRig(t) |
| + ctx := context.Background() |
| + r.Specialist, r.StepID, r.Branch, r.Person = wire.SpecialistEngineering, "s2", "equipo/tk1-another-fix", "p@x" |
| + base := gitOut(t, f.dir, "rev-parse", "main") |
| + gitDir := e.tree(r, base).GitDir |
| + gitOut(t, filepath.Dir(f.dir), "clone", "-q", "--bare", f.dir, gitDir) |
| + tree := gitOut(t, filepath.Dir(f.dir), "--git-dir="+gitDir, "rev-parse", base+"^{tree}") |
| + cand := gitOut(t, filepath.Dir(f.dir), "--git-dir="+gitDir, "commit-tree", tree, "-p", base, "-m", "unfinished") |
| + if err := e.O.State.AcceptDispatch(ctx, "d1", r.DispatchCommand); err != nil { |
| + t.Fatal(err) |
| + } |
| + if _, err := e.O.State.db.Exec("UPDATE steps SET phase=?, state=?, final_state=?, final_reason='push_failed' WHERE step_id=? AND attempt=1", phase, runDone, wire.StepFailed, r.StepID); err != nil { |
| + t.Fatal(err) |
| + } |
| + again := r |
| + again.Attempt, again.FromAttempt, again.Republish, again.BaseSHA, again.CandidateSHA = 2, 1, true, base, cand |
| + if err := e.O.State.AcceptDispatch(ctx, "d2", again.DispatchCommand); err != nil { |
| + t.Fatal(err) |
| + } |
| + rep := e.Exec(ctx, again, func(wire.StepReport) {}) |
| + if rep.State != wire.StepDone || !rep.Pushed || rep.Reason != reason || rep.CandidateSHA != cand { |
| + t.Fatalf("%q: %+v", phase, rep) |
| + } |
| + if got, _ := e.O.State.stepPhase(ctx, r.StepID, 2); got != phase { |
| + t.Fatalf("%q: republish left phase %q", phase, got) |
| + } |
| + } |
| +} |
diff --git a/internal/runner/thin/judge_hosted_test.go b/internal/runner/thin/judge_hosted_test.go| index dca58b28..7c1757c8 100644 |
| --- a/internal/runner/thin/judge_hosted_test.go |
| +++ b/internal/runner/thin/judge_hosted_test.go |
| @@ -213,3 +213,27 @@ func TestCIUnitsShare(t *testing.T) { |
| t.Fatalf("split %q %+v", head, units) |
| } |
| } |
| + |
| +// However many units fail, and however long their names, every unit is |
| +// named before any log takes its share, within the bound. |
| +func TestCIUnitsEveryNameFirst(t *testing.T) { |
| + var units []wire.CIUnit |
| + for i := 0; i < wire.MaxHostedFailed; i++ { |
| + units = append(units, wire.CIUnit{Name: fmt.Sprintf("%02d ", i) + strings.Repeat("n", wire.MaxHostedName-3), Log: shardLog(i, 4<<10)}) |
| + } |
| + for _, limit := range []int{1500, 2600, 4500, 32 << 10} { |
| + out := wire.JoinCIUnits(units, limit) |
| + if len(out) > limit { |
| + t.Fatalf("limit %d: %d bytes", limit, len(out)) |
| + } |
| + named := 0 |
| + for _, u := range units { |
| + if strings.Contains(out, wire.CIUnitHeader(u.Name)+"\n") { |
| + named++ |
| + } |
| + } |
| + if want := min(len(units), limit/(len(wire.CIUnitHeader(units[0].Name))+1)); named != want { |
| + t.Fatalf("limit %d: %d units named, want %d", limit, named, want) |
| + } |
| + } |
| +} |
diff --git a/internal/runner/thin/run.go b/internal/runner/thin/run.go| index dccc2aad..fd14ac35 100644 |
| --- a/internal/runner/thin/run.go |
| +++ b/internal/runner/thin/run.go |
| @@ -363,7 +363,7 @@ func Run(ctx context.Context, c runner.Config, o Options) error { |
| if err = engine.Start(ctx); err != nil { |
| return err |
| } |
| - engineer := &Engineer{O: o.Claude, Codex: o.Codex, Pi: piOptions(c, o.Pi), OpenCode: opencodeOptions(c, o.OpenCode), Clones: clones, Forge: fg, CI: hostedCIOf(fg), Authorize: link.Confirm, AuthorizeStep: link.ConfirmStep, ConfirmMerge: link.ConfirmMerge, ConfirmPreview: link.ConfirmPreview, Preview: preview, Devbox: devbox, Site: site, ConfirmPublish: link.ConfirmPublish, ConfirmPublication: link.ConfirmPublication, Owners: withPerson(coordinatorPersons(c)(), creds.Bearer.Person), MaxStep: o.MaxStep, Note: o.StepNote, Healthy: conns.Usable, Conns: conns, Delta: link.Delta, Activity: link.Activity, StepActivity: link.StepActivity, Retention: o.KeptRetention, Host: c.MachineLabel, Merged: func(string) { index.Kick() }} |
| + engineer := &Engineer{O: o.Claude, Codex: o.Codex, Pi: piOptions(c, o.Pi), OpenCode: opencodeOptions(c, o.OpenCode), Clones: clones, Forge: fg, CI: hostedCIOf(fg), Authorize: link.Confirm, AuthorizeStep: link.ConfirmStep, ConfirmMerge: link.ConfirmMerge, ConfirmPreview: link.ConfirmPreview, Preview: preview, Devbox: devbox, Site: site, ConfirmPublish: link.ConfirmPublish, ConfirmPublication: link.ConfirmPublication, Owners: withPerson(coordinatorPersons(c)(), creds.Bearer.Person), MaxStep: o.MaxStep, Note: o.StepNote, Spoken: func() int { p, _ := link.Spoken(); return p }, Healthy: conns.Usable, Conns: conns, Delta: link.Delta, Activity: link.Activity, StepActivity: link.StepActivity, Retention: o.KeptRetention, Host: c.MachineLabel, Merged: func(string) { index.Kick() }} |
| link.Forget = engineer.RemoveKept |
| link.TaskEnded = engineer.PreviewTaskEnded |
| // A Research step that met an address outside the confirmed inventory |
diff --git a/internal/runner/thin/step.go b/internal/runner/thin/step.go| index 725b2a91..71a7e6a5 100644 |
| --- a/internal/runner/thin/step.go |
| +++ b/internal/runner/thin/step.go |
| @@ -30,19 +30,46 @@ CREATE UNIQUE INDEX IF NOT EXISTS steps_running ON steps(task_id) WHERE state='r |
| const runPending = "pending" |
| // Step phases while running: nothing ran yet, the specialist runs, the |
| -// runner committed the candidate (only publishing is left), or committed |
| -// what an Engineering step changed before it ran out of time (only |
| -// publishing is left, and the report says step_timeout). |
| +// runner committed the candidate (only publishing is left). An |
| +// Engineering commit can carry how its step finished, which its pushed |
| +// report says (committedReason): it ran out of time (the work so far), |
| +// or it was a fix round without a working shell. The phase stays on the |
| +// attempt's row, so a restart and a republish of a failed push say it |
| +// too. |
| const ( |
| phaseNone = "" |
| phaseRunning = "running" |
| phaseCommitted = "committed" |
| phaseCommittedUnfinished = "committed_unfinished" |
| + phaseCommittedNoShell = "committed_no_shell" |
| ) |
| // committed: only publishing is left of the attempt. |
| func committed(phase string) bool { |
| - return phase == phaseCommitted || phase == phaseCommittedUnfinished |
| + return phase == phaseCommitted || committedReason(phase) != "" |
| +} |
| + |
| +// committedReason is the reason a pushed report of a commit in phase |
| +// carries ("" for none). |
| +func committedReason(phase string) string { |
| + switch phase { |
| + case phaseCommittedUnfinished: |
| + return "step_timeout" |
| + case phaseCommittedNoShell: |
| + return wire.ReasonShellUnavailable |
| + } |
| + return "" |
| +} |
| + |
| +// stepPhase is the phase an attempt of a step was left in ("" when the |
| +// runner has no such attempt). |
| +func (s *State) stepPhase(ctx context.Context, stepID string, attempt int64) (string, error) { |
| + var phase sql.NullString |
| + err := s.db.QueryRowContext(ctx, "SELECT phase FROM steps WHERE step_id=? AND attempt=?", stepID, attempt).Scan(&phase) |
| + if errors.Is(err, sql.ErrNoRows) { |
| + return "", nil |
| + } |
| + return phase.String, err |
| } |
| // stepRow is one step attempt held by this runner. |
diff --git a/internal/thintest/hosted_checks_contract_test.go b/internal/thintest/hosted_checks_contract_test.go| index b3fb6cec..b51440e5 100644 |
| --- a/internal/thintest/hosted_checks_contract_test.go |
| +++ b/internal/thintest/hosted_checks_contract_test.go |
| @@ -72,7 +72,7 @@ func TestContractHostedChecksFailure(t *testing.T) { |
| r.step("f-c", hostedReport(c, task.Branch, wire.HostedFailure, "compile", "check shard 5 of 23")) |
| fix := r.dispatched(wire.SpecialistEngineering, cand, "", 1) |
| want := "The repository's hosted CI failed on " + cand[:7] + "." |
| - if !strings.Contains(fix.Feedback, want) || !strings.Contains(fix.Feedback, `CI failed job: "compile"`) || !strings.Contains(fix.Feedback, `CI failed job: "check shard 5 of 23"`) || !strings.Contains(fix.Feedback, "budget size: 1 problem") { |
| + if !strings.Contains(fix.Feedback, want) || !strings.Contains(fix.Feedback, "\n=== compile\n") || !strings.Contains(fix.Feedback, `CI failed job: "check shard 5 of 23"`) || !strings.Contains(fix.Feedback, "budget size: 1 problem") { |
| t.Fatalf("fix round feedback %q", fix.Feedback) |
| } |
| } |
diff --git a/internal/thintest/triage_contract_test.go b/internal/thintest/triage_contract_test.go| index 1b6aa140..4f2ec8c7 100644 |
| --- a/internal/thintest/triage_contract_test.go |
| +++ b/internal/thintest/triage_contract_test.go |
| @@ -324,7 +324,7 @@ func TestTriageAsksWithRecommendation(t *testing.T) { |
| t.Fatal(err) |
| } |
| fix := r.dispatched(wire.SpecialistEngineering, shas[2], "", 3) |
| - if !strings.Contains(fix.Feedback, "Round 3, which the person asked for") || !strings.Contains(fix.Feedback, `CI failed job: "compile"`) || !strings.Contains(fix.Feedback, `CI failed job: "check shard 5 of 23"`) { |
| + if !strings.Contains(fix.Feedback, "Round 3, which the person asked for") || !strings.Contains(fix.Feedback, "\n=== compile\n") || !strings.Contains(fix.Feedback, `CI failed job: "check shard 5 of 23"`) { |
| t.Fatalf("round 3 feedback %q", fix.Feedback) |
| } |
| // It passes the checks, and Review still asks for changes: its latest |
diff --git a/internal/wire/assistant_test.go b/internal/wire/assistant_test.go| index 3d0b8ab5..a02fc176 100644 |
| --- a/internal/wire/assistant_test.go |
| +++ b/internal/wire/assistant_test.go |
| @@ -81,7 +81,7 @@ func TestAssistantCardJSON(t *testing.T) { |
| // A runner that speaks 24 or more is spoken to at 24, the warm |
| // protocol; glances came at 23 and jobs at 22. |
| func TestSpokenIs24(t *testing.T) { |
| - if wire.Spoken(99) != 30 || wire.ProtocolCurrent != wire.ProtocolStuckTasks || wire.ProtocolWarm != wire.Protocol24 || wire.ProtocolGlance != wire.Protocol23 || wire.ProtocolJobs != wire.Protocol22 || wire.ProtocolCopy != wire.Protocol21 || wire.ProtocolUsageRefresh != wire.Protocol20 || wire.ProtocolAssistant != wire.Protocol19 { |
| + if wire.Spoken(99) != 31 || wire.ProtocolCurrent != wire.ProtocolUnfinishedWork || wire.ProtocolWarm != wire.Protocol24 || wire.ProtocolGlance != wire.Protocol23 || wire.ProtocolJobs != wire.Protocol22 || wire.ProtocolCopy != wire.Protocol21 || wire.ProtocolUsageRefresh != wire.Protocol20 || wire.ProtocolAssistant != wire.Protocol19 { |
| t.Fatalf("spoken %d, current %d", wire.Spoken(99), wire.ProtocolCurrent) |
| } |
| } |
diff --git a/internal/wire/cilogs.go b/internal/wire/cilogs.go| index 41f94d41..3fb4b1eb 100644 |
| --- a/internal/wire/cilogs.go |
| +++ b/internal/wire/cilogs.go |
| @@ -18,27 +18,39 @@ const ciCut = "[...]\n" |
| // JoinCIUnits is every unit's part within limit bytes (stopped-jobs |
| // audit, fix 4: the tail of all the logs joined kept only the last |
| -// failing unit). Each unit gets an equal share; what a shorter one leaves |
| -// goes to the others. Within its share a unit keeps its failure lines |
| -// first (ciFailure, with the indented lines after each), then its tail. |
| +// failing unit). Every unit is named first: its header is reserved before |
| +// any log takes a share (when even the headers do not fit, as many units |
| +// as fit are named). The logs then get equal shares of what is left; what |
| +// a shorter one leaves goes to the others. Within its share a unit keeps |
| +// its failure lines first (ciFailure, with the indented lines after |
| +// each), then its tail. |
| func JoinCIUnits(units []CIUnit, limit int) string { |
| - parts := make([]string, len(units)) |
| + heads := make([]string, len(units)) |
| + named, left := 0, limit |
| + for i, u := range units { |
| + heads[i] = CIUnitHeader(u.Name) + "\n" |
| + if len(heads[i]) > left { |
| + break |
| + } |
| + left -= len(heads[i]) |
| + named++ |
| + } |
| + units, heads = units[:named], heads[:named] |
| + logs := make([]string, len(units)) |
| order := make([]int, len(units)) |
| for i := range order { |
| order[i] = i |
| } |
| sort.SliceStable(order, func(a, b int) bool { return len(units[order[a]].Log) < len(units[order[b]].Log) }) |
| - left := limit |
| for n, i := range order { |
| - share := left / (len(units) - n) |
| - head := CIUnitHeader(units[i].Name) + "\n" |
| - if share <= len(head) { |
| - continue |
| - } |
| - parts[i] = head + clipCILog(units[i].Log, share-len(head)) |
| - left -= len(parts[i]) |
| + logs[i] = clipCILog(units[i].Log, left/(len(units)-n)) |
| + left -= len(logs[i]) |
| } |
| - return strings.Join(parts, "") |
| + var b strings.Builder |
| + for i := range units { |
| + b.WriteString(heads[i] + logs[i]) |
| + } |
| + return b.String() |
| } |
| // SplitCIUnits finds the named units' parts in output: head is what |
| @@ -83,6 +95,9 @@ func clipCILog(log string, n int) string { |
| if len(log) <= n { |
| return log |
| } |
| + if n <= 2*len(ciCut) { |
| + return "" |
| + } |
| lines := strings.SplitAfter(log, "\n") |
| keep := make([]bool, len(lines)) |
| for i, l := range lines { |
diff --git a/internal/wire/injection_test.go b/internal/wire/injection_test.go| index e6678b6c..49ac9e94 100644 |
| --- a/internal/wire/injection_test.go |
| +++ b/internal/wire/injection_test.go |
| @@ -7,10 +7,10 @@ import ( |
| ) |
| func TestInjectionProtocolDowngrade(t *testing.T) { |
| - if wire.ProtocolInjectionDefences != 28 || wire.ProtocolCurrent != 30 { |
| + if wire.ProtocolInjectionDefences != 28 || wire.ProtocolCurrent != 31 { |
| t.Fatal("injection guarantees require protocol 28") |
| } |
| - for version, want := range map[int]int{26: 26, 27: 27, 28: 28, 29: 29, 30: 30, 99: 30} { |
| + for version, want := range map[int]int{26: 26, 27: 27, 28: 28, 29: 29, 30: 30, 31: 31, 99: 31} { |
| if got := wire.Spoken(version); got != want { |
| t.Fatalf("negotiated %d as %d, want %d", version, got, want) |
| } |
diff --git a/internal/wire/mixed_protocol_test.go b/internal/wire/mixed_protocol_test.go| index 38424ed1..73a547f3 100644 |
| --- a/internal/wire/mixed_protocol_test.go |
| +++ b/internal/wire/mixed_protocol_test.go |
| @@ -15,7 +15,7 @@ import ( |
| // both go out whole; at 11 both are downgraded. The numbers are written |
| // out so that pointing ProtocolResearch back at 12 fails here. |
| func TestEncodeMixedMeteredAndResearch(t *testing.T) { |
| - if wire.ProtocolMetered != wire.Protocol12 || wire.ProtocolResearch != wire.Protocol13 || wire.ProtocolCurrent != wire.Protocol30 { |
| + if wire.ProtocolMetered != wire.Protocol12 || wire.ProtocolResearch != wire.Protocol13 || wire.ProtocolCurrent != wire.Protocol31 { |
| t.Fatalf("metered %d, research %d, current %d", wire.ProtocolMetered, wire.ProtocolResearch, wire.ProtocolCurrent) |
| } |
| metered := wire.HeldConnection{LocalID: "tensorx-1", Person: "p", Provider: wire.ProviderTensorX, Kind: wire.KindAPIKey, State: wire.ConnHealthy, Harness: wire.HarnessPi, Upstream: "https://api.tensorx.ai", Billing: wire.BillingMetered, Model: "z-ai/glm-5.3", Budget: &wire.Budget{Day: 1, Month: 2, Currency: "USD"}, Spend: &wire.Spend{Currency: "USD"}} |
diff --git a/internal/wire/models_test.go b/internal/wire/models_test.go| index 28012643..892faa67 100644 |
| --- a/internal/wire/models_test.go |
| +++ b/internal/wire/models_test.go |
| @@ -94,7 +94,7 @@ func modelsFrames(t *testing.T) map[string]wire.Frame { |
| // protocol is checked because an older step in Encode's chain could |
| // undo a newer one (S5's bug). |
| func TestEncodeBelowProtocol18AgainstFrozenSchemas(t *testing.T) { |
| - if wire.ProtocolModels != wire.Protocol18 || wire.ProtocolCurrent != wire.Protocol30 { |
| + if wire.ProtocolModels != wire.Protocol18 || wire.ProtocolCurrent != wire.Protocol31 { |
| t.Fatalf("models %d, current %d", wire.ProtocolModels, wire.ProtocolCurrent) |
| } |
| fs := modelsFrames(t) |
diff --git a/internal/wire/opencode_test.go b/internal/wire/opencode_test.go| index ef98f25b..6458a7ef 100644 |
| --- a/internal/wire/opencode_test.go |
| +++ b/internal/wire/opencode_test.go |
| @@ -57,7 +57,7 @@ func providersIn(t *testing.T, raw []byte) (providers, harnesses []string) { |
| // leave hello and sync, its usage rows leave every report, and a connect |
| // or a report about one is refused. At 17 nothing changes. |
| func TestEncodeBelowProtocol17DropsOpenCode(t *testing.T) { |
| - if wire.ProtocolOpenCode != wire.Protocol17 || wire.ProtocolCurrent != wire.Protocol30 { |
| + if wire.ProtocolOpenCode != wire.Protocol17 || wire.ProtocolCurrent != wire.Protocol31 { |
| t.Fatalf("opencode %d, current %d", wire.ProtocolOpenCode, wire.ProtocolCurrent) |
| } |
| budget := &wire.Budget{Day: 1_000_000, Month: 10_000_000, Currency: "USD", Revision: 1} |
diff --git a/internal/wire/pinned_release_test.go b/internal/wire/pinned_release_test.go| index 0a71599a..aeb0eb6c 100644 |
| --- a/internal/wire/pinned_release_test.go |
| +++ b/internal/wire/pinned_release_test.go |
| @@ -13,7 +13,7 @@ import ( |
| // carrying a pinned release loses the release and its pin; an unpinned |
| // release is unchanged from protocol 14. |
| func TestEncodePinnedReleaseBelow29(t *testing.T) { |
| - if wire.ProtocolPinnedRelease != wire.Protocol29 || wire.ProtocolCurrent != wire.Protocol30 { |
| + if wire.ProtocolPinnedRelease != wire.Protocol29 || wire.ProtocolCurrent != wire.Protocol31 { |
| t.Fatalf("pinned %d, current %d", wire.ProtocolPinnedRelease, wire.ProtocolCurrent) |
| } |
| pinned, err := wire.NewFrame("f1", wire.FrameRelease, wire.ReleaseCommand{ID: "rl_1", Person: "p", TaskID: "tk1", StepID: "s1", StepRevision: 1, Connection: "claude-1"}) |
diff --git a/internal/wire/publish_test.go b/internal/wire/publish_test.go| index 6f940f0d..d47cb0c2 100644 |
| --- a/internal/wire/publish_test.go |
| +++ b/internal/wire/publish_test.go |
| @@ -17,7 +17,7 @@ import ( |
| // and a hello's sites capability are dropped, so nothing a protocol 15 |
| // peer decodes strictly carries them. |
| func TestEncodeBelowProtocol16DropsPublish(t *testing.T) { |
| - if wire.ProtocolPublish != wire.Protocol16 || wire.ProtocolCurrent != wire.Protocol30 { |
| + if wire.ProtocolPublish != wire.Protocol16 || wire.ProtocolCurrent != wire.Protocol31 { |
| t.Fatalf("publish %d, current %d", wire.ProtocolPublish, wire.ProtocolCurrent) |
| } |
| publish := wire.DispatchCommand{Person: "p", TaskID: "tk", StepID: "s", Attempt: 1, Specialist: wire.SpecialistPublish, Findings: []wire.Finding{}, CandidateSHA: strings.Repeat("e", 40), Publish: &wire.PublishDispatch{App: "site-sample", Into: "main"}} |
diff --git a/internal/wire/runners.go b/internal/wire/runners.go| index a1c77dc5..0714f4e6 100644 |
| --- a/internal/wire/runners.go |
| +++ b/internal/wire/runners.go |
| @@ -56,6 +56,7 @@ const ( |
| Protocol28 = 28 |
| Protocol29 = 29 |
| Protocol30 = 30 |
| + Protocol31 = 31 |
| // ProtocolSpend is the first protocol with a fix round's Feedback and |
| // a usage row's Turns; Encode drops both below it. |
| ProtocolSpend = Protocol3 |
| @@ -194,7 +195,14 @@ const ( |
| // Below it Encode drops the tool health and refuses the tool's call |
| // (downgradeStuck). |
| ProtocolStuckTasks = Protocol30 |
| - ProtocolCurrent = ProtocolStuckTasks |
| + // ProtocolUnfinishedWork is the first protocol whose instance takes an |
| + // Engineering step done with the reason step_timeout as unfinished |
| + // work (stopped-jobs audit, 2026-11-25): it keeps the reason, tells |
| + // Review, and shows it. A runner keeps a timed-out step's work only |
| + // when the instance speaks it; below it the step fails step_timeout |
| + // as before. No frame changes shape, so Encode changes nothing. |
| + ProtocolUnfinishedWork = Protocol31 |
| + ProtocolCurrent = ProtocolUnfinishedWork |
| ) |
| // Runner roles. A person's first runner is the primary: the coordinator, |
diff --git a/internal/wire/runners_test.go b/internal/wire/runners_test.go| index cbf4fdd6..4f39dcb9 100644 |
| --- a/internal/wire/runners_test.go |
| +++ b/internal/wire/runners_test.go |
| @@ -413,7 +413,7 @@ func TestEncodeBelowProtocol9DropsPreviews(t *testing.T) { |
| if _, err := wire.Encode(d, wire.ProtocolPreview); err != nil { |
| t.Fatal(err) |
| } |
| - if wire.ProtocolCurrent != wire.ProtocolStuckTasks || wire.ProtocolStuckTasks != 30 || wire.ProtocolPinnedRelease != 29 || wire.ProtocolInjectionDefences != 28 || wire.ProtocolWarm != 24 || wire.ProtocolGlance != 23 || wire.ProtocolJobs != 22 || wire.ProtocolCopy != 21 || wire.ProtocolUsageRefresh != 20 || wire.ProtocolAssistant != 19 || wire.ProtocolModels != 18 || wire.ProtocolOpenCode != 17 || wire.ProtocolPublish != 16 || wire.ProtocolReadings != 15 || wire.ProtocolScheduler != 14 || wire.ProtocolResearch != 13 || wire.ProtocolMetered != 12 || wire.ProtocolPreviewHost != 11 || wire.ProtocolExplore != 10 || wire.ProtocolPreview != 9 { |
| + if wire.ProtocolCurrent != wire.ProtocolUnfinishedWork || wire.ProtocolStuckTasks != 30 || wire.ProtocolPinnedRelease != 29 || wire.ProtocolInjectionDefences != 28 || wire.ProtocolWarm != 24 || wire.ProtocolGlance != 23 || wire.ProtocolJobs != 22 || wire.ProtocolCopy != 21 || wire.ProtocolUsageRefresh != 20 || wire.ProtocolAssistant != 19 || wire.ProtocolModels != 18 || wire.ProtocolOpenCode != 17 || wire.ProtocolPublish != 16 || wire.ProtocolReadings != 15 || wire.ProtocolScheduler != 14 || wire.ProtocolResearch != 13 || wire.ProtocolMetered != 12 || wire.ProtocolPreviewHost != 11 || wire.ProtocolExplore != 10 || wire.ProtocolPreview != 9 { |
| t.Fatalf("current %d", wire.ProtocolCurrent) |
| } |
| } |
diff --git a/internal/wire/schedule_test.go b/internal/wire/schedule_test.go| index 50478281..5eab12b5 100644 |
| --- a/internal/wire/schedule_test.go |
| +++ b/internal/wire/schedule_test.go |
| @@ -17,7 +17,7 @@ import ( |
| // refused anything that spends, never handed it), and a dispatch loses |
| // its priority, deadline and release; what 13 already had is unchanged. |
| func TestEncodeBelowProtocol14DropsScheduler(t *testing.T) { |
| - if wire.ProtocolScheduler != wire.Protocol14 || wire.ProtocolCurrent != wire.Protocol30 { |
| + if wire.ProtocolScheduler != wire.Protocol14 || wire.ProtocolCurrent != wire.Protocol31 { |
| t.Fatalf("scheduler %d, current %d", wire.ProtocolScheduler, wire.ProtocolCurrent) |
| } |
| by := time.Date(2026, 11, 20, 17, 0, 0, 0, time.UTC) |
diff --git a/internal/wire/stuck_test.go b/internal/wire/stuck_test.go| index 337db477..ea32482a 100644 |
| --- a/internal/wire/stuck_test.go |
| +++ b/internal/wire/stuck_test.go |
| @@ -14,7 +14,7 @@ import ( |
| // Stuck tasks (protocol 30): a hello's tool health is a fixed state per |
| // pinned tool, never a path, and an older instance never hears it. |
| func TestProtocol30ToolHealth(t *testing.T) { |
| - if wire.ProtocolStuckTasks != wire.Protocol30 || wire.ProtocolCurrent != wire.Protocol30 || wire.Spoken(99) != 30 { |
| + if wire.ProtocolStuckTasks != wire.Protocol30 || wire.ProtocolCurrent != wire.Protocol31 || wire.Spoken(99) != 31 { |
| t.Fatalf("stuck %d, current %d", wire.ProtocolStuckTasks, wire.ProtocolCurrent) |
| } |
| caps := func(h *wire.ToolHealth) wire.Capabilities { |
diff --git a/internal/wire/usage_test.go b/internal/wire/usage_test.go| index 2eeede17..5b254189 100644 |
| --- a/internal/wire/usage_test.go |
| +++ b/internal/wire/usage_test.go |
| @@ -44,7 +44,7 @@ func headrooms(t *testing.T, raw []byte) []map[string]json.RawMessage { |
| // decodes strictly against the frozen protocol 14 headroom, and the |
| // caller's own values are untouched; at 15 nothing changes. |
| func TestEncodeBelowProtocol15DropsReadingTimes(t *testing.T) { |
| - if wire.ProtocolReadings != wire.Protocol15 || wire.ProtocolCurrent != wire.Protocol30 { |
| + if wire.ProtocolReadings != wire.Protocol15 || wire.ProtocolCurrent != wire.Protocol31 { |
| t.Fatalf("readings %d, current %d", wire.ProtocolReadings, wire.ProtocolCurrent) |
| } |
| at := time.Date(2026, 11, 12, 9, 58, 0, 0, time.UTC) |
diff --git a/internal/wire/warm_test.go b/internal/wire/warm_test.go| index 81358c7d..8cd51e99 100644 |
| --- a/internal/wire/warm_test.go |
| +++ b/internal/wire/warm_test.go |
| @@ -13,7 +13,7 @@ import ( |
| // other (durable, acked), and Encode refuses it below 24: an older |
| // runner's strict decoder would close the stream on it. |
| func TestEncodeWarmBelow24(t *testing.T) { |
| - if wire.ProtocolWarm != 24 || wire.ProtocolCurrent != wire.ProtocolStuckTasks || wire.Spoken(99) != 30 { |
| + if wire.ProtocolWarm != 24 || wire.ProtocolCurrent != wire.ProtocolUnfinishedWork || wire.Spoken(99) != 31 { |
| t.Fatalf("protocols %d %d", wire.ProtocolWarm, wire.ProtocolCurrent) |
| } |
| f, err := wire.NewFrame("c1", wire.FrameWarm, wire.WarmCommand{Person: "ana@example.com"}) |