design: a republish is judged by its source attempt's protocol
Final review M4 (Fable 8). dispatchTo recorded the runner's current
protocol on every dispatch, so a pre-39 exploration attempt whose push
failed, published again after the runner upgraded, was raised to 39:
its kept record (old rules, Explore false) then read as a short set
and the candidate got a fix round instead of Review.
A republish runs no Design and reports the source attempt's commit
and kept options, so dispatchTo now keeps the source attempt's
dispatch protocol for it.
Test (RED first):
go test ./internal/equipo/chat/ -run TestRepublishKeepsSourceProtocol
(source attempt at 38, runner at 39 by the Retry)
RED: "the republish was raised to 39"
GREEN: ok; also -run 'TestRepublish|TestKeptForSameCommit|
TestDispatchProtocol|Design'
Mutation: raising it on a republish again is the RED above.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 files changed,
+30
−2
internal/equipo/chat/design_feedback_options_test.go+24 −0internal/equipo/chat/tasks.go+6 −2
diff --git a/internal/equipo/chat/design_feedback_options_test.go b/internal/equipo/chat/design_feedback_options_test.go| index 0da81eb1..88f5cabc 100644 |
| --- a/internal/equipo/chat/design_feedback_options_test.go |
| +++ b/internal/equipo/chat/design_feedback_options_test.go |
| @@ -409,3 +409,27 @@ func TestKeptForSameCommit(t *testing.T) { |
| } |
| } |
| } |
| + |
| +// TestRepublishKeepsSourceProtocol (final review, M4 / Fable 8): an |
| +// exploration attempt dispatched before protocol 39 whose push failed |
| +// is published again after the runner was upgraded to 39. The |
| +// republish runs no Design, so it is judged by its source attempt's |
| +// rules: its dispatch protocol stays the source's, and its candidate |
| +// goes to Review, never to a fix round for a short set. |
| +func TestRepublishKeepsSourceProtocol(t *testing.T) { |
| + r, l, task, s := designAt(t, wire.ProtocolDesignFeedback, wire.KindExplore) |
| + // The source attempt as an instance before this round dispatched it |
| + // (at 38); the runner speaks 39 by the time of the Retry. |
| + r.exec("UPDATE chat_steps SET dispatch_protocol = ? WHERE id = ?", wire.ProtocolDesign, s.ID) |
| + s = r.stepNow(s.ID) |
| + re := r.pushFailedRepublished(l, task, s) |
| + if re.DispatchProtocol != wire.ProtocolDesign { |
| + t.Fatalf("the republish was raised to %d", re.DispatchProtocol) |
| + } |
| + if next := r.makerStep(task); next.ID != re.ID { |
| + t.Fatalf("a fix round %s round %d", next.ID, next.Round) |
| + } |
| + if n := r.reviews(task); n != 1 { |
| + t.Fatalf("%d Review steps", n) |
| + } |
| +} |
diff --git a/internal/equipo/chat/tasks.go b/internal/equipo/chat/tasks.go| index 19be58fe..63d4aedf 100644 |
| --- a/internal/equipo/chat/tasks.go |
| +++ b/internal/equipo/chat/tasks.go |
| @@ -1437,13 +1437,17 @@ func (t *txn) dispatchStep(k *taskRecord, s *stepRecord) error { |
| // runner's connection speaks now: what the dispatch is encoded for |
| // (spec 2026-11-28-dynamic-specialists.md, section 8.7). Written once |
| // per dispatch, never by a reconnect; 0 when the runner has no |
| -// connection on record. |
| +// connection on record. A republish keeps its source attempt's: it runs |
| +// no Design, so its report (the source's commit and kept options) is |
| +// judged by the rules the source ran under. |
| func (t *txn) dispatchTo(s *stepRecord, cmd wire.DispatchCommand) error { |
| var sess runnerSessionRecord |
| if err := t.db.Where("runner_id = ?", s.RunnerID).Limit(1).Find(&sess).Error; err != nil { |
| return err |
| } |
| - s.DispatchProtocol = sess.Protocol |
| + if !s.Republish { |
| + s.DispatchProtocol = sess.Protocol |
| + } |
| return t.commandTo(s.RunnerID, s.Person, wire.FrameDispatch, cmd) |
| } |