design: check a held Design attempt again right before its launch
Final review F1 (Astra 1). The start authorization recorded
StartedAttempt before the runner's scheduler could hold the attempt;
after a hold, a forget and the wake, the next check skipped the
notebook, so the attempt launched with forgotten notes.
The check right before each launch is now its own lease purpose,
design_launch (protocol 39): the runner sends it for a Design attempt
(Engineer.ConfirmLaunch, Link.ConfirmLaunch; a plain start check below
39, refused by Encode there), and the instance decides it afresh at
every launch (refuseStaleDesign: notes and the runner's protocol). A
plain check from a runner below 39 on a step dispatched at 39 is
checked the same way, since an older runner sends only plain checks.
A launched attempt's plain checks and renders still hold.
Tests (RED first):
go test ./internal/equipo/chat/ -run TestHeldDesignLaunchRechecksNotes
RED: launch check refused as an unknown purpose but not replaced
("not replaced: ... Attempt:1 TasteRevision:2")
go test ./internal/wire/ -run TestDowngradeDesignFeedback
RED: "frame 4 (...design_launch...) encoded at 38: <nil>"
go test ./internal/runner/thin/ -run TestDesignLaunch
RED: at 39 the check went with no purpose; the Design attempt
launched with no launch check (state done, pushed)
GREEN: all three, plus -run 'Design|Taste|Forget|Lease|Authorize|
Encode|Stale' in chat and wire.
Mutations (each restored):
launch := false || ... -> "a held attempt launched after
a forget" FAIL
drop the below-39 plain-check arm -> "a held attempt on a runner
back at 38" FAIL
launchLease always plain lease -> TestDesignLaunchAskedAsLaunch
FAIL (done, pushed)
Link.ConfirmLaunch without the 38 -> "at 38: no launch check" FAIL
plain-check branch
no LeaseCheck case in downgrade -> the RED above
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
12 files changed,
+227
−16
internal/equipo/chat/grants.go+1 −1internal/equipo/chat/runners.go+8 −2internal/equipo/chat/taste_dispatch_test.go+76 −0internal/runner/thin/design_step_test.go+76 −0internal/runner/thin/engineer.go+9 −2internal/runner/thin/judge.go+21 −3internal/runner/thin/link.go+14 −0internal/runner/thin/run.go+1 −1internal/wire/design.go+7 −2internal/wire/design_feedback_test.go+4 −3internal/wire/frames.go+8 −0internal/wire/runners.go+2 −2
diff --git a/internal/equipo/chat/grants.go b/internal/equipo/chat/grants.go| index 267dc0ea..96c07eb1 100644 |
| --- a/internal/equipo/chat/grants.go |
| +++ b/internal/equipo/chat/grants.go |
| @@ -309,7 +309,7 @@ func leasePurposeKnown(stepSpecialist, purpose string) bool { |
| return true |
| case wire.LeasePurposeMerge: |
| return stepSpecialist == wire.SpecialistMerge |
| - case wire.LeasePurposeRender: |
| + case wire.LeasePurposeRender, wire.LeasePurposeLaunch: |
| return stepSpecialist == wire.SpecialistEngineering |
| } |
| return false |
diff --git a/internal/equipo/chat/runners.go b/internal/equipo/chat/runners.go| index ba15a5d7..a81ef832 100644 |
| --- a/internal/equipo/chat/runners.go |
| +++ b/internal/equipo/chat/runners.go |
| @@ -1003,8 +1003,14 @@ func (s *Store) Authorize(ctx context.Context, l Lease, stepID string, attempt i |
| // another connection), is checked once against the creator's |
| // notes (designStale); an attempt that already started keeps |
| // every grant and finishes with what it was given. Steps |
| - // dispatched before protocol 39 keep the old rule. |
| - if purpose != "" || st.StartedAttempt == st.Attempt || st.DispatchProtocol < wire.ProtocolDesignFeedback { |
| + // dispatched before protocol 39 keep the old rule. Each launch |
| + // (design_launch) is checked again, as a start: the scheduler |
| + // may have held the attempt after its start, unlaunched, while |
| + // the notes changed or the runner went back below 39. A runner |
| + // below 39 sends only plain checks, so one of those from below |
| + // 39 is checked too. |
| + launch := purpose == wire.LeasePurposeLaunch || purpose == "" && l.Protocol < wire.ProtocolDesignFeedback |
| + if st.DispatchProtocol < wire.ProtocolDesignFeedback || !launch && (purpose != "" || st.StartedAttempt == st.Attempt) { |
| return nil |
| } |
| if r, err := t.refuseStaleDesign(l, &st); err != nil || r != "" { |
diff --git a/internal/equipo/chat/taste_dispatch_test.go b/internal/equipo/chat/taste_dispatch_test.go| index 938c2b48..da4865c8 100644 |
| --- a/internal/equipo/chat/taste_dispatch_test.go |
| +++ b/internal/equipo/chat/taste_dispatch_test.go |
| @@ -491,3 +491,79 @@ func TestForgetAfterAdvanceFenced(t *testing.T) { |
| t.Fatalf("the started advanced attempt after a note: %q", refused) |
| } |
| } |
| + |
| +// TestHeldDesignLaunchRechecksNotes (final review, Astra 1): a Design |
| +// attempt whose start was authorized and that the runner's scheduler |
| +// then held has not launched. The check right before its launch |
| +// (design_launch) is decided afresh: a note forgotten while it waited |
| +// refuses it and replaces it with fresh notes; the runner reconnecting |
| +// below 39 while it waited refuses it too (even through a plain start |
| +// check, all an older runner sends), and the step waits with |
| +// design_runner_old. At a current revision the launch goes, and a |
| +// started attempt's plain checks and renders still hold after a forget. |
| +func TestHeldDesignLaunchRechecksNotes(t *testing.T) { |
| + r, l := designReady(t) |
| + r.must(r.s.AddTaste(r.ctx, paul, "p_patrix", "One.")) |
| + r.must(r.s.AddTaste(r.ctx, paul, "p_patrix", "Two.")) |
| + task := r.designTask(l, r.makerSpecialist(), wire.KindChange) |
| + s := r.makerStep(task) |
| + r.ackDispatches(s.ID) |
| + // Authorized to prepare; the scheduler holds it (nothing reaches |
| + // the instance); the person forgets a note; the hold wakes. |
| + if refused := r.authorize(l, s, ""); refused != "" { |
| + t.Fatalf("start %q", refused) |
| + } |
| + s = r.stepNow(s.ID) |
| + r.must(r.s.ForgetTaste(r.ctx, paul, r.tasteRows(paul)[0].ID)) |
| + if refused := r.authorize(l, s, ""); refused != "" { |
| + t.Fatalf("the woken attempt's prepare check: %q", refused) |
| + } |
| + if refused := r.authorize(l, s, wire.LeasePurposeLaunch); refused != "withdrawn" { |
| + t.Fatalf("a held attempt launched after a forget: %q", refused) |
| + } |
| + got := r.stepNow(s.ID) |
| + if got.Attempt != s.Attempt+1 || got.StartedAt != nil || got.State != wire.StepQueued || got.TasteRevision != 3 { |
| + t.Fatalf("not replaced: %+v", got) |
| + } |
| + if _, d := r.dispatched(s.ID); d.Attempt != got.Attempt || len(d.Taste) != 1 || d.TasteRevision != 3 { |
| + t.Fatalf("replacement %+v", d) |
| + } |
| + // The fresh attempt: prepare, launch at the current revision, then |
| + // a forget while it runs leaves its plain checks and renders alone. |
| + r.ackDispatches(s.ID) |
| + for _, purpose := range []string{"", wire.LeasePurposeLaunch} { |
| + if refused := r.authorize(l, got, purpose); refused != "" { |
| + t.Fatalf("the fresh attempt's %q check: %q", purpose, refused) |
| + } |
| + } |
| + r.must(r.s.ForgetTaste(r.ctx, paul, r.tasteRows(paul)[0].ID)) |
| + for _, purpose := range []string{"", wire.LeasePurposeRender} { |
| + if refused := r.authorize(l, got, purpose); refused != "" { |
| + t.Fatalf("a launched attempt's %q check after a forget: %q", purpose, refused) |
| + } |
| + } |
| + if now := r.stepNow(s.ID); now.Attempt != got.Attempt { |
| + t.Fatalf("a launched attempt was replaced: %+v", now) |
| + } |
| + |
| + // Held, then the runner reconnects below 39 (an older runner sends |
| + // only plain checks): refused at its next check, waiting for 39. |
| + r2, l2 := designReady(t) |
| + task2 := r2.designTask(l2, r2.makerSpecialist(), wire.KindChange) |
| + s2 := r2.makerStep(task2) |
| + r2.ackDispatches(s2.ID) |
| + if refused := r2.authorize(l2, s2, ""); refused != "" { |
| + t.Fatalf("start %q", refused) |
| + } |
| + s2 = r2.stepNow(s2.ID) |
| + r2.setHello(wire.ProtocolDesign, designHello(wire.ToolHealthy, claudeSub)) |
| + old := l2 |
| + old.Protocol = wire.ProtocolDesign |
| + if refused := r2.authorize(old, s2, ""); refused != "withdrawn" { |
| + t.Fatalf("a held attempt on a runner back at 38: %q", refused) |
| + } |
| + got2 := r2.stepNow(s2.ID) |
| + if got2.Attempt != s2.Attempt+1 || got2.Placement != wire.PlacementDesign || got2.Reason != reasonDesignProtocol || got2.RunnerID != "" || r2.attemptSent(got2) { |
| + t.Fatalf("after a 38 check: %+v", got2) |
| + } |
| +} |
diff --git a/internal/runner/thin/design_step_test.go b/internal/runner/thin/design_step_test.go| index be805293..e02b4e21 100644 |
| --- a/internal/runner/thin/design_step_test.go |
| +++ b/internal/runner/thin/design_step_test.go |
| @@ -632,3 +632,79 @@ func TestDesignAuthorizedRightBeforeLaunch(t *testing.T) { |
| t.Fatalf("launched: namespace %q %v", ns, err) |
| } |
| } |
| + |
| +// TestDesignLaunchCheckThroughTheLink (final review, Astra 1): the |
| +// check right before a Design launch is a design_launch lease for the |
| +// attempt at protocol 39, which the instance decides afresh at every |
| +// launch; at 38 it is the plain start check an older instance knows. |
| +func TestDesignLaunchCheckThroughTheLink(t *testing.T) { |
| + for _, protocol := range []int{wire.ProtocolDesign, wire.ProtocolDesignFeedback} { |
| + inst := newFakeInstance(t) |
| + link, _, _, _ := startLink(t, inst.url, &stubCoordinator{}) |
| + c := <-inst.conns |
| + read(t, c, wire.FrameHello) |
| + welcome, _ := json.Marshal(wire.Frame{ID: "w-d", Type: wire.FrameWelcome, Data: json.RawMessage(`{"generation":3,"runner_id":"RUNNER1","protocol":` + itoa(int64(protocol)) + `,"role":"primary"}`)}) |
| + write(t, c, welcome) |
| + read(t, c, wire.FrameSync) |
| + done := make(chan error, 1) |
| + go func() { done <- link.ConfirmLaunch(context.Background(), "ds9", 2) }() |
| + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) |
| + for { |
| + _, raw, err := c.Read(ctx) |
| + if err != nil { |
| + t.Fatalf("at %d: no launch check: %v", protocol, err) |
| + } |
| + f, _, _ := wire.ParseFrame(raw) |
| + if f.Type != wire.FrameLease { |
| + continue |
| + } |
| + var check wire.LeaseCheck |
| + json.Unmarshal(f.Data, &check) |
| + want := wire.LeasePurposeLaunch |
| + if protocol < wire.ProtocolDesignFeedback { |
| + want = "" |
| + } |
| + if check.Purpose != want || check.StepID != "ds9" || check.Attempt != 2 { |
| + t.Fatalf("at %d: check %+v", protocol, check) |
| + } |
| + no, _ := wire.NewFrame("r-"+f.ID, wire.FrameRefused, wire.Refused{ID: f.ID, Reason: "withdrawn"}) |
| + rawNo, _ := json.Marshal(no) |
| + write(t, c, rawNo) |
| + break |
| + } |
| + cancel() |
| + if err := <-done; !errors.Is(err, ErrWithdrawn) { |
| + t.Fatalf("at %d: a refusal: %v", protocol, err) |
| + } |
| + } |
| +} |
| + |
| +// TestDesignLaunchAskedAsLaunch (final review, Astra 1): a Design |
| +// attempt asks its start check as before, then right before its launch |
| +// asks ConfirmLaunch (never the plain check again); a refusal there |
| +// cancels the attempt and nothing launches. |
| +func TestDesignLaunchAskedAsLaunch(t *testing.T) { |
| + r := newDesignRig(t) |
| + row := stepRow{DispatchCommand: designDispatch("ds10", 1)} |
| + var plain, launch int |
| + r.e.AuthorizeStep = func(context.Context, string, int64) error { plain++; return nil } |
| + r.e.ConfirmLaunch = func(_ context.Context, step string, attempt int64) error { |
| + launch++ |
| + if step != "ds10" || attempt != 1 { |
| + t.Errorf("launch check for %s/%d", step, attempt) |
| + } |
| + return ErrWithdrawn |
| + } |
| + r.e.Note = " create:mockups/tk1/index.html|<h1>After</h1>;\n" |
| + rep := r.exec(row) |
| + if rep.State != wire.StepCancelled || rep.Reason != "withdrawn" || !rep.Termination || rep.Pushed { |
| + t.Fatalf("report %+v", rep) |
| + } |
| + if plain != 1 || launch != 1 { |
| + t.Fatalf("checks: %d plain, %d launch", plain, launch) |
| + } |
| + var ns string |
| + if err := r.e.O.State.db.QueryRow("SELECT ns_id FROM steps WHERE step_id=?", "ds10").Scan(&ns); err != nil || ns != "" { |
| + t.Fatalf("launched: namespace %q %v", ns, err) |
| + } |
| +} |
diff --git a/internal/runner/thin/engineer.go b/internal/runner/thin/engineer.go| index 718bc096..0022067b 100644 |
| --- a/internal/runner/thin/engineer.go |
| +++ b/internal/runner/thin/engineer.go |
| @@ -103,6 +103,12 @@ type Engineer struct { |
| // decides again whether the attempt's binding may render. nil: no |
| // Design step renders. |
| ConfirmRender func(ctx context.Context, step string, attempt int64) error |
| + // ConfirmLaunch is the check right before each launch of a Design |
| + // attempt's process (protocol 39, purpose design_launch): the |
| + // instance decides the start again, the creator's notes included, |
| + // so an attempt held after its start never launches with notes that |
| + // changed while it waited. nil: the plain check (lease). |
| + ConfirmLaunch func(ctx context.Context, step string, attempt int64) error |
| // Devbox is the paired CARLOS devbox (nil: none); it wins over |
| // Preview's Carloku temporary sites. |
| Devbox *DevboxOptions |
| @@ -368,8 +374,9 @@ func (e *Engineer) Exec(ctx context.Context, r stepRow, progress func(wire.StepR |
| if specialistBound(r) { |
| // Authorized again immediately before each launch: the grant |
| // may have changed while the tree was fetched and prepared, or |
| - // since an earlier attempt. |
| - if err := e.lease(ctx, r); err != nil { |
| + // since an earlier attempt. Design's is a launch check: the |
| + // instance decides its start afresh, the notes included. |
| + if err := e.launchLease(ctx, r, design); err != nil { |
| rep.State, rep.Reason, rep.Termination = wire.StepCancelled, leaseReason(err), true |
| return rep |
| } |
diff --git a/internal/runner/thin/judge.go b/internal/runner/thin/judge.go| index 1d7ce081..cb6a8d7c 100644 |
| --- a/internal/runner/thin/judge.go |
| +++ b/internal/runner/thin/judge.go |
| @@ -103,8 +103,27 @@ var shaPattern = regexp.MustCompile(`^(?:[0-9a-f]{40}|[0-9a-f]{64})$`) |
| // start authorization: nothing runs without it, and a withdrawn attempt |
| // never runs. |
| func (e *Engineer) lease(ctx context.Context, r stepRow) error { |
| - for e.Authorize != nil || e.AuthorizeStep != nil { |
| - err := e.confirmFor(r)(ctx) |
| + if e.Authorize == nil && e.AuthorizeStep == nil { |
| + return nil |
| + } |
| + return e.waitLease(ctx, e.confirmFor(r)) |
| +} |
| + |
| +// launchLease is the check right before a bound attempt's launch: for |
| +// Design, ConfirmLaunch, which the instance decides afresh at every |
| +// launch (a held attempt's later one included); else the plain lease. |
| +func (e *Engineer) launchLease(ctx context.Context, r stepRow, design bool) error { |
| + if !design || e.ConfirmLaunch == nil { |
| + return e.lease(ctx, r) |
| + } |
| + return e.waitLease(ctx, func(ctx context.Context) error { return e.ConfirmLaunch(ctx, r.StepID, r.Attempt) }) |
| +} |
| + |
| +// waitLease asks confirm until it answers: nil, or a refusal. Any other |
| +// failure (no connection yet) is asked again after stepWait. |
| +func (e *Engineer) waitLease(ctx context.Context, confirm func(context.Context) error) error { |
| + for { |
| + err := confirm(ctx) |
| if err == nil { |
| return nil |
| } |
| @@ -117,7 +136,6 @@ func (e *Engineer) lease(ctx context.Context, r stepRow) error { |
| case <-time.After(stepWait): |
| } |
| } |
| - return nil |
| } |
| func judgeReport(r stepRow) wire.StepReport { |
diff --git a/internal/runner/thin/link.go b/internal/runner/thin/link.go| index af8e8090..dfc0f490 100644 |
| --- a/internal/runner/thin/link.go |
| +++ b/internal/runner/thin/link.go |
| @@ -1280,3 +1280,17 @@ func (l *Link) wakeHeld(ctx context.Context) { |
| } |
| l.Steps.Wake() |
| } |
| + |
| +// ConfirmLaunch is the check right before each launch of a Design |
| +// attempt's process (ProtocolDesignFeedback, purpose design_launch): the |
| +// instance decides the start again every time. Below protocol 39 it is |
| +// the plain start check, all an older instance knows. |
| +func (l *Link) ConfirmLaunch(ctx context.Context, step string, attempt int64) error { |
| + l.mu.Lock() |
| + proto := l.proto |
| + l.mu.Unlock() |
| + if proto < wire.ProtocolDesignFeedback { |
| + return l.ConfirmStep(ctx, step, attempt) |
| + } |
| + return l.lease(ctx, wire.LeaseCheck{StepID: step, Attempt: attempt, Purpose: wire.LeasePurposeLaunch}) |
| +} |
diff --git a/internal/runner/thin/run.go b/internal/runner/thin/run.go| index 1e8d061c..8a3ae2de 100644 |
| --- a/internal/runner/thin/run.go |
| +++ b/internal/runner/thin/run.go |
| @@ -377,7 +377,7 @@ func Run(ctx context.Context, c runner.Config, o Options) error { |
| if err = engine.Start(ctx); err != nil { |
| return err |
| } |
| - engineer := &Engineer{DiffSecrets: []string{creds.Bearer.Token}, 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, ConfirmRender: link.ConfirmRender, Preview: preview, Devbox: devbox, Site: site, ConfirmPublish: link.ConfirmPublish, ConfirmMint: link.ConfirmMint, SiteChanged: func() { caps.Stale(); link.HelloSoon() }, 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() }} |
| + engineer := &Engineer{DiffSecrets: []string{creds.Bearer.Token}, 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, ConfirmRender: link.ConfirmRender, ConfirmLaunch: link.ConfirmLaunch, Preview: preview, Devbox: devbox, Site: site, ConfirmPublish: link.ConfirmPublish, ConfirmMint: link.ConfirmMint, SiteChanged: func() { caps.Stale(); link.HelloSoon() }, 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() }} |
| engineer.Renderer = renderer |
| link.Forget = engineer.RemoveKept |
| link.TaskEnded = engineer.PreviewTaskEnded |
diff --git a/internal/wire/design.go b/internal/wire/design.go| index 4caa33ca..f36b34a8 100644 |
| --- a/internal/wire/design.go |
| +++ b/internal/wire/design.go |
| @@ -721,8 +721,9 @@ func designFeedbackDispatch(d *DispatchCommand) bool { |
| // downgradeDesignFeedback makes a frame speak a protocol below |
| // ProtocolDesignFeedback. A Design dispatch, and any dispatch with taste |
| -// or a round request, is refused (designFeedbackDispatch), and so is an |
| -// ask_design_taste call (an older instance has no discovery card). A |
| +// or a round request, is refused (designFeedbackDispatch), and so are an |
| +// ask_design_taste call (an older instance has no discovery card) and a |
| +// design_launch check (the runner sends a plain one there instead). A |
| // report's pack digest, its option directions and pages and its |
| // captures' labels and render facts are dropped (its names and captures |
| // stay valid under ValidOptions), and so are propose_specialist's |
| @@ -734,6 +735,10 @@ func downgradeDesignFeedback(body any, protocol int) (bool, error) { |
| if designFeedbackDispatch(v) { |
| return false, fmt.Errorf("%w: a Design dispatch at protocol %d", ErrProtocol, protocol) |
| } |
| + case *LeaseCheck: |
| + if v.Purpose == LeasePurposeLaunch { |
| + return false, fmt.Errorf("%w: a launch check at protocol %d", ErrProtocol, protocol) |
| + } |
| case *ToolCall: |
| if v.Name == ToolAskDesignTaste { |
| return false, fmt.Errorf("%w: %s at protocol %d", ErrProtocol, v.Name, protocol) |
diff --git a/internal/wire/design_feedback_test.go b/internal/wire/design_feedback_test.go| index e8abda16..d1e57416 100644 |
| --- a/internal/wire/design_feedback_test.go |
| +++ b/internal/wire/design_feedback_test.go |
| @@ -237,7 +237,7 @@ func TestDowngradeDesignFeedback(t *testing.T) { |
| for _, b := range []struct { |
| kind string |
| body any |
| - }{{wire.FrameDispatch, bare}, {wire.FrameDispatch, asked}, {wire.FrameDispatch, full}, {wire.FrameStep, report}, {wire.FrameToolCall, ask}, {wire.FrameToolCall, propose}} { |
| + }{{wire.FrameDispatch, bare}, {wire.FrameDispatch, asked}, {wire.FrameDispatch, full}, {wire.FrameStep, report}, {wire.FrameToolCall, ask}, {wire.FrameToolCall, propose}, {wire.FrameLease, wire.LeaseCheck{Generation: 1, StepID: "s_1", Attempt: 1, Purpose: wire.LeasePurposeLaunch}}} { |
| f, err := wire.NewFrame("x", b.kind, b.body) |
| if err != nil { |
| t.Fatal(err) |
| @@ -249,8 +249,9 @@ func TestDowngradeDesignFeedback(t *testing.T) { |
| t.Fatalf("%s changed at 39: %v", f.Type, err) |
| } |
| } |
| - // Refused at 38 and below. |
| - for i, f := range []wire.Frame{frames[0], frames[1], frames[2], frames[4]} { |
| + // Refused at 38 and below (a launch check too: an older instance |
| + // would take it for no check it knows and refuse every launch). |
| + for i, f := range []wire.Frame{frames[0], frames[1], frames[2], frames[4], frames[6]} { |
| for _, p := range []int{wire.ProtocolDesign, wire.ProtocolMacEngineering, wire.Protocol2} { |
| if _, err := wire.Encode(f, p); !errors.Is(err, wire.ErrProtocol) { |
| t.Fatalf("frame %d (%s) encoded at %d: %v", i, f.Data, p, err) |
diff --git a/internal/wire/frames.go b/internal/wire/frames.go| index d12b453c..f877f89b 100644 |
| --- a/internal/wire/frames.go |
| +++ b/internal/wire/frames.go |
| @@ -463,6 +463,14 @@ type LeaseCheck struct { |
| // the step's specialist binding again and acks only while it holds. |
| const LeasePurposeRender = "page_render" |
| +// LeasePurposeLaunch is a LeaseCheck's Purpose right before each launch |
| +// of a Design attempt's process (ProtocolDesignFeedback): the instance |
| +// checks the creator's notes and the runner's protocol again every |
| +// time, so an attempt the scheduler held after its start, then launched |
| +// later, never launches with notes that changed meanwhile. Below |
| +// ProtocolDesignFeedback the runner sends a plain start check instead. |
| +const LeasePurposeLaunch = "design_launch" |
| + |
| // LeasePurposeMerge is a LeaseCheck's Purpose right before a hub merge |
| // request. |
| const LeasePurposeMerge = "merge_request" |
diff --git a/internal/wire/runners.go b/internal/wire/runners.go| index c70965df..f4ec5831 100644 |
| --- a/internal/wire/runners.go |
| +++ b/internal/wire/runners.go |
| @@ -777,8 +777,8 @@ var ErrProtocol = errors.New("wire: frame not in this protocol") |
| // a bound dispatch, a render check, a render_file chunk and a proposal |
| // for one project are refused and a report's options and render records |
| // dropped (downgradeDesign). Below ProtocolDesignFeedback a Design |
| -// dispatch, a dispatch with taste or a round request and an |
| -// ask_design_taste call are refused, and a report's directions, pages, |
| +// dispatch, a dispatch with taste or a round request, a design_launch |
| +// check and an ask_design_taste call are refused, and a report's directions, pages, |
| // labels and render facts and a proposal's feels dropped |
| // (downgradeDesignFeedback). |
| func Encode(f Frame, protocol int) (Frame, error) { |