oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

Release slice 1: hosted checks

Status: 2026-11-11, revision 2. Drafted by Claude (Opus 5.5) on release-s1-hosted-checks from main 577e24c. This is slice 1 of 2026-11-11-equipo-release.md (§2.7), approved by Paul as D2.

  • Revision 1 (1d7b90d) drew READY AFTER FIXES from Astra, in one round. The findings are in CODEX-FINDINGS-RELEASE-S1-HOSTED-CHECKS.md beside this spec.
  • Revision 2 folds all six findings in, marked (astra N). Where it could, it cut scope instead of adding machinery.
  • Revision 2.1 adds the amadan request number (§5).

0. Why, and the finish line

A checks step on the primary runs the repository's gate offline in bubblewrap. Equipo's own gate is written for hosted CI: it pulls an image, Chromium and tools, and govulncheck needs vuln.go.dev. So on oficina/equipo every checks step ends cannot_run needs_network, even though hosted CI has already judged the exact commit.

Finish line:

  • For a repository with hosted CI on, the checks step reports hosted CI's own verdict on the exact candidate SHA. The verdict is bound to the repository, the branch, the SHA and the run's report time.
  • A runner restart while the step waits no longer ends it runner_restarted.
  • The rename task (tkataquuxfrw) on Retry ends failed, with hosted CI's failing steps in its fix round.

1. Rules

  1. No new credential, no new grant. The primary reads the hub's bearer API with the agent credential it already holds for the repository, as fileForge.Merge does. Redirects are refused, and reads are capped. Workers hold no forge credential and never take this path.
  2. Who decides. The instance offers hosted checks on every checks dispatch to the primary (DispatchCommand.HostedChecks). - The runner takes the offer only when GET .../ci/hosted answers on and the change does not need macOS (needsMacOS). - Anything else, a read error included, means today's local gate, unchanged. - Once taken, the attempt's phase becomes hosted, which is persisted.
  3. Polling is deferred, not held (astra 5). - Each run of the attempt confirms the lease, makes one status read (GET .../ci/status?branch=<task branch>&logs=none, 30 s request timeout, again every 15 s: the engine's deferral interval, as for merges), and returns stepDeferred when there is no verdict yet, as a merge waiting for CI does. The queue moves on meanwhile. - The deadline is 60 minutes from the first deferral (deferred_since, persisted), so neither a restart nor a reconnect resets it. - Cancel and withdrawal end it at the next run, through the lease. - Restart recovery runs a hosted-phase checks attempt again, as it does a merge, instead of failing it runner_restarted. - A read error counts as no verdict yet. At the deadline the step ends cannot_run checks_timeout.
  4. One snapshot (astra 2). A verdict comes only from a response whose ns, repo and branch equal the request and whose sha is the candidate. - On failure, one logs=failed read adds the logs only if its sha, state and updated_at equal the first response's. Otherwise the report carries the first snapshot's names and summary without logs. - Another tip, queued, running and unknown all mean no verdict yet.
  5. Verdicts.

| Hub state on the candidate | Checks | Gate | Exit | Reason | Hosted | |---|---|---|---|---|---| | success | passed | hosted CI | 0 | | yes | | failure | failed | hosted CI | 1 | | yes | | skipped (no CI script) | none | | | | yes | | lost, stale | cannot_run | | | checks_unavailable | yes | | deadline | cannot_run | | | checks_timeout | no |

The output lists the failing unit names first, then the hub's summary, then the failing logs' tail. It is bounded by wire.MaxChecksOutput.

  1. Binding, bounded (astra 2, 6). StepReport.Hosted holds repo, branch, sha, state, reported_at (the hub's updated_at; the hub exposes no run id) and failed (at most 20 names of 120 bytes, which the runner truncates). The instance counts a report that carries Hosted, or names gate hosted CI, only when all of these hold: - it comes from the primary, on a connection at protocol 5; - the step is checks, and Hosted is present; - the repository is the project's own; - the branch is the task's; - the SHA is the step's candidate; - reported_at is greater than 0; - failed is within its bounds; - the state maps to the outcome as in rule 5.

Anything else is ignored, as a judgement on another SHA is today. The instance stores the binding in chat_steps.hosted_ci (JSON) and sets checks_sandbox = hosted.

  1. Merge authority: checks that ran, not yet sandboxed (astra 1). A hosted passed or failed is a real result: Review gets it, a failure starts the fix round, and "checks couldn't run" is no longer the reason. - Why not sandboxed: the hub's status API does not say where a verdict was produced. on is the desired setting, and a verdict from an ordinary runner survives enabling hosted CI. The hub's own merge gate on CI is off by default. - So: checksOutsideSandbox counts hosted as outside the sandbox. A hosted pass is asked about ("its checks ran outside the sandbox", existing copy) and never merged on its own. mergegate does not change. - Later: once the hub reports execution provenance and a run id (an amadan request, §5), hosted can count as sandboxed in its own change.
  2. Fix round. For a hosted failure, the feedback first names the failing units from the stored binding, for example "The repository's hosted CI failed on 4d28994 in: compile; check shard 5 of 23", then gives the output's tail.

2. Wire and versions

  • Protocol 5, wire.ProtocolHostedChecks, becomes ProtocolCurrent. It adds DispatchCommand.hosted_checks and StepReport.hosted, both omitempty.
  • Downgrade, downgradeHostedChecks (astra 3): - It drops the offer for any peer below 5. - It turns a hosted-derived report into cannot_run checks_unavailable, with no gate, no exit code and no hosted. A stripped report never keeps a passed an old instance would accept unbound. - It runs first, and the later steps keep the accumulated flag.

| Combination | Behaviour | |---|---| | new instance, runner at 4 | no offer, so the local gate as today | | old instance, new runner | spoken 4, so no offer. A hosted report still in flight from before reaches the old instance as cannot_run | | new runner rolled back to an old binary (astra 4) | not transparent. The old binary fails held checks runner_restarted, and an unacknowledged report with hosted in the outbox would be refused by a protocol 4 instance's strict decoder. Rule: roll a runner back below protocol 5 only after it has delivered its outbox, as for every earlier bump that added report fields (merge facts' change). The release plan's runner-state proof (§2.6 item 4) will test it |

3. Changes

  • wire: ProtocolHostedChecks, the two fields, HostedResult with its bounds, GateHosted, SandboxHosted, and the semantic downgrade.
  • runner/forge: HubCIHosted and HubCIStatus. They send the bearer, escape the path, refuse redirects, cap the read (64 KiB and 4 MiB), and check the answer's identity.
  • runner/thin: - an optional HostedCI interface, met by fileForge; - hostedChecks, which runs in deferred steps; - phaseHosted, and its case in restart recovery.
  • equipo/chat: - dispatch sets the flag for checks on the primary; - stepReport validates and stores the binding; - checksOutsideSandbox counts hosted; - feedback names the failing units.
  • Migration 0062_thin_hosted_checks.sql: chat_steps.hosted_ci text. It is additive, and the model and snapshot are updated.
  • Budgets: the sizes for internal/runner/thin, internal/equipo/chat and the touched test packages, with reasons.
  • No new UI copy.

4. Tests, failing first

  • wire: below 5, Encode drops the offer, and turns a hosted passed into cannot_run. The result decodes strictly at protocols 4, 3, 2 and 1. At 5 it passes through unchanged.
  • forge: - the bearer and the path; - an answer for another branch, ns or repo is refused; - a malformed sha; - caps; - a redirect is refused and not followed; - a refusal, a bad repository, another logs mode, and a bearer with a newline.
  • thin, with a fake HostedCI: - pending defers, and unrelated work runs meanwhile; - a pass and a failure, each from one snapshot; a failure whose enrichment moved keeps no logs; - skipped, lost, and the deadline, measured from deferred_since; - hosted off, a read error on hosted, or no offer gives the local gate, as does a macOS change; - after a restart the step runs again, without runner_restarted; - cancel ends it; - the names are bounded.
  • thintest contracts: - a hosted pass leads to review and approval, and the merge then asks with the sandbox reason and does not act; - a hosted failure starts a fix round that names the units; - every binding rule is checked on its own, and the report is ignored; - a protocol 4 rig gets no offer.
  • Mutations: every rule 6 guard, the identity check in rule 4, the deadline, the downgrade and the sandbox rule is broken once, and its test is seen to fail.

5. Out of scope, and follow-ups

  • Hosted checks on Mac workers.
  • Retrying steps already ended runner_restarted. Retry stays a person's tap.

v2: automatic merge on hosted passes

Filed as amadan/amadan#136, which cross-references #131. It asks for a status read by commit SHA that returns the run id and the run's executor: hosted (one of amadan's single-use VMs, with the job credential scoped as today) or runner.

Once it lands, a hosted verdict binds to the run id instead of the report time. Hosted CI then counts as sandboxed only when the executor is hosted, and a pass may merge on its own under merge authority. That change is a spec of its own.