oficina / equipo Public

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

Plain git — no account needed to clone.

Download

Download this file

Slice 1 progress: Real conversation

Branch thin-v1-slice1 from main 5eae410. Spec: docs/superpowers/specs/2026-11-06-equipo-thin-v1.md §8 row 1.

Done

  1. Contracts: internal/wire (person API v1 resources, events, runner stream frames, strict decoding) and internal/wire/wiretest (recorded fixtures under testdata/api and testdata/frames, shared loader and a shape comparator used by the instance and runner tests).
  1. Instance (internal/equipo/chat, migration 0036): POST/GET messages, GET turns/{id}, POST turns/{id}/cancel, GET snapshot, GET events (SSE, ?after= over Last-Event-ID, 410 on an expired or future cursor, 20 s pings, same-origin cookie only for EventSource, bearer elsewhere, principal re-checked before each write), GET /api/runner/stream (WebSocket, generation lease, durable runner_commands mailbox, frame inbox for exactly-once, drain on SIGTERM). /me gained id, address, role and keeps person. Contract tests: internal/thintest.
  2. Runner (internal/runner/thin): one outbound WebSocket with outbox, acks, heartbeat, drain and supersession (exit 3); per-person workers over a durable runs table with crash recovery (one new attempt, then runner_restarted); the long-lived Claude coordinator (stream-json, --verbose, stdin held open, --include-partial-messages) in the existing containment with policy and init-frame validation, copy rotation before a turn the copy could not cover, --resume from a durable session home across idle exit and runner restart, cancel by killing the attempt's namespace; the runner's login claude|codex command. The runner's run command now runs the thin runner. Provider: OpenRuntimeCopy (refresh with the CLI under the source lock, stage, release the lock), action converse.
  3. Headless suite (internal/headless): fake 2.1.312 CLI (internal/fakeclaude) in real bwrap, real instance and runner, Go client on person API v1 and SSE only. Scenarios 1 (cold, warm, cold resume), 3, 6, 7, 8, cancel and runner crash, plus guards (init policy, session id, rotation, lock release, no credential bytes anywhere). About 35 s locally. Mutation checks: removing init validation, the session id check, the lock release or the rotation each fails a test.
  1. Staging (scripts/staging-thin.py): equipo-staging in Oficina on the flagship console at https://equipo-staging.bds.oncarlos.com, deployed with --swap hold; a staging runner user unit (named in the script) with its own state root beside the production runner's (state, work, scratch, sessions, config) on the claude-a home; owner sign-in by logged mail (allowed only for the staging hosts) and a device bearer in a 0600 file. The runner's WebSocket and the SSE stream both work through the CARLOS edge. Headless suite with the real Claude CLI 2.1.312, all seven scenarios green twice (12 turns each): - run 1 (08434e3): cold 2.46 s, warm 0.89 s, cold resume 2.78 s - run 2 (1750aa0): cold 2.84 s, warm 0.87 s, cold resume 2.89 s - run 3 (bab4b08, final): cold 2.74 s, warm 0.89 s, cold resume 3.21 s; runner offline seen in 4.6 s after the going-away close (was 55 s) 36 live turns used of the 40 budget.
  2. Chat page on the stream: /conversation renders from the chat snapshot (scriptless form post to the same Send), chat-stream.js follows /api/v1/events (drafts, markdown replies via a server refresh, turn ends, the offline line). Browser test TestBrowserChat (tag browser). Deleted: EQUIPO_ALWAYS_ON and the live hub it switched on; the runner protocol's coordinator routes and task poll, claim and recover_claim; the old suites that only exercised them (agentsetuptest, chatfeeltest, the old coordinator contract, HTTP runner end-to-end and live-refresh tests); the runner's run no longer opens journal.db.
  1. Review round (Astra, REQUEST CHANGES at 60c9f36), each fix with a test that fails before it (checked by reverting or mutating the fix): 1. Cancel of a dispatched turn now always goes through the runner and ends only on its termination report; a cancel that reaches the runner before its message holds the turn cancelled (no execution). 2. Execution lease: no turn reaches the provider until the instance acks a lease frame on the current connection (recovered runs wait for it). Each connection holds its own lease id, so a replaced connection of the same generation is fenced for frames, commands and lease checks. 3. Only the person's primary runner's sync reconciles their turns. 4. Only the ack of a terminal report finishes a run (not the recovery running announcement). 5. Recovery keeps a durable cancel and reports it, never retries it. 6. At start the runner removes orphaned credential copies, config, policy scratch, workspaces and tool sockets (it holds the state lock, so they belong to dead processes). The suite SIGKILLs a runner process mid-turn; staging's crash scenario now uses SIGKILL of the unit's main process. 7. make release points at make staged-check, which refuses unless a full green staging suite recorded exactly those artifacts (releases/staged/<version>.json); staging now deploys make release output. scripts/cutover-thin.sh is the drained production cutover (plan by default, not run): preflight, stop old runner, verified export, EQUIPO_DATABASE=equipo-v1.db (fresh; equipo.db kept for rollback), unset EQUIPO_ALWAYS_ON, deploy with --swap hold, install the staged runner, re-enrol, verify. Minor: the page counts delta offsets in UTF-8 bytes (browser test streams accents and emoji). Copy accepted for now with the existing marker; make release now passes. Staging run 4 (fe5bdf8, built by make release): all scenarios green, cold 3.25 s, warm 1.00 s, cold resume 3.53 s; 12 live turns (48 total).
  1. Review round 2 (Astra at c96009e: 1 to 6 and the UTF-8 minor resolved; 7 not resolved; four new items), each with a test that fails first: 1. Root ownership: the runner claims its scratch and workspace roots for its state directory (a lock held for the process life and an .equipo-root-owner record) and refuses roots another runner holds or owns, before any orphan sweep. The staging script refuses roots that overlap the production runner's (paths compared, none today). 2. Cutover identity: after the deploy and before any runner change, the script reads the new instance id from the new database through the platform replica, requires it to differ from the old one, and writes it into the runner config before enrolment; otherwise it stops with the runner untouched. 3. Staging record: hashes are recorded at deploy (instance) and install (runner, tool proxy); before recording, staging checks /api/version, the installed files, the unit's running process (/proc/<pid>/exe) and the tool proxy path, and the record step refuses hashes that differ from the release files. 4. Rollback: the cutover records the prior configuration first (served version, EQUIPO_ALWAYS_ON and EQUIPO_DATABASE, runner service.env and unit, instance id) and cutover-thin.sh rollback --execute restores all of it, keeps the new state as state.thin-rolled-back-<time>, promotes the previous version and starts the old runner. Steps are recorded and resumable; repeats and unrecorded leftovers are refused. A stub-based test runs the cutover and the rollback end to end. Staging run 5 (2a19928): all scenarios green, cold 2.93 s, warm 1.11 s, cold resume 3.51 s; 12 live turns (60 total over the slice).
  1. Review round 3 (items 2 and 3 resolved), two narrow fixes with failing-first tests: startup now takes the state lock and root ownership before containment recovery and the orphan sweep (TestStartupRefusesSharedRootsBeforeRecovery: a second runner on shared roots is refused before recovery, and the first runner's namespace record and scratch survive); the cutover reads every snapshot value into a checked, validated variable and stops before any change if one fails (TestCutoverStopsWhenASnapshotReadFails). The tryequipo tty driver now waits for the shell's exit instead of checking once (a CI flake).
  1. Mobile send without page transitions: chat-stream.js sends in the background (submit and Enter; Shift+Enter is a newline; IME-safe) with an optimistic bubble, focus kept in the composer, Retry on failure, and reconciliation with the committed message by id. It posts the form's own action with Accept: application/json (the person API POST stays bearer-only), which now answers with the committed message; the no-JS form post still redirects. Browser test at 390 px (TestBrowserChatSendStaysOnPage) checks no navigation or page reveal, the bubble shown at once, Enter and Shift+Enter, no duplicate, and Retry. Live staging follow-up turns after restart and cancel now run on the fake CLI only, so the live suite uses 10 turns.

Next

  • Controller: merge decision; the cutover is for a person to run.

Decisions

  • Frames are {"id","type","data"} JSON text messages. Added to the §4 list: welcome{generation, runner_id} (the instance grants the generation in answer to hello), turn{turn_id, attempt, state, reason} (runner to instance, for failed or cancelled turns and a new attempt after crash recovery), and instance-to-runner ack. Deltas carry an id but are never acked or resent; the committed reply replaces the draft.
  • message carries the last 50 messages as tail; the runner uses it only when it starts a fresh session. No session field: the runner owns session choice (durable sessions row, resume by id).
  • Turn failure reasons are a fixed list (wire.Reasons), never provider text.
  • Fixtures live in a test-only package so production binaries do not embed them.
  • Coordinator transcripts persist by copy, not a bind mount: before a process starts the runner copies projects/-workspace/<id>.jsonl from the session home into the fresh runtime home, and copies it back after each turn and on exit. Containment mounts are unchanged and the model cannot reach other persons' sessions.
  • A fresh session starts each UTC day or on an account change; its first frame carries a five-line house rule and the 50-message tail.
  • Slice 1 coordinator has no Equipo tools (converse action): the MCP socket lists only Claude's permission callback and denies it.
  • No in-namespace auth status probe before each process: identity is checked by the CLI refresh in the source home under the lock, and the copy is byte-identical and re-checked before every turn (CheckCopy).
  • Quick messages: while a turn is in flight, new messages join one queued turn, sent as one frame (scenario 6 sends them during a running turn).
  • Cancel of a turn the runner has not acked ends at once and voids its command.
  • Size ceilings for internal/equipo (11000) and internal/runner (9550) are raised until the slice 7 sweep deletes the old code beside the new.
  • Physical deletion of the old runner runtime (journal*.go, supervisor, coordinator service), runnerproto claims and fences, the old conversation coordinator engine and the personapi extras is left to the slice 7 sweep: none of it is reachable now (no routes, run uses the thin runner), and deleting it means rewriting most of the old suites.

Blockers

None yet.