oficina / equipo Public
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
- Contracts:
internal/wire(person API v1 resources, events, runner stream frames, strict decoding) andinternal/wire/wiretest(recorded fixtures undertestdata/apiandtestdata/frames, shared loader and a shape comparator used by the instance and runner tests).
- Instance (
internal/equipo/chat, migration 0036):POST/GET messages,GET turns/{id},POST turns/{id}/cancel,GET snapshot,GET events(SSE,?after=overLast-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, durablerunner_commandsmailbox, frame inbox for exactly-once, drain on SIGTERM)./megainedid,address,roleand keepsperson. Contract tests:internal/thintest. - Runner (
internal/runner/thin): one outbound WebSocket with outbox, acks, heartbeat, drain and supersession (exit 3); per-person workers over a durablerunstable with crash recovery (one new attempt, thenrunner_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,--resumefrom a durable session home across idle exit and runner restart, cancel by killing the attempt's namespace; the runner'slogin claude|codexcommand. The runner'sruncommand now runs the thin runner. Provider:OpenRuntimeCopy(refresh with the CLI under the source lock, stage, release the lock), actionconverse. - 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.
- Staging (
scripts/staging-thin.py):equipo-stagingin 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. - Chat page on the stream:
/conversationrenders from the chat snapshot (scriptless form post to the sameSend),chat-stream.jsfollows/api/v1/events(drafts, markdown replies via a server refresh, turn ends, the offline line). Browser testTestBrowserChat(tag browser). Deleted:EQUIPO_ALWAYS_ONand 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'srunno longer opens journal.db.
- 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
leaseframe 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'ssyncreconciles their turns. 4. Only the ack of a terminal report finishes a run (not the recoveryrunningannouncement). 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 releasepoints atmake staged-check, which refuses unless a full green staging suite recorded exactly those artifacts (releases/staged/<version>.json); staging now deploysmake releaseoutput.scripts/cutover-thin.shis the drained production cutover (plan by default, not run): preflight, stop old runner, verified export,EQUIPO_DATABASE=equipo-v1.db(fresh;equipo.dbkept for rollback), unsetEQUIPO_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 releasenow passes. Staging run 4 (fe5bdf8, built bymake release): all scenarios green, cold 3.25 s, warm 1.00 s, cold resume 3.53 s; 12 live turns (48 total).
- 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-ownerrecord) 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_ONandEQUIPO_DATABASE, runner service.env and unit, instance id) andcutover-thin.sh rollback --executerestores all of it, keeps the new state asstate.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).
- 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).
- Mobile send without page transitions:
chat-stream.jssends 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 withAccept: 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 tohello),turn{turn_id, attempt, state, reason}(runner to instance, for failed or cancelled turns and a new attempt after crash recovery), and instance-to-runnerack. Deltas carry an id but are never acked or resent; the committed reply replaces the draft. messagecarries the last 50 messages astail; the runner uses it only when it starts a fresh session. Nosessionfield: the runner owns session choice (durablesessionsrow, 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>.jsonlfrom 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 (
converseaction): the MCP socket lists only Claude's permission callback and denies it. - No in-namespace
auth statusprobe 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,
runuses the thin runner), and deleting it means rewriting most of the old suites.
Blockers
None yet.