equipo: Task 24 review 2, an uncertified cancel settles no evidence
Under the person's cancellation, or once the task has ended, a bound, uncertified hosted runner's terminal report no longer goes through ordinary worker handling, which stored its checks, tainted it on a bubblewrap claim and kept a seatbelt claim. hostedSettleCancel takes only the termination. The step ends cancelled, terminated, with no checks, gate, exit code, base checks or sandbox, and no taint. Its job stops for the step's end, so nothing is placed again. TestHostedUncertifiedCancelRace covers stale and withdrawn admissions with bubblewrap and seatbelt claims. Mutations 367 and 368 are recorded.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5 files changed,
+109
−5
.rastrillo/budgets.txt+1 −1docs/superpowers/plans/HOSTED-SLICE2-PROGRESS.md+33 −0internal/equipo/chat/hosted_results.go+22 −0internal/equipo/chat/hosted_results_test.go+44 −0internal/equipo/chat/tasks.go+9 −4
CI failed — run details
CI log
=== prepare ===
ci-box: machine: aarch64, 32 CPUs, 62 GiB memory, kernel 7.0.0-1017-aws
ci-box: python 3.12.3; Docker version 29.1.3, build 29.1.3-0ubuntu3~24.04.2
ci-box: user namespaces allowed: 233151
ci-box: cgroup: cgroup2fs
ci-box: disk /home/ci/work/repos/oficina__equipo/wt/hosted-runners-2: Type Size Avail | ext4 96G 84G
ci-box: disk /home/ci/.cache/equipo-ci-box: Type Size Avail | ext4 96G 84G
ci-box: bwrap: fetched and verified in 0.3s
ci-box: claude: fetched and verified in 2.3s
ci-box: codex: fetched and verified in 3.4s
ci-box: codex-code-mode-host: fetched and verified in 1.4s
ci-box: libwrap: fetched and verified in 0.3s
ci-box: socat: fetched and verified in 0.3s
npm warn deprecated node-domexception@1.0.0: Use your platform's native DOMException instead
ci-box: image pulled in 9.8s
ci-box: pi: installed and verified in 7.6s
ci-box: opencode: installed and verified in 2.3s
ci-box: chromium 156.0.8078.79-1~deb13u1: 76 packages fetched, verified and unpacked in 8.8s
ci-box: clone deepened in 4.9s
ci-box: file times set from content: 3912 files, 272 directories
ci-box: ready in 18.7s
=== copy ===
EQUIPO_RELEASE_COPY_CHECK=1 CGO_ENABLED=0 go test ./internal/equipotest -run '^TestReleaseCopyReviewed$' -count=1
--- FAIL: TestReleaseCopyReviewed (0.09s)
task_pages_test.go:236: COPY REVIEW REQUIRED: copy-status.py verify found copy pending review or stale bookkeeping
FAIL
rastrillo-budget/v1 ran 89ms
FAIL amadan.net/oficina/equipo/internal/equipotest 0.242s
FAIL
make: *** [Makefile:273: copy-release-check] Error 1
amadan: step copy failed: exit status 2
amadan: job failed at step copy — its output is above, not at the tail of this log
diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt| index adc2acf4..d21952ae 100644 |
| --- a/.rastrillo/budgets.txt |
| +++ b/.rastrillo/budgets.txt |
| @@ -60,7 +60,7 @@ perf GET /api/v1/assistant/snapshot skip Assistant person API: bearer-only JSON |
| 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. |
| perf GET /api/v1/assistant/abilities skip Assistant person API: bearer-only JSON for Base's Settings line, not a browser screen. |
| -size internal/equipo/chat 47096 21714 File facts/diffs, previews, merges, unfinished work, CI, receipts, Assistant files, places, abilities, lookups, go-aheads, Mac work, D1, Design specialists, grants, captures; 45093/18782. Hosted slice 2 Task 15: openHostedPack (the instance's send_pack for a hosted pack) and its test; 45105/18883. Its review round 1 added the report-ingestion test for pack_incomplete; 45105/18911. Task 18: hosted_setting.go (SetHostedChecks, hostedChecks, HostedSettings; owner only, roster in the transaction, audited) and its tests; 45208/19070. Its review round 1: the audit atomicity test; 45208/19113. Task 19: hosted_jobs.go (the hosted_jobs and hosted_challenges tables, HostedJob and its lifecycle: newHostedJob, the listed moves only, ended and failed only with stop proof or never-launched evidence, settleHostedJob once, hostedJobForRunner; each move audited in its transaction) and its tests, TestMigrationAdditive included; 45658/19577. Its review round 1: the never-launched evidence contract (HostedNeverLaunched, launch_by and launching_since, hostedLaunchReturned) and tests for it, settlement of unproven terminal records and audit atomicity; 45728/19739. Task 20: hosted_limits.go (per-person hosted limits, S2-9: hostedAdmit held in the write by a per-person lock row, hostedHoldFor, Allocate, hostedSettle at 4x the baseline, SetHostedLimits owner only with the roster, revision and audit in the transaction) and its tests; 46013/20214. Its coordinator ruling: a limit counts only while its setting owner is a current owner (defaults otherwise, checked in the admission transaction) and TestOwnerRaisesLimitRevoked; 46022/20284. Its review round 1: Allocate returns nothing for an empty or reversed span before widening, and its assertions; 46025/20290. Hosted slice 2 Task 21: placement on hosted VMs (placeHosted before the checks early return, its five rules), the bound runner's fits, Authorize by job identity, the hosted offline rule and withdrawal exemption, the hosted pack at dispatch, the step-terminal hook, and the dispatcher's store methods (HostedLive, HostedSweep, HostedLaunching with relaunch, HostedLaunched, HostedAdmitted, HostedFailed, HostedStopped, HostedNeverLaunched, HostedReplaces, PlaceHosted; end, settle, revoke, step moved on) in hosted_run.go, and hosted_place_test.go; 46665/20804. Task 21 review round 1: abandoned-intent evidence waits for the job's lifetime, the job keeps its lifetime and first running sight, admission takes the placing transaction's step attempt, provider-valid attempt IDs, HostedRunning, and the Retry, replacement-runner, cancelled-task and stopping-VM tests; 46709/20937. Its review round 2: TestHostedReplacesNeedsProof; 46709/20971. Task 22: hosted_enrol.go (the enrolment and renewal store steps inside the instance's write transaction: HostedClaimCode, HostedEnrolAdmit, HostedEnrolBind, HostedRunnerJob, HostedNewChallenge, HostedUseChallenge; hostedAdmitted shared with HostedAdmitted); its tests drive it through the instance's routes (internal/equipo); 46848/20971. Its review round 1: hostedAdmitted reports whether the record was kept, the enrolment records the first sighting and applies the window from it, and the launch view's deadline is kept (hosted_jobs.deadline, earliest wins); 46903/20971. Its review round 2: an admission record's current deadline is kept too (hostedAdmitted, for the dispatcher's refresh and the renewal's HostedRenewAdmit); 46932/20971. Round 3: HostedEnrolAdmit returns the job re-read after recording the admission, so the enrolment caps by its deadline; 46937/20971. Task 23: openHostedPack opens the deps bundle after the hosted pack (send_pack with Deps), the instance's chunk and byte checks per kind (wire.MaxChunks, wire.MaxBytes), deps_too_large for a bundle past its limit, and a hosted attempt's pack and bundle closed when its checks end; hosted_deps_test.go; 46957/21199. Task 24: hosted_results.go (hostedCertified, AdmissionFresh: a hosted worker's checks count as sandboxed and its base checks as trusted only through the job's fresh, valid admission record, never its hello; an uncertified hosted result is not kept, its job stops and the step goes again once; deps_new_module and deps_missing presented as needs_network), stepReport and acceptBaseChecks wired to it, the admission kept whole and the enrolment image (0129), and hosted_results_test.go; 47094/21522. Task 24 review round 1: the certification decision moved before any terminal checks report from a worker (done, failed, unsolicited cancelled, the early failure branches), the person's cancellation kept, and tests for those, a wrong step, a stopping job and each admission identity substitution; 47096/21714. |
| +size internal/equipo/chat 47123 21758 File facts/diffs, previews, merges, unfinished work, CI, receipts, Assistant files, places, abilities, lookups, go-aheads, Mac work, D1, Design specialists, grants, captures; 45093/18782. Hosted slice 2 Task 15: openHostedPack (the instance's send_pack for a hosted pack) and its test; 45105/18883. Its review round 1 added the report-ingestion test for pack_incomplete; 45105/18911. Task 18: hosted_setting.go (SetHostedChecks, hostedChecks, HostedSettings; owner only, roster in the transaction, audited) and its tests; 45208/19070. Its review round 1: the audit atomicity test; 45208/19113. Task 19: hosted_jobs.go (the hosted_jobs and hosted_challenges tables, HostedJob and its lifecycle: newHostedJob, the listed moves only, ended and failed only with stop proof or never-launched evidence, settleHostedJob once, hostedJobForRunner; each move audited in its transaction) and its tests, TestMigrationAdditive included; 45658/19577. Its review round 1: the never-launched evidence contract (HostedNeverLaunched, launch_by and launching_since, hostedLaunchReturned) and tests for it, settlement of unproven terminal records and audit atomicity; 45728/19739. Task 20: hosted_limits.go (per-person hosted limits, S2-9: hostedAdmit held in the write by a per-person lock row, hostedHoldFor, Allocate, hostedSettle at 4x the baseline, SetHostedLimits owner only with the roster, revision and audit in the transaction) and its tests; 46013/20214. Its coordinator ruling: a limit counts only while its setting owner is a current owner (defaults otherwise, checked in the admission transaction) and TestOwnerRaisesLimitRevoked; 46022/20284. Its review round 1: Allocate returns nothing for an empty or reversed span before widening, and its assertions; 46025/20290. Hosted slice 2 Task 21: placement on hosted VMs (placeHosted before the checks early return, its five rules), the bound runner's fits, Authorize by job identity, the hosted offline rule and withdrawal exemption, the hosted pack at dispatch, the step-terminal hook, and the dispatcher's store methods (HostedLive, HostedSweep, HostedLaunching with relaunch, HostedLaunched, HostedAdmitted, HostedFailed, HostedStopped, HostedNeverLaunched, HostedReplaces, PlaceHosted; end, settle, revoke, step moved on) in hosted_run.go, and hosted_place_test.go; 46665/20804. Task 21 review round 1: abandoned-intent evidence waits for the job's lifetime, the job keeps its lifetime and first running sight, admission takes the placing transaction's step attempt, provider-valid attempt IDs, HostedRunning, and the Retry, replacement-runner, cancelled-task and stopping-VM tests; 46709/20937. Its review round 2: TestHostedReplacesNeedsProof; 46709/20971. Task 22: hosted_enrol.go (the enrolment and renewal store steps inside the instance's write transaction: HostedClaimCode, HostedEnrolAdmit, HostedEnrolBind, HostedRunnerJob, HostedNewChallenge, HostedUseChallenge; hostedAdmitted shared with HostedAdmitted); its tests drive it through the instance's routes (internal/equipo); 46848/20971. Its review round 1: hostedAdmitted reports whether the record was kept, the enrolment records the first sighting and applies the window from it, and the launch view's deadline is kept (hosted_jobs.deadline, earliest wins); 46903/20971. Its review round 2: an admission record's current deadline is kept too (hostedAdmitted, for the dispatcher's refresh and the renewal's HostedRenewAdmit); 46932/20971. Round 3: HostedEnrolAdmit returns the job re-read after recording the admission, so the enrolment caps by its deadline; 46937/20971. Task 23: openHostedPack opens the deps bundle after the hosted pack (send_pack with Deps), the instance's chunk and byte checks per kind (wire.MaxChunks, wire.MaxBytes), deps_too_large for a bundle past its limit, and a hosted attempt's pack and bundle closed when its checks end; hosted_deps_test.go; 46957/21199. Task 24: hosted_results.go (hostedCertified, AdmissionFresh: a hosted worker's checks count as sandboxed and its base checks as trusted only through the job's fresh, valid admission record, never its hello; an uncertified hosted result is not kept, its job stops and the step goes again once; deps_new_module and deps_missing presented as needs_network), stepReport and acceptBaseChecks wired to it, the admission kept whole and the enrolment image (0129), and hosted_results_test.go; 47094/21522. Task 24 review round 1: the certification decision moved before any terminal checks report from a worker (done, failed, unsolicited cancelled, the early failure branches), the person's cancellation kept, and tests for those, a wrong step, a stopping job and each admission identity substitution; 47096/21714. Task 24 review round 2: hostedSettleCancel (under the person's cancellation or an ended task, an uncertified hosted runner's report settles only its termination, with no checks evidence, taint or retry) and TestHostedUncertifiedCancelRace; 47123/21758. |
| 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. |
diff --git a/docs/superpowers/plans/HOSTED-SLICE2-PROGRESS.md b/docs/superpowers/plans/HOSTED-SLICE2-PROGRESS.md| index 3981ae32..c56181e1 100644 |
| --- a/docs/superpowers/plans/HOSTED-SLICE2-PROGRESS.md |
| +++ b/docs/superpowers/plans/HOSTED-SLICE2-PROGRESS.md |
| @@ -1945,3 +1945,36 @@ Mutations. A script under `~/.cache/t24r1` applied each exact-string replace and |
| - **366** the job column's `cert_valid` (`!j.CertValid` dropped). `… -run '^TestAdmissionIdentityNotCertified$/^record$/^column_not_valid$'`: exit 1, `hosted_results_test.go:503: column not valid: s1 done sandbox "bubblewrap" …, want nothing kept`. Restored. |
| Budget: `internal/equipo/chat` 47094/21522 → 47096/21714, with its reason. |
| + |
| +### Task 24 review round 2 (t24-r2.md: findings 1 and 2 addressed; one new Important, cancellation) |
| + |
| +**Finding (Important).** Round 1 let the person's cancellation, or a task that had already ended, bypass the refusal for every terminal report. A bound, uncertified hosted runner's `done` that raced a cancellation therefore went through ordinary worker handling. Its checks result was stored, a `bubblewrap` claim tainted the runner (`none`), and a `seatbelt` claim was kept as sandboxed. `BaseChecksSHA` stayed protected. |
| + |
| +Fix: in `stepReport`, a bound, uncertified hosted runner's terminal report under `k.CancelRequested` or a final task stage goes to `hostedSettleCancel` (`hosted_results.go`), which takes only the termination: |
| +- With termination proof, the step ends `cancelled`, terminated, with checks, gate, exit code, base checks, `BaseChecksSHA` and sandbox all empty. The runner is not tainted, and a task being cancelled becomes `cancelled`. |
| +- `saveStep`'s hook then stops the job for the step's end (`step_ended`), so nothing is placed again. |
| +- Without termination proof nothing changes. The cancellation settles on the runner's next report, or on the job's stop proof (`hostedStepAgain`'s cancellation path). |
| +A runner that is not bound, or a certified one, is handled as before. |
| + |
| +Red (test first, against `067e1099`): `CGO_ENABLED=0 go test ./internal/equipo/chat -run TestHostedUncertifiedCancelRace -count=1`. All four subtests (stale or withdrawn admission × a `bubblewrap` or `seatbelt` claim, each a `done` report after `CancelTask`) failed on their assertions: |
| +- `stale/bubblewrap` and `withdrawn/bubblewrap`: `hosted_results_test.go:529: checks evidence survived: checks "passed" base "" "" sandbox "none" gate "make ci" exit 0x…`; |
| +- `stale/seatbelt` and `withdrawn/seatbelt`: the same, with `sandbox "seatbelt"`. |
| +The test then asserts: |
| +- the step is `cancelled` and terminated, and the task `cancelled`; |
| +- the runner is not tainted; |
| +- the job is stopping for a reason other than `uncertified`; |
| +- after the VM's stop proof and a placement pass, there is still one job and the step stays cancelled. |
| + |
| +Green: `TestHostedUncertifiedCancelRace` and every earlier Task 24 test pass. `TestHostedCertifiedPersonCancelKept` (a `cancelled` report) still passes through the new path. Also ok: |
| +- the whole `./internal/equipo/chat` (27 s) and `./internal/equipo/mergegate`; |
| +- `./internal/equipo/hostedrun` (20.8 s). The simulation never cancels, so its run is unchanged: 149 certified and 156 refused (6 stale, 38 withdrawn, 8 failed or cancelled, 112 from a stopping job); |
| +- `./internal/equipo -run 'Enrol|Renew|HostedCredential|Migration|Schema|Hosted'`. |
| +`make migration-check budget build vet`: exit 0. staticcheck v0.7.0 on chat, gofmt and `git diff --check`: clean. |
| + |
| +Mutations. A script under `~/.cache/t24r2` applied each exact-string replace and ran the named test. It then wrote the saved original back and checked it byte for byte. |
| +- **367** (requested) the discard removed. The cancellation case keeps its label but no longer returns `hostedSettleCancel(...)`, so the report falls through to ordinary handling, as it did in round 1. `CGO_ENABLED=0 go test ./internal/equipo/chat -run TestHostedUncertifiedCancelRace -count=1`: exit 1, `hosted_results_test.go:529: checks evidence survived: checks "passed" base "" "" sandbox "none" gate "make ci" …` (and `sandbox "seatbelt"` for the seatbelt claims). Restored. |
| +- **368** (extra) cancellation sent to the retry path (the settle case dropped). `… -run 'TestHostedUncertifiedCancelRace|TestHostedCertifiedPersonCancelKept'`: exit 1, `hosted_results_test.go:401: the person's cancellation: step queued, task in_review` and `hosted_results_test.go:535: cancellation: step queued terminated false, task in_review; want cancelled, terminated, task cancelled`. Restored. |
| + |
| +The field-clearing line inside `hostedSettleCancel` has no mutation of its own. A step that has not ended carries none of those fields, and the report's fields are never copied onto it. The settle path is the guard, and 367 removes it. |
| + |
| +Budget: `internal/equipo/chat` 47096/21714 → 47123/21758, with its reason. |
diff --git a/internal/equipo/chat/hosted_results.go b/internal/equipo/chat/hosted_results.go| index 1f131eba..121f5000 100644 |
| --- a/internal/equipo/chat/hosted_results.go |
| +++ b/internal/equipo/chat/hosted_results.go |
| @@ -70,6 +70,28 @@ func (t *txn) hostedUncertified(j HostedJob) error { |
| return t.hostedStopping(j.AttemptID, hostedStopUncertified) |
| } |
| +// hostedSettleCancel takes only the termination of an uncertified hosted |
| +// runner's terminal report while its task is being cancelled or has |
| +// ended: with termination proof the step ends cancelled, terminated, with |
| +// none of the report's checks evidence (checks, gate, exit code, base |
| +// checks, sandbox) and no taint, and a task being cancelled is |
| +// cancelled. Ending the step stops its job for the step's end, so |
| +// nothing is placed again. Without termination proof nothing changes; |
| +// the cancellation settles on the runner's next report or the job's |
| +// stop proof (hostedStepAgain). |
| +func (t *txn) hostedSettleCancel(k *taskRecord, s *stepRecord, terminated bool) error { |
| + if !terminated { |
| + return nil |
| + } |
| + now := t.now() |
| + s.State, s.Reason, s.Terminated, s.FinishedAt = wire.StepCancelled, "cancelled", true, &now |
| + s.Checks, s.Gate, s.ExitCode, s.BaseChecks, s.BaseChecksSHA, s.ChecksSandbox = "", "", nil, "", "", "" |
| + if k.CancelRequested && k.MoveProject == "" && !wire.FinalStage(k.Stage) { |
| + k.Stage = wire.StageCancelled |
| + } |
| + return t.saveStep(s, k) |
| +} |
| + |
| // presentedChecksReason is a checks reason as the person sees it: a |
| // hosted VM that could not stage a module (one the base does not pin, or |
| // one the bundle lacks) needs the network to run those checks. The step |
diff --git a/internal/equipo/chat/hosted_results_test.go b/internal/equipo/chat/hosted_results_test.go| index 65a7632e..b02b0666 100644 |
| --- a/internal/equipo/chat/hosted_results_test.go |
| +++ b/internal/equipo/chat/hosted_results_test.go |
| @@ -503,3 +503,47 @@ func TestAdmissionIdentityNotCertified(t *testing.T) { |
| r.uncertified("column not valid", "H1", j) |
| }) |
| } |
| + |
| +// Task 24 review round 2. |
| + |
| +// TestHostedUncertifiedCancelRace: the person cancels while an uncertified |
| +// VM's done report (claiming bubblewrap, or seatbelt) is in flight, its |
| +// admission stale or withdrawn. The cancellation completes on the |
| +// report's termination; no checks evidence survives (checks, base checks, |
| +// sandbox), the runner is not tainted, and once the VM is proven stopped |
| +// nothing is placed again. |
| +func TestHostedUncertifiedCancelRace(t *testing.T) { |
| + for _, how := range []string{"stale", "withdrawn"} { |
| + for _, claim := range []string{wire.SandboxBubblewrap, wire.SandboxSeatbelt} { |
| + t.Run(how+"/"+claim, func(t *testing.T) { |
| + r := hostedPlaceRig(t) |
| + r.checksStep("s1", "tkp") |
| + j := r.certifiedOnVM("vm-1", "H1") |
| + r.spoil(how, j, "vm-1") |
| + if _, err := r.s.CancelTask(r.ctx, hkOwner, "tkp"); err != nil { |
| + t.Fatal(err) |
| + } |
| + r.reportAs("H1", passedReport("s1", 1, claim)) |
| + s, k := r.step("s1"), r.load("tkp") |
| + if s.Checks != "" || s.BaseChecks != "" || s.BaseChecksSHA != "" || s.ChecksSandbox != "" || s.Gate != "" || s.ExitCode != nil { |
| + t.Fatalf("checks evidence survived: checks %q base %q %q sandbox %q gate %q exit %v", s.Checks, s.BaseChecks, s.BaseChecksSHA, s.ChecksSandbox, s.Gate, s.ExitCode) |
| + } |
| + if r.tainted("H1") { |
| + t.Fatal("an uncertified hosted runner was tainted") |
| + } |
| + if s.State != wire.StepCancelled || !s.Terminated || k.Stage != wire.StageCancelled { |
| + t.Fatalf("cancellation: step %s terminated %t, task %s; want cancelled, terminated, task cancelled", s.State, s.Terminated, k.Stage) |
| + } |
| + if got := r.job(j.AttemptID); got.State != HostedJobStopping || got.StopReason == hostedStopUncertified { |
| + t.Fatalf("job %s %q, want stopping for the step's end", got.State, got.StopReason) |
| + } |
| + r.online(hpPrimary, wire.ProtocolHostedRunners) |
| + r.must(r.s.HostedStopped(r.ctx, j.AttemptID, hostedwire.StopProof{AttemptID: j.AttemptID, VMRef: "vm-1", State: isolatedjob.StateStopped}, r.now)) |
| + r.place() |
| + if jobs, s := r.jobsOf("s1"), r.step("s1"); len(jobs) != 1 || s.State != wire.StepCancelled { |
| + t.Fatalf("after the VM's proof: %d jobs, step %s; want no retry", len(jobs), s.State) |
| + } |
| + }) |
| + } |
| + } |
| +} |
diff --git a/internal/equipo/chat/tasks.go b/internal/equipo/chat/tasks.go| index f1b86fc4..ca7857fe 100644 |
| --- a/internal/equipo/chat/tasks.go |
| +++ b/internal/equipo/chat/tasks.go |
| @@ -1639,19 +1639,24 @@ func (t *txn) stepReport(l Lease, v *wire.StepReport) error { |
| // alone (never its hello or its word). A hosted runner that is not |
| // certified ends nothing: its report is not kept, it is not tainted, |
| // its job stops and the step is placed again, once (hostedStepAgain). |
| - // The person's cancellation, or a task already ended, is taken as |
| - // before. |
| + // Under the person's cancellation, or once the task has ended, only |
| + // its termination is taken: the step ends cancelled with no checks |
| + // evidence, and nothing is placed again (hostedSettleCancel). |
| certified := false |
| if s.Specialist == wire.SpecialistChecks && role == wire.RoleWorker && wire.StepTerminal(v.State) && !wire.StepTerminal(s.State) && !advanced { |
| if certified, err = t.hostedCertified(l.Runner.RunnerID, s.ID, s.Attempt, t.now()); err != nil { |
| return err |
| } |
| - if !certified && !k.CancelRequested && !wire.FinalStage(k.Stage) { |
| + if !certified { |
| j, bound, err := t.hostedJobForRunner(l.Runner.RunnerID) |
| if err != nil { |
| return err |
| } |
| - if bound { |
| + switch { |
| + case !bound: |
| + case k.CancelRequested || wire.FinalStage(k.Stage): |
| + return t.hostedSettleCancel(&k, &s, v.Termination) |
| + default: |
| return t.hostedUncertified(j) |
| } |
| } |