research: Task 26 review 1, floor before legacy checks
dispatchResearch applies the Research floor (protocol 39) before any other protocol check, so a primary below 13 also ends runner_update_needed with its runner named; the unreachable research_unsupported branch goes. A reconnect below 13 ends a step not yet started runner_update_needed too. Tests for protocol 12 placement and the reconnect fence; three thintest contracts take the new reason.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6 files changed,
+95
−34
.rastrillo/budgets.txt+2 −2docs/superpowers/plans/HOSTED-SLICE2-PROGRESS.md+32 −0internal/equipo/chat/protocol_floor_test.go+42 −11internal/equipo/chat/research.go+10 −13internal/thintest/research_contract_test.go+7 −6internal/thintest/research_inventory_contract_test.go+2 −2
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.4s
ci-box: codex: fetched and verified in 4.6s
ci-box: codex-code-mode-host: fetched and verified in 1.5s
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 10.0s
ci-box: pi: installed and verified in 7.2s
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.7s
ci-box: clone deepened in 5.0s
ci-box: file times set from content: 3917 files, 272 directories
ci-box: ready in 19.5s
=== 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 87ms
FAIL amadan.net/oficina/equipo/internal/equipotest 0.240s
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 c84df081..91a42732 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 47304 21967 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. Task 25: HostedUsage (a person's running jobs and this UTC day's and month's held or used figures, errors returned) and HostedLimitList (owner only, the roster in the transaction) in usage.go, with hostedCounted shared with hostedAdmit; 47210/21758. Task 25 review round 1: HostedMinLimits and ErrHostedLimitTooLow (SetHostedLimits refuses limits that could never admit one checks job) and hosted_limits_floor_test.go (the floor, and each limit chip's promise through admission); 47224/21852. Task 26: protocol_floor.go (Research placed and started only at ProtocolHostedRunners, runner_update_needed, rechecked at Authorize) and protocol_floor_test.go; 47304/21967. |
| +size internal/equipo/chat 47304 21998 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. Task 25: HostedUsage (a person's running jobs and this UTC day's and month's held or used figures, errors returned) and HostedLimitList (owner only, the roster in the transaction) in usage.go, with hostedCounted shared with hostedAdmit; 47210/21758. Task 25 review round 1: HostedMinLimits and ErrHostedLimitTooLow (SetHostedLimits refuses limits that could never admit one checks job) and hosted_limits_floor_test.go (the floor, and each limit chip's promise through admission); 47224/21852. Task 26: protocol_floor.go (Research placed and started only at ProtocolHostedRunners, runner_update_needed, rechecked at Authorize) and protocol_floor_test.go; 47304/21967. Task 26 review 1: the Research floor before the legacy protocol 13 check, and the reconnect fence's runner_update_needed for a step not started (a protocol 12 placement case, TestResearchFencedAtReconnect); 47301/21998. |
| 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. |
| @@ -75,7 +75,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 - 13400 Grant scenarios (#48); sign-in email at 1280 and 390; Assistant files; restart wait; live site waits; card answer; scenario 7; Mac M9, mixed versions; 13400. |
| -size internal/thintest - 42662 Protocol 31 contracts, 35 diffs, stuck tasks, merges, retries, unfinished work, previews, places, abilities, lookups, go-aheads, Mac Engineering, conns, D1, held reports, Design end to end; 42650. Task 26: TestMixedVersionsMeteredAndResearch gains a protocol 39 row (Research at 13 now ends runner_update_needed); 42662. |
| +size internal/thintest - 42663 Protocol 31 contracts, 35 diffs, stuck tasks, merges, retries, unfinished work, previews, places, abilities, lookups, go-aheads, Mac Engineering, conns, D1, held reports, Design end to end; 42650. Task 26: TestMixedVersionsMeteredAndResearch gains a protocol 39 row (Research at 13 now ends runner_update_needed); 42662. Task 26 review 1: three older-primary Research contracts expect runner_update_needed; 42663. |
| 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/docs/superpowers/plans/HOSTED-SLICE2-PROGRESS.md b/docs/superpowers/plans/HOSTED-SLICE2-PROGRESS.md| index b0689d6b..cdf3af53 100644 |
| --- a/docs/superpowers/plans/HOSTED-SLICE2-PROGRESS.md |
| +++ b/docs/superpowers/plans/HOSTED-SLICE2-PROGRESS.md |
| @@ -2173,3 +2173,35 @@ Budgets, with reasons: |
| - `internal/equipo` 25524 → 25525; |
| - `internal/wire` 9902 → 9912; |
| - `internal/thintest` test 42650 → 42662. |
| + |
| +### Task 26 review round 1 (Astra) |
| + |
| +**Important:** when a primary spoke below 13, the refusal reason was inconsistent. Fixed as follows. |
| +- **Placement.** `dispatchResearch` now applies the Research floor (`belowPromptFloor`, 39) before anything else that depends on the protocol. A primary known below 39, including one below `ProtocolResearch` (12, 11), ends the step `runner_update_needed`, with the runner still named and nothing dispatched. The legacy `< ProtocolResearch` branch, which ended the step `research_unsupported` and cleared the runner, is removed. The floor covers every case it covered (both read the runner's last session protocol), so it can no longer be reached. |
| +- **Reconnect.** `fenceResearch` (a primary reconnecting below 13) now ends a step that has not started `runner_update_needed`, with the runner retained. A step that started keeps `research_unsupported`. |
| + |
| +Tests (chat): |
| +- `TestProtocol38RunnerGetsNoResearch` gains a protocol 12 case. It asserts the reason, the runner still named, no start and no dispatch. |
| +- New `TestResearchFencedAtReconnect`. A Research step dispatched at 39, then `fenceResearch` for a lease at 12 (the function `Connect` calls). It asserts: |
| + - the step is cancelled `runner_update_needed`; |
| + - the runner is still RUNNER1; |
| + - it never started; |
| + - its undelivered dispatch is retired; |
| + - no cancel was sent. |
| + |
| +thintest: three older-primary contracts now expect `runner_update_needed`. Each of their steps was never started: |
| +- `TestResearchFencedOnAnOlderPrimary`; |
| +- `TestResearchNeverDispatchedToAnOlderPrimary`; |
| +- `TestResearchInventoryOlderPrimary`. |
| + |
| +Green: |
| +- `CGO_ENABLED=0 go test ./internal/equipo/chat -run 'TestProtocol38|TestQueuedResearch|TestResearchFenced' -count=1`: ok. |
| +- The whole chat package: ok. |
| +- thintest `-run 'Research|Mixed|Specialist'`: ok. |
| +- `make budget build vet`: exit 0. `git diff --check` is clean. |
| + |
| +Mutations used the same method as above: |
| +- **R1** the legacy `< ProtocolResearch` loop put back before the floor. `CGO_ENABLED=0 go test ./internal/equipo/chat -run TestProtocol38RunnerGetsNoResearch -count=1`: exit 1, `protocol_floor_test.go:65: Research placed on a protocol 12 primary: {…}` (`research_unsupported`, the runner cleared). Restored. |
| +- **R2** the reconnect keeps the old reason (the `if s.StartedAt == nil { t.updateNeeded(s) }` removed from `fenceResearch`). `-run TestResearchFencedAtReconnect`: exit 1, `protocol_floor_test.go:129: Research after a reconnect at 12: {…}`. Restored. |
| + |
| +Budgets: `internal/equipo/chat` test 21967 → 21998 (source down to 47301, record kept); `internal/thintest` test 42662 → 42663. |
diff --git a/internal/equipo/chat/protocol_floor_test.go b/internal/equipo/chat/protocol_floor_test.go| index 829178dc..aea772ad 100644 |
| --- a/internal/equipo/chat/protocol_floor_test.go |
| +++ b/internal/equipo/chat/protocol_floor_test.go |
| @@ -51,23 +51,26 @@ func (r *hkRig) speaks(protocol int) { |
| // TestProtocol38RunnerGetsNoResearch (Fable M4 residue): Research's |
| // prompt quotes every untrusted value only from ProtocolHostedRunners. |
| // Placement on a primary known to speak 38 ends the step |
| -// runner_update_needed, before any dispatch is queued; at 39 the same |
| -// step is dispatched there. |
| +// runner_update_needed, before any dispatch is queued, its runner still |
| +// named for the update; so does one below ProtocolResearch (12), the |
| +// same refusal. At 39 the same step is dispatched there. |
| func TestProtocol38RunnerGetsNoResearch(t *testing.T) { |
| r, l, _ := grantRig(t) |
| r.floorRunners() |
| - old := r.floorResearch(l, "k_old") |
| - r.speaks(wire.ProtocolDesign) |
| - st := r.dispatchNow(old.ID) |
| - if st.State != wire.StepCancelled || st.Reason != wire.ReasonRunnerUpdateNeeded || !st.Terminated || st.StartedAt != nil { |
| - t.Fatalf("Research placed on a protocol 38 primary: %+v", st) |
| - } |
| - if n := r.count("SELECT count(*) FROM runner_commands WHERE kind = ? AND body LIKE ?", wire.FrameDispatch, `%"step_id":"`+old.ID+`"%`); n != 0 { |
| - t.Fatalf("%d dispatches queued for a protocol 38 primary", n) |
| + for _, protocol := range []int{wire.ProtocolDesign, wire.ProtocolMetered} { |
| + old := r.floorResearch(l, "k_old_"+itoa64(int64(protocol))) |
| + r.speaks(protocol) |
| + st := r.dispatchNow(old.ID) |
| + if st.State != wire.StepCancelled || st.Reason != wire.ReasonRunnerUpdateNeeded || !st.Terminated || st.StartedAt != nil || st.RunnerID != "RUNNER1" { |
| + t.Fatalf("Research placed on a protocol %d primary: %+v", protocol, st) |
| + } |
| + if n := r.count("SELECT count(*) FROM runner_commands WHERE kind = ? AND body LIKE ?", wire.FrameDispatch, `%"step_id":"`+old.ID+`"%`); n != 0 { |
| + t.Fatalf("%d dispatches queued for a protocol %d primary", n, protocol) |
| + } |
| } |
| cur := r.floorResearch(l, "k_new") |
| r.speaks(wire.ProtocolHostedRunners) |
| - st = r.dispatchNow(cur.ID) |
| + st := r.dispatchNow(cur.ID) |
| if wire.StepTerminal(st.State) || st.RunnerID != "RUNNER1" { |
| t.Fatalf("Research at protocol 39: %+v", st) |
| } |
| @@ -104,3 +107,31 @@ func TestQueuedResearchRecheckedAtAuthorize(t *testing.T) { |
| } |
| } |
| + |
| +// TestResearchFencedAtReconnect: a queued Research step whose primary |
| +// reconnects below ProtocolResearch (12) ends as placement and its start |
| +// authorization end it: runner_update_needed, the runner still named, |
| +// never started, its undelivered dispatch retired and nothing sent to |
| +// run it. |
| +func TestResearchFencedAtReconnect(t *testing.T) { |
| + r, l, _ := grantRig(t) |
| + r.floorRunners() |
| + r.speaks(wire.ProtocolHostedRunners) |
| + s := r.floorResearch(l, "k_fenced") |
| + if st := r.dispatchNow(s.ID); st.State != wire.StepQueued || st.RunnerID != "RUNNER1" { |
| + t.Fatalf("Research at protocol 39: %+v", st) |
| + } |
| + old := l |
| + old.Protocol = wire.ProtocolMetered |
| + r.must(r.tx(func(tx *txn) error { return tx.fenceResearch(old) })) |
| + got := r.stepNow(s.ID) |
| + if got.State != wire.StepCancelled || got.Reason != wire.ReasonRunnerUpdateNeeded || got.RunnerID != "RUNNER1" || got.StartedAt != nil { |
| + t.Fatalf("Research after a reconnect at 12: %+v", got) |
| + } |
| + if c, _ := r.dispatched(s.ID); c.AckedAt == nil { |
| + t.Fatal("its dispatch was not retired") |
| + } |
| + if n := r.cancels(s.ID); n != 0 { |
| + t.Fatalf("%d cancels for a dispatch never delivered", n) |
| + } |
| +} |
diff --git a/internal/equipo/chat/research.go b/internal/equipo/chat/research.go| index 782fb609..fded23f1 100644 |
| --- a/internal/equipo/chat/research.go |
| +++ b/internal/equipo/chat/research.go |
| @@ -588,17 +588,9 @@ func (t *txn) dispatchResearch(k *taskRecord, s *stepRecord) error { |
| } |
| return nil |
| } |
| - rs, err := t.runners(s.Person) |
| - if err != nil { |
| - return err |
| - } |
| - for _, r := range rs { |
| - if r.ID == s.RunnerID && r.Protocol != 0 && r.Protocol < wire.ProtocolResearch { |
| - end(wire.StepCancelled, wire.ReasonResearchUnsupported) |
| - return nil |
| - } |
| - } |
| - // Nor to one below the quoting of its prompt (promptFloor). |
| + // Nor to a runner known to speak below the quoting of its prompt |
| + // (promptFloor, 39, which covers one below ProtocolResearch too): it |
| + // ends runner_update_needed, the runner named for its update. |
| if old, err := t.belowPromptFloor(*s); err != nil || old { |
| if old { |
| t.updateNeeded(s) |
| @@ -839,8 +831,10 @@ func (t *txn) endResearch(k taskRecord) error { |
| // fenceResearch settles every Research step placed on a runner that |
| // connects below wire.ProtocolResearch: it never gets the dispatch, a |
| -// copy it may hold is cancelled, and the step ends research_unsupported, |
| -// which releases the Engineering it held. |
| +// copy it may hold is cancelled, and the step ends, which releases the |
| +// Engineering it held. One not started ends runner_update_needed, as |
| +// placement and its start authorization end it (promptFloor), the |
| +// runner still named; one that started ends research_unsupported. |
| func (t *txn) fenceResearch(l Lease) error { |
| if l.Protocol >= wire.ProtocolResearch { |
| return nil |
| @@ -860,6 +854,9 @@ func (t *txn) fenceResearch(l Lease) error { |
| } |
| now := t.now() |
| s.State, s.Reason, s.Terminated, s.FinishedAt = wire.StepCancelled, wire.ReasonResearchUnsupported, true, &now |
| + if s.StartedAt == nil { |
| + t.updateNeeded(s) |
| + } |
| if err := t.saveStep(s, &k); err != nil { |
| return err |
| } |
diff --git a/internal/thintest/research_contract_test.go b/internal/thintest/research_contract_test.go| index 572edaaf..8811c0d3 100644 |
| --- a/internal/thintest/research_contract_test.go |
| +++ b/internal/thintest/research_contract_test.go |
| @@ -583,9 +583,9 @@ func TestResearchOlderPrimary(t *testing.T) { |
| // TestResearchFencedOnAnOlderPrimary (mixed version): a Research step |
| // dispatched at 13 whose primary comes back at 12 (metered connections, |
| -// no Research) or 11 is cancelled research_unsupported, its dispatch is |
| -// never delivered there, and Engineering is released to the older |
| -// runner. |
| +// no Research) or 11 is cancelled runner_update_needed (never started), |
| +// its dispatch is never delivered there, and Engineering is released to |
| +// the older runner. |
| func TestResearchFencedOnAnOlderPrimary(t *testing.T) { |
| for _, back := range []int{wire.Protocol12, wire.Protocol11} { |
| t.Run(itoa(back), func(t *testing.T) { researchFencedAt(t, back) }) |
| @@ -627,7 +627,8 @@ func researchFencedAt(t *testing.T, back int) { |
| t.Fatalf("a research dispatch reached protocol %d: %s", back, raw) |
| } |
| } |
| - if s := r.newest(id, wire.SpecialistResearch); s.State != wire.StepCancelled || s.Reason != wire.ReasonResearchUnsupported { |
| + // Never started: runner_update_needed (hosted slice 2 Task 26). |
| + if s := r.newest(id, wire.SpecialistResearch); s.State != wire.StepCancelled || s.Reason != wire.ReasonRunnerUpdateNeeded { |
| t.Fatalf("fenced %+v", s) |
| } |
| } |
| @@ -704,7 +705,7 @@ func TestResearchGrantCheckedAtDispatch(t *testing.T) { |
| // TestResearchNeverDispatchedToAnOlderPrimary (mixed version): a step |
| // that reaches dispatch while its primary speaks 11 is never sent: it |
| -// ends research_unsupported and Engineering goes to that runner. |
| +// ends runner_update_needed and Engineering goes to that runner. |
| func TestResearchNeverDispatchedToAnOlderPrimary(t *testing.T) { |
| r := newToolRigAt(t, wire.ProtocolCurrent) |
| r.researchOn() |
| @@ -730,7 +731,7 @@ func TestResearchNeverDispatchedToAnOlderPrimary(t *testing.T) { |
| if e := body.(*wire.DispatchCommand); f.Type != wire.FrameDispatch || e.Specialist != wire.SpecialistEngineering { |
| t.Fatalf("to the older runner %+v", e) |
| } |
| - if s := r.newest(id, wire.SpecialistResearch); s.State != wire.StepCancelled || s.Reason != wire.ReasonResearchUnsupported { |
| + if s := r.newest(id, wire.SpecialistResearch); s.State != wire.StepCancelled || s.Reason != wire.ReasonRunnerUpdateNeeded { |
| t.Fatalf("at 11 %+v", s) |
| } |
| if r.researchDispatches() != 0 { |
diff --git a/internal/thintest/research_inventory_contract_test.go b/internal/thintest/research_inventory_contract_test.go| index b9a5e6f6..4ff6b7b6 100644 |
| --- a/internal/thintest/research_inventory_contract_test.go |
| +++ b/internal/thintest/research_inventory_contract_test.go |
| @@ -374,7 +374,7 @@ func TestResearchInventoryObservedAddress(t *testing.T) { |
| // TestResearchInventoryOlderPrimary (mixed versions): a step waiting for |
| // the inventory whose primary comes back at 11 is not left waiting for a |
| -// card it cannot use: it ends research_unsupported and Engineering goes. |
| +// card it cannot use: it ends runner_update_needed and Engineering goes. |
| func TestResearchInventoryOlderPrimary(t *testing.T) { |
| r := newToolRigSaying(t, wire.ProtocolCurrent, personWords) |
| r.researchOn() |
| @@ -393,7 +393,7 @@ func TestResearchInventoryOlderPrimary(t *testing.T) { |
| if e := body.(*wire.DispatchCommand); e.Specialist != wire.SpecialistEngineering || e.TaskID != id { |
| t.Fatalf("to the older runner %+v", e) |
| } |
| - if s := r.newest(id, wire.SpecialistResearch); s.State != wire.StepCancelled || s.Reason != wire.ReasonResearchUnsupported { |
| + if s := r.newest(id, wire.SpecialistResearch); s.State != wire.StepCancelled || s.Reason != wire.ReasonRunnerUpdateNeeded { |
| t.Fatalf("at 11 %+v", s) |
| } |
| if r.researchDispatches() != 0 { |