Abilities: a held job says why, and Carry on resumes it
A held job's card reads Stopped with "Building is turned off for you. <Owner> can turn it back on, or you can drop this." and no Carry on now; once building is on again it says "Building is on again. You can carry on with this, or drop it." and offers carry_on with no other plan. The cards are redrawn when the board changes. Carry on now on a held job (and team_nudge on one in a person turn, for an app that can't draw it) runs resumeAbilityHold: the hold is cleared, an attempt that ended without its start being granted runs afresh, and the thread's waiting turns are dispatched; without building it is 403 ability_off with the card. A double tap resumes once. API error copy: ability_off, host_unverified and host_elsewhere reuse approved words (api.forbidden's, api.host_not_allowed's), with inventory rows; the codes are literals where the copy scan reads them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
10 files changed,
+282
−9
docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md+3 −0internal/equipo/chat/abilities_fetch.go+6 −0internal/equipo/chat/ability_hold.go+98 −0internal/equipo/chat/assistant_http.go+5 −2internal/equipo/chat/handoff.go+14 −0internal/equipo/chat/http.go+1 −1internal/equipo/chat/job_paused.go+18 −2internal/equipo/chat/jobs.go+18 −4internal/equipo/copy.go+8 −0internal/thintest/ability_hold_contract_test.go+111 −0
diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md| index ee361291..30ec4c73 100644 |
| --- a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md |
| +++ b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md |
| @@ -4769,6 +4769,9 @@ All eight entries have individual `COPY REVIEW REQUIRED` markers. The API guide |
| | `assistant.job.detail.go_live_off` | Putting it live is turned off for you. %s can turn it on. | Assistant abilities: a ready job while putting live is off | COPY APPROVED (Paul, 2026-11-28, copy-review mi3kgi7nubnsf7kxn235tqwrbu, unchanged) | |
| | `chat.card.ability_off` | Building is turned off for you, so this can't start. You can still drop it. | Assistant abilities: a job card answered in Equipo while building is off | COPY APPROVED (Paul, 2026-11-28, copy-review mi3kgi7nubnsf7kxn235tqwrbu, unchanged) | |
| | `oficina.connect.ability_off` | Reading your Oficina apps is turned off for you. %s can turn it on. | Assistant abilities: connecting Oficina refused | COPY APPROVED (Paul, 2026-11-28, copy-review mi3kgi7nubnsf7kxn235tqwrbu, unchanged) | |
| +| `api.host_unverified` | Equipo is not set up to connect to this address. | Assistant abilities: PUT host's token not honoured by Base (Base reads it only); reuses `api.host_not_allowed`'s words | COPY APPROVED (Paul, 2026-11-13, copy-review jbltdd2mvwblrz4en6xfhv6d2y, unchanged) | |
| +| `api.host_elsewhere` | Equipo is not set up to connect to this address. | Assistant abilities: the person's Base is another (Base reads it only); reuses `api.host_not_allowed`'s words | COPY APPROVED (Paul, 2026-11-13, copy-review jbltdd2mvwblrz4en6xfhv6d2y, unchanged) | |
| +| `api.ability_off` | You cannot do that with your current access. | Assistant abilities: an ability the person needs is off; reuses `api.forbidden`'s words | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| Oficina ID consumer: COPY ACCEPTED BY DELEGATION (Astra, 2026-11-13). |
diff --git a/internal/equipo/chat/abilities_fetch.go b/internal/equipo/chat/abilities_fetch.go| index 1d820bc0..56f5a161 100644 |
| --- a/internal/equipo/chat/abilities_fetch.go |
| +++ b/internal/equipo/chat/abilities_fetch.go |
| @@ -170,6 +170,12 @@ func (s *Store) RefreshAbilities(ctx context.Context, person string) (revision i |
| if err != nil { |
| return err |
| } |
| + if changed { |
| + // A held job's card says whether building is on again. |
| + if err := t.reprojectHeld(person); err != nil { |
| + return err |
| + } |
| + } |
| var r abilitiesRecord |
| if err := t.db.Where("person = ? AND origin = ?", person, origin).Limit(1).Find(&r).Error; err != nil { |
| return err |
diff --git a/internal/equipo/chat/ability_hold.go b/internal/equipo/chat/ability_hold.go| index 55336285..ccde36af 100644 |
| --- a/internal/equipo/chat/ability_hold.go |
| +++ b/internal/equipo/chat/ability_hold.go |
| @@ -1,6 +1,8 @@ |
| package chat |
| import ( |
| + "errors" |
| + "fmt" |
| "slices" |
| "amadan.net/oficina/equipo/internal/equipo/assist" |
| @@ -101,3 +103,99 @@ func (t *txn) requireBuild(person string) error { |
| res := t.s.abilityRefusal(sw, wire.AbilityBuild) |
| return assist.Failure{Code: res.Code, Message: res.Text} |
| } |
| + |
| +// heldCarryOn marks a held job's carry_on: Carry on now resumes the hold |
| +// (resumeAbilityHold) rather than releasing a pause on another plan, so |
| +// the card carries no carry_on_connection. |
| +const heldCarryOn = "\x00held" |
| + |
| +// heldView is a held job's card: stopped, saying why and who can turn |
| +// building back on, or, once it is on again, that it is and that Carry |
| +// on now resumes it. |
| +func (t *txn) heldView(h handoffRecord) (result, detail, carryOn string, err error) { |
| + sw, err := t.switches(h.Person) |
| + if err != nil { |
| + return "", "", "", err |
| + } |
| + result = t.copy("assistant.job." + wire.JobStopped) |
| + if sw.Can(wire.AbilityBuild) { |
| + return result, t.copy("assistant.job.detail.ability_back"), heldCarryOn, nil |
| + } |
| + if sw.Ask() == "" { |
| + return result, t.copy("assistant.job.detail." + wire.JobStopped), "", nil |
| + } |
| + return result, fmt.Sprintf(t.copy("assistant.job.detail.ability_off"), sw.Ask()), "", nil |
| +} |
| + |
| +// resumeAbilityHold is Carry on now on a held job, once building is on |
| +// again for its person (§6.3): the hold is cleared, a step attempt that |
| +// ended without its start being granted (the hold refused it) is tried |
| +// afresh, the thread's waiting turns are |
| +// dispatched in order, and the card is redrawn. Steps never dispatched |
| +// simply become eligible again. |
| +func (t *txn) resumeAbilityHold(h handoffRecord) error { |
| + ok, err := t.buildAllowed(h) |
| + if err != nil { |
| + return err |
| + } |
| + if !ok { |
| + return ErrAbilityOff |
| + } |
| + if err := t.db.Model(&handoffRecord{}).Where("id = ?", h.ID).Update("ability_held_at", nil).Error; err != nil { |
| + return err |
| + } |
| + h.AbilityHeldAt = nil |
| + tasks, err := t.handoffTasks(h) |
| + if err != nil { |
| + return err |
| + } |
| + for _, k := range tasks { |
| + if wire.FinalStage(k.Stage) { |
| + continue |
| + } |
| + steps, err := t.steps(k.ID) |
| + if err != nil { |
| + return err |
| + } |
| + // The attempt that ended without ever being granted its start: |
| + // the one the hold refused. |
| + if len(steps) == 0 { |
| + continue |
| + } |
| + last := steps[len(steps)-1] |
| + if !wire.StepTerminal(last.State) || last.State == wire.StepDone || last.StartedAt != nil { |
| + continue |
| + } |
| + // It did no work: it failed to start, which a retry runs afresh |
| + // (a runner reports a start refused as cancelled). |
| + if last.State == wire.StepCancelled { |
| + if err := t.db.Model(&stepRecord{}).Where("id = ? AND attempt = ?", last.ID, last.Attempt).Update("state", wire.StepFailed).Error; err != nil { |
| + return err |
| + } |
| + } |
| + if _, err := t.retryStep(&k, h.Person); err != nil && !errors.Is(err, ErrNotRetryable) && !errors.Is(err, ErrForbidden) { |
| + return err |
| + } |
| + } |
| + if h.Lane != "" { |
| + if err := t.dispatchNext(h.Person, h.Lane); err != nil { |
| + return err |
| + } |
| + } |
| + return t.projectJob(h) |
| +} |
| + |
| +// reprojectHeld redraws the person's held jobs' cards: building turned |
| +// on or off changes what they say. |
| +func (t *txn) reprojectHeld(person string) error { |
| + var held []handoffRecord |
| + if err := t.db.Where("person = ? AND ability_held_at IS NOT NULL", person).Find(&held).Error; err != nil { |
| + return err |
| + } |
| + for _, h := range held { |
| + if err := t.projectJob(h); err != nil { |
| + return err |
| + } |
| + } |
| + return nil |
| +} |
diff --git a/internal/equipo/chat/assistant_http.go b/internal/equipo/chat/assistant_http.go| index 9d848703..6f375cb4 100644 |
| --- a/internal/equipo/chat/assistant_http.go |
| +++ b/internal/equipo/chat/assistant_http.go |
| @@ -168,10 +168,10 @@ func (h *HTTP) assistantHost(w http.ResponseWriter, r *http.Request, p personapi |
| personapi.WriteError(w, r, http.StatusForbidden, "host_not_allowed", nil) |
| return |
| case errors.Is(err, ErrHostUnverified): |
| - personapi.WriteError(w, r, http.StatusConflict, wire.CodeHostUnverified, nil) |
| + personapi.WriteError(w, r, http.StatusConflict, "host_unverified", nil) |
| return |
| case errors.Is(err, ErrHostElsewhere): |
| - personapi.WriteError(w, r, http.StatusConflict, wire.CodeHostElsewhere, nil) |
| + personapi.WriteError(w, r, http.StatusConflict, "host_elsewhere", nil) |
| return |
| } |
| if err != nil { |
| @@ -287,6 +287,9 @@ func (h *HTTP) carryOn(w http.ResponseWriter, r *http.Request, p personapi.Perso |
| writeJSON(w, http.StatusConflict, wire.AssistantConflict{Code: "not_paused", CopyKey: "api.not_paused", RequestID: request, Card: out}) |
| case errors.Is(err, ErrCarryOnUnavailable): |
| writeJSON(w, http.StatusConflict, wire.AssistantConflict{Code: "carry_on_unavailable", CopyKey: "api.carry_on_unavailable", RequestID: request, Card: out}) |
| + case errors.Is(err, ErrAbilityOff): |
| + // Building is off for the person: the card as it is now. |
| + writeJSON(w, http.StatusForbidden, wire.AssistantConflict{Code: "ability_off", CopyKey: "api.ability_off", RequestID: request, Card: out}) |
| default: |
| h.fail(w, r, err) |
| } |
diff --git a/internal/equipo/chat/handoff.go b/internal/equipo/chat/handoff.go| index 94f8bba9..28c64b57 100644 |
| --- a/internal/equipo/chat/handoff.go |
| +++ b/internal/equipo/chat/handoff.go |
| @@ -1728,6 +1728,20 @@ func (s *Store) teamNudge(ctx context.Context, call toolCallRecord, input json.R |
| if err := t.aboutJob(r, h); err != nil { |
| return err |
| } |
| + if h.AbilityHeldAt != nil && r.Kind == wire.TurnPerson { |
| + // A job held while building was off: the person asking to |
| + // push it on is their Carry on now (abilities AD4). |
| + if err := t.resumeAbilityHold(h); errors.Is(err, ErrAbilityOff) { |
| + return t.requireBuild(h.Person) |
| + } else if err != nil { |
| + return err |
| + } |
| + out, _ = json.Marshal(map[string]any{"request": h.ID, "status": "nudged", "nudges_left": maxNudges - h.Nudges}) |
| + return t.db.Create(&handoffActionRecord{LedgerKey: key, HandoffID: h.ID, Person: h.Person, Kind: actionNudge, Result: string(out), CreatedAt: t.now()}).Error |
| + } |
| + if err := t.requireBuild(h.Person); err != nil { |
| + return err |
| + } |
| reason, err := t.stopReason(h) |
| switch { |
| case err != nil: |
diff --git a/internal/equipo/chat/http.go b/internal/equipo/chat/http.go| index 4bf07e83..94f406ad 100644 |
| --- a/internal/equipo/chat/http.go |
| +++ b/internal/equipo/chat/http.go |
| @@ -400,7 +400,7 @@ func (h *HTTP) fail(w http.ResponseWriter, r *http.Request, err error) { |
| case errors.Is(err, ErrForbidden): |
| personapi.WriteError(w, r, 403, "forbidden", nil) |
| case errors.Is(err, ErrAbilityOff): |
| - personapi.WriteError(w, r, 403, wire.CodeAbilityOff, nil) |
| + personapi.WriteError(w, r, 403, "ability_off", nil) |
| case errors.Is(err, ErrBusy): |
| personapi.WriteError(w, r, 409, "coordinator_busy", nil) |
| case errors.Is(err, ErrTaskEnded): |
diff --git a/internal/equipo/chat/job_paused.go b/internal/equipo/chat/job_paused.go| index 3cfb4a60..a81f4806 100644 |
| --- a/internal/equipo/chat/job_paused.go |
| +++ b/internal/equipo/chat/job_paused.go |
| @@ -241,10 +241,26 @@ func (s *Store) CarryOn(ctx context.Context, person, id string, in wire.CarryOn) |
| return err |
| } |
| out = now |
| - switch { |
| - case now.Revision != in.Revision: |
| + if now.Revision != in.Revision { |
| refused = ErrCardConflict |
| return nil |
| + } |
| + if h.ID != "" && h.AbilityHeldAt != nil && h.State == handoffOpen { |
| + // A job held while building was off: Carry on now resumes it, |
| + // once building is on again (abilities §6.3). |
| + if err := t.resumeAbilityHold(h); errors.Is(err, ErrAbilityOff) { |
| + refused = ErrAbilityOff |
| + return nil |
| + } else if err != nil { |
| + return err |
| + } |
| + if err := t.db.Create(&handoffActionRecord{LedgerKey: key, HandoffID: h.ID, Person: person, Kind: actionCarryOn, Result: "resumed", CreatedAt: t.now()}).Error; err != nil { |
| + return err |
| + } |
| + out, err = t.assistantCardOf(c.ID) |
| + return err |
| + } |
| + switch { |
| case now.State != wire.JobPaused: |
| refused = ErrNotPaused |
| return nil |
diff --git a/internal/equipo/chat/jobs.go b/internal/equipo/chat/jobs.go| index 990c6fc0..4a34a9a4 100644 |
| --- a/internal/equipo/chat/jobs.go |
| +++ b/internal/equipo/chat/jobs.go |
| @@ -211,6 +211,11 @@ func (t *txn) jobView(h handoffRecord) (state, result, detail, carryOn string, l |
| if _, ok := wire.JobOf(h.Lane); ok && t.s.authority.Origin != "" { |
| links = append(links, wire.CardLink{Label: t.copy("assistant.job.open"), URL: strings.TrimSuffix(t.s.authority.Origin, "/") + "/jobs/" + h.ID, Rel: wire.LinkEquipo}) |
| } |
| + if h.AbilityHeldAt != nil && h.State == handoffOpen && state != wire.JobDone { |
| + // Held because building was off for its person (§6.3). |
| + result, detail, carryOn, err := t.heldView(h) |
| + return wire.JobStopped, result, detail, carryOn, links, err |
| + } |
| if state == wire.JobWorking { |
| // Working, unless all its open work is paused (job_paused.go). |
| p, err := t.jobPaused(h) |
| @@ -358,16 +363,16 @@ func (t *txn) projectJob(h handoffRecord) error { |
| if err != nil { |
| return err |
| } |
| - c = cardRecord{ID: newID("c_"), Person: h.Person, Kind: wire.CardJob, State: state, TurnID: h.AssistantTurn, Question: title, Options: "[]", Links: string(raw), Result: result, Detail: detail, CarryOn: carryOn != "", CarryOnConnection: carryOn, HandoffID: h.ID, Revision: 1, CreatedAt: now, UpdatedAt: now, Lane: wire.LaneAssistant} |
| + c = cardRecord{ID: newID("c_"), Person: h.Person, Kind: wire.CardJob, State: state, TurnID: h.AssistantTurn, Question: title, Options: "[]", Links: string(raw), Result: result, Detail: detail, CarryOn: carryOn != "", CarryOnConnection: connectionOf(carryOn), HandoffID: h.ID, Revision: 1, CreatedAt: now, UpdatedAt: now, Lane: wire.LaneAssistant} |
| if err := t.db.Create(&c).Error; err != nil { |
| return err |
| } |
| return t.cardEvent(c) |
| } |
| - if c.State == state && c.Result == result && c.Detail == detail && c.CarryOn == (carryOn != "") && c.CarryOnConnection == carryOn && c.Links == string(raw) { |
| + if c.State == state && c.Result == result && c.Detail == detail && c.CarryOn == (carryOn != "") && c.CarryOnConnection == connectionOf(carryOn) && c.Links == string(raw) { |
| return nil |
| } |
| - c.State, c.Result, c.Detail, c.CarryOn, c.CarryOnConnection, c.Links = state, result, detail, carryOn != "", carryOn, string(raw) |
| + c.State, c.Result, c.Detail, c.CarryOn, c.CarryOnConnection, c.Links = state, result, detail, carryOn != "", connectionOf(carryOn), string(raw) |
| c.Revision++ |
| c.UpdatedAt = now |
| if err := t.db.Model(&cardRecord{}).Where("id = ?", c.ID).Select("state", "result", "detail", "carry_on", "carry_on_connection", "links", "revision", "updated_at").Updates(&c).Error; err != nil { |
| @@ -392,7 +397,7 @@ func (t *txn) updateEnded(turnID string) error { |
| // written is offered no more, before the minute's tick moves the card |
| // (expirePreviews). |
| func (t *txn) jobCardView(v *wire.AssistantCard, c cardRecord) error { |
| - v.Result, v.Detail, v.CarryOn = c.Result, c.Detail, c.CarryOn && c.State == wire.JobPaused |
| + v.Result, v.Detail, v.CarryOn = c.Result, c.Detail, c.CarryOn && (c.State == wire.JobPaused || c.State == wire.JobStopped) |
| if c.Links != "" { |
| if err := json.Unmarshal([]byte(c.Links), &v.Links); err != nil { |
| return err |
| @@ -495,3 +500,12 @@ func (t *txn) jobOf(c cardRecord) (string, error) { |
| } |
| return ids[0], nil |
| } |
| + |
| +// connectionOf is a job card's carry_on_connection for jobView's carryOn: |
| +// none for a held job's, whose Carry on now resumes the hold. |
| +func connectionOf(carryOn string) string { |
| + if carryOn == heldCarryOn { |
| + return "" |
| + } |
| + return carryOn |
| +} |
diff --git a/internal/equipo/copy.go b/internal/equipo/copy.go| index c9f242e6..4af54cb3 100644 |
| --- a/internal/equipo/copy.go |
| +++ b/internal/equipo/copy.go |
| @@ -2885,6 +2885,14 @@ var runnerDraftCopy = map[string]string{ |
| "api.runner_too_old": "Your runner needs an update for this. Update it and try again.", // COPY APPROVED (Paul, 2026-11-13, copy-review jbltdd2mvwblrz4en6xfhv6d2y, unchanged) |
| // PUT /api/v1/assistant/host with an origin the operator has not allowed. |
| "api.host_not_allowed": "Equipo is not set up to connect to this address.", // COPY APPROVED (Paul, 2026-11-13, copy-review jbltdd2mvwblrz4en6xfhv6d2y, unchanged) |
| + // PUT host's token not honoured by Base (host_unverified), or the |
| + // person's Base is another (host_elsewhere): only Base reads these, and |
| + // they reuse host_not_allowed's approved words (abilities plan). |
| + "api.host_unverified": "Equipo is not set up to connect to this address.", // COPY APPROVED (Paul, 2026-11-13, copy-review jbltdd2mvwblrz4en6xfhv6d2y, unchanged) |
| + "api.host_elsewhere": "Equipo is not set up to connect to this address.", // COPY APPROVED (Paul, 2026-11-13, copy-review jbltdd2mvwblrz4en6xfhv6d2y, unchanged) |
| + // An ability the person needs is off (abilities spec): api.forbidden's |
| + // words, reused. |
| + "api.ability_off": "You cannot do that with your current access.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| // The Assistant's files (assistant attachments spec 2026-11-26): a send |
| // with files while the person's runner can't read them yet, and removing |
| // an upload that is already on a message. |
diff --git a/internal/thintest/ability_hold_contract_test.go b/internal/thintest/ability_hold_contract_test.go| new file mode 100644 |
| index 00000000..644431c9 |
| --- /dev/null |
| +++ b/internal/thintest/ability_hold_contract_test.go |
| @@ -0,0 +1,111 @@ |
| +package thintest |
| + |
| +import ( |
| + "errors" |
| + "net/http" |
| + "strings" |
| + "testing" |
| + |
| + "amadan.net/oficina/equipo/internal/wire" |
| +) |
| + |
| +const heldOff = "Building is turned off for you. Paul can turn it back on, or you can drop this." |
| +const heldBack = "Building is on again. You can carry on with this, or drop it." |
| + |
| +// heldCard is the request's job card, as a client that knows paused |
| +// work reads it, once its detail is detail. |
| +func (o *teamRig) heldCard(request, detail string) wire.AssistantCard { |
| + o.t.Helper() |
| + return o.jobKnowing(request, "the job card saying "+detail, func(c wire.AssistantCard) bool { return c.Detail == detail }) |
| +} |
| + |
| +// heldJob is a job whose second step was refused its start once building |
| +// went off for the owner: the request and the refused step's dispatch. |
| +func (o *teamRig) heldJob() (string, *wire.DispatchCommand) { |
| + o.t.Helper() |
| + o.ask("Fix the README.") |
| + request, cmd := o.handoff("hj", "Fix the README.", "") |
| + var d *wire.DispatchCommand |
| + o.in(cmd.TurnID, func() { _, d = o.started("hj", "Fix teh") }) |
| + o.reply(cmd.TurnID) |
| + o.reply(o.turn) |
| + o.setBoard(wire.AbilityBuild) |
| + if refused := o.lease(o.runner, "hj-start", wire.LeaseCheck{StepID: d.StepID, Attempt: d.Attempt}); refused != wire.CodeAbilityOff { |
| + o.t.Fatalf("start: %q", refused) |
| + } |
| + // The runner gives up the attempt it couldn't start. |
| + o.step("hj-gone", wire.StepReport{TaskID: d.TaskID, StepID: d.StepID, Attempt: d.Attempt, State: wire.StepCancelled, Reason: wire.CodeAbilityOff, BaseSHA: d.BaseSHA, Termination: true}) |
| + return request, d |
| +} |
| + |
| +// The held job's card says why, with no Carry on now while building is |
| +// off; once on again it says so and offers Carry on now, with no other |
| +// plan (no carry_on_connection), and without building it is refused 403 |
| +// ability_off with the card. |
| +func TestBuildOffStopRowHasCarryOn(t *testing.T) { |
| + o := newTeamRig(t) |
| + request, _ := o.heldJob() |
| + off := o.heldCard(request, heldOff) |
| + if off.State != wire.JobStopped || off.CarryOn || off.Result != "Stopped" { |
| + t.Errorf("held, building off: %+v", off) |
| + } |
| + var s *ErrStatus |
| + if _, err := o.a.CarryOn(o.ctx, off.ID, off.Revision, "co-off"); !errors.As(err, &s) || s.Status != http.StatusForbidden || !strings.Contains(string(s.Body), `"ability_off"`) || !strings.Contains(string(s.Body), off.ID) { |
| + t.Errorf("carry on with building off: %v", err) |
| + } |
| + o.setBoard() |
| + back := o.heldCard(request, heldBack) |
| + if back.State != wire.JobStopped || !back.CarryOn { |
| + t.Errorf("held, building back on: %+v", back) |
| + } |
| +} |
| + |
| +// Carry on now resumes the held job: the refused step is tried afresh, |
| +// once, however often it is tapped. |
| +func TestAbilityHoldResumes(t *testing.T) { |
| + o := newTeamRig(t) |
| + request, d := o.heldJob() |
| + o.setBoard() |
| + card := o.heldCard(request, heldBack) |
| + out, err := o.a.CarryOn(o.ctx, card.ID, card.Revision, "resume-1") |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if out.Card.CarryOn || out.Card.Detail == heldBack { |
| + t.Errorf("after Carry on now: %+v", out.Card) |
| + } |
| + again := o.nextDispatch() |
| + if again.StepID != d.StepID || again.Attempt <= d.Attempt { |
| + t.Errorf("the refused step wasn't tried afresh: %+v", again) |
| + } |
| + if n := o.rows("SELECT count(*) FROM chat_handoffs WHERE id = ? AND ability_held_at IS NULL", request); n != 1 { |
| + t.Error("still held") |
| + } |
| + if n := o.rows("SELECT count(*) FROM chat_cards WHERE handoff_id = ? AND kind = ? AND coalesce(carry_on_connection, '') <> ''", request, wire.CardJob); n != 0 { |
| + t.Error("a held job's card named another plan") |
| + } |
| + if _, err := o.a.CarryOn(o.ctx, card.ID, card.Revision, "resume-1"); err != nil { |
| + t.Errorf("the same tap again: %v", err) |
| + } |
| + if _, err := o.a.CarryOn(o.ctx, out.Card.ID, out.Card.Revision, "resume-2"); err == nil { |
| + t.Error("a second tap resumed again") |
| + } |
| + if refused := o.lease(o.runner, "resumed-start", wire.LeaseCheck{StepID: again.StepID, Attempt: again.Attempt}); refused != "" { |
| + t.Errorf("the resumed step's start: %q", refused) |
| + } |
| +} |
| + |
| +// Asked in the conversation, with building on again, team_nudge resumes |
| +// a held job, as Carry on now does: for an app that can't draw it. |
| +func TestNudgeResumesHeldJob(t *testing.T) { |
| + o := newTeamRig(t) |
| + request, d := o.heldJob() |
| + o.setBoard() |
| + o.ask("Please carry on with the README.") |
| + if res := o.use("nd", "team_nudge", map[string]any{"request": request, "words": "Please carry on with the README."}); res.IsError { |
| + t.Fatalf("nudge: %+v", res) |
| + } |
| + if again := o.nextDispatch(); again.StepID != d.StepID { |
| + t.Errorf("not resumed: %+v", again) |
| + } |
| +} |