oficina / equipo Public

Previews: Astra round 2 fixes (outcomes, credential, empty account)

A started preview attempt is never replaced: withdrawn or removed it
ends could-not-be-confirmed once built, cancelled before; a withdrawn
attempt's own done report is kept. Cancelled previews reconcile after a
restart. The credential file must be a regular non-link 0600 file owned
by the runner user, outside every mounted root, with errors that never
carry content, and it joins the protected paths. "no apps in this
account" is an empty listing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev b692cf646abf523a72a7e97d91aa05776a571a6f parent 5885855
15 files changed, +372 −29
  • .rastrillo/budgets.txt +2 −2
  • docs/superpowers/specs/2026-11-11-equipo-release-preview.md +23 −0
  • docs/superpowers/specs/CODEX-FINDINGS-RELEASE-PREVIEW-R2.md +27 −0
  • internal/equipo/chat/preview.go +21 −1
  • internal/equipo/chat/preview_test.go +65 −0
  • internal/equipo/chat/runners.go +12 −0
  • internal/equipo/chat/tasks.go +16 −0
  • internal/runner/checks/sandbox.go +1 −1
  • internal/runner/connections.go +2 −2
  • internal/runner/connections_preview_test.go +22 −0
  • internal/runner/thin/preview.go +74 −19
  • internal/runner/thin/preview_test.go +89 −0
  • internal/runner/thin/run.go +1 −1
  • internal/runner/thin/step.go +3 −2
  • internal/runner/workspace/workspace.go +14 −1

CI failed — run details

diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt
index d0ea69bc..697c5507 100644
--- a/.rastrillo/budgets.txt
+++ b/.rastrillo/budgets.txt
@@ -34,7 +34,7 @@ time internal/runner/provider 15s Plan 3 CI repair measured 10.346s for the full
perf GET /releases/* skip Verified runner release file downloads, not browser GET screens.
perf GET /install.sh skip Mac runners: the one-line bootstrap a terminal pipes to sh, not a browser screen.
time internal/runner/containment 15s Plan 3 loaded CI measured 10.817s; niced serial reruns measured 5.773s and 5.750s. The added coordinator mount check has no repeated launches to remove; 15s leaves 38 percent headroom for namespace, process-exit and recovery assertions.
-size internal/runner/thin 17777 9347 Release previews add the preview step (preview.go: the strict config from git objects, the export from git objects with its caps and digest, the fixed carlos commands each behind a publish check, the marker check that follows no redirect, the restart reconcile, about 560 lines) and its tests (preview_test.go, about 430 lines); measured 17777 source and 9347 test lines. Mac pending cleanup: the warm waits while an attempt's cleanup is pending (5 lines, test 4); measured 17165/8918. Mac simulators before T: quietSimulators shuts every simulator down (bounded) before a T cleanup and logs what is left (about 43 lines), and its test with a hung simctl (about 45 lines); measured 17160/8914. Mac user temp: the Mac host resolves the user's T and refuses an untrusted one (macUserTemp, why in words), gives every gate one turn across the worker and the probe command, and warms Xcode's plugin cache once per Xcode outside the sandbox (warm, warmNow; about 71 lines); its tests pin T on the srt gates, a refused T and the warm's once, retry and turn (about 46 lines); measured 17117/8869. Engineering in an empty repository: the step starts from no base and tells Engineering so, the push names an unborn default, Review reads an initial commit against the empty tree (changeDiff), checks list its files, and a repository whose only branches are task branches stays empty (onlyTaskBranches; about 60 lines); their tests (the task-branch, review diff and prompt tests in index_empty_test.go, about 92 lines): measured 17046/8823. Mac checks wait for the sandbox: macChecks.Run refuses unproven without the dispatch's consent, the consent context, the worker's refusal report and the link's protocol 7 gate (about 38 lines), and their tests (sandbox_consent_test.go, about 131 lines); measured 16986/8731. Mac Xcode scratch: the Mac host test pins the gate's environment (the runner user's HOME kept, no scratch home; 6 lines); measured 16948/8600. Empty repositories merged onto main: measured 16948/8594. Empty repositories: the index lists a reachable repository with no commits as empty, DefaultBranch tells that from no access (lsRemote), reads of it say so, and the handshake hello keeps empty entries back until a protocol 6 welcome (about 52 lines); their tests (index_empty_test.go, the handshake hello at protocols 5 and 6, startLinkWith; about 183 lines). Token row facts merged onto main: measured 16896/8411. Token row facts read the check's rate limit and record it as a turn's (TokenCheck, the Verify wiring, about 40 lines); measured 16614. The leftover helper's debug line adds 3 lines: measured 16572. The Mac host's hang fix and probe pacing add the process group and its kill (procgroup_unix.go, procgroup_other.go), the bounded wait for a command's output, and the untrusted report's rerun decision with its tool fingerprint (about 165 lines); measured 16569. Runner startup logs add the info lines a silent start is pinned to a phase by (startup phases, the Mac host's xcode-select and capability commands, slow-command warnings, the probes, and the link's connecting, hello and welcome lines: startPhase, openRunner, watchSlow and logged, about 155 lines); measured 16405. Merge authority thin v1 adds the review's measured change facts (facts.go: raw and numstat listings, modes, signing lines, the revert tree check, about 230 lines), the merge_request confirmation and the merge's provenance; measured 16196 with spend-1 merged. Spend 1 resumes a fix round in Engineering's kept session on its healthy connection (fixSession, fixPlan, fixPrompt, keptCommit, about 90 lines); measured 15873. Claude's sign-in by a link's review round 1 contains its setup-token in a recorded namespace (the contained terminal, its proven stop and the start's recovery before a home goes, about 130 lines); measured 15787. Claude's sign-in by a link adds the runner's own setup-token attempt, the code's sealed delivery with its crash boundaries and the shared token commit (signin.go, about 300 lines, less the removed terminal watcher); measured 15655. Claude setup tokens add sealed delivery, the token check, Check again and recovery (token.go, tokencheck.go, about 700 lines) beside the composer and Mac lines; measured 15239. Astra round 2 moves the attachment quota to admission: arriving files counted by declared size, admissions protecting a file until its message names it, room made from the oldest unprotected files, refusal as runner_storage_full, and a sweep that stops when protection cannot be read (about 150 lines); measured 12191. Mac runners slices A and B add protocol negotiation (link.go), the capability report, the start authorization, the pack relay (relay.go), the primary's publication, the worker executor (worker.go) and the test-build fake worker, about 2700 lines on the same step engine. Composer attachments add the chunked receipt with exactly-once writes, the read-only desk delivery and its checks (files.go, about 230 lines), image blocks and localImage inputs, the attachment read through read_file; measured 11736. Connections slice 1 Astra round 1 adds the Codex step path (codexstep.go: Engineering and Review on the pinned app-server in the implement and inspect containment, about 300 lines); measured 11345. Connections slice 1 (after Astra round 1) also keeps a durable ledger of each turn's write tools so a later attempt never repeats one (effects.go), the waiting state between attempts and usage rows per attempt, about 500 lines more; measured 10590 before gate 1d. Connections slice 1 adds the Codex coordinator beside the Claude one (codex.go: the pinned app-server over JSON-RPC in the converse containment, sharing the coordinator base, desk, tool socket and session table), the connection registry over the bindings with health and provider limits (conns.go), in-app sign-in attempts (connector.go) and turn failover and holding (failover.go), about 1500 lines; the pure parts (the choice function, limit parsing, the app-server client, the sign-in flows) live in internal/runner/connect. Measured 10097. Thin v1 UX1 adds step activity lines from the specialist's stream, the repository head and checks gate in the index and project-tagged notes (about 120 lines); measured 8615 with slice 4c's review fixes. Thin v1 slice 4c adds the merge step (mergestep.go, about 190 lines) and the rebase round beside the slice 4b ask fixes. Thin v1 slice 3 adds Engineering steps beside the coordinator: the durable step state and engine (step.go) and the executor that checks out the task tree, runs the CLI in the implement containment, commits and pushes (engineer.go), about 800 lines sharing the coordinator's launch, tool socket and account selection. Measured 5686 source lines. Splitting would export the launch internals; revisit at the slice 7 sweep. Slice 4 adds checks and review on a candidate (judge.go) and the merge watch (merge.go), about 800 lines, sharing the Engineer launch path; measured 6808, 7035 after review round 1 (branch head watch, deadlines, streamed outputs). Slice 4b keeps Engineering and Review sessions and answers the creator's questions from them (ask.go: kept-session and ask state, read-only git tools, the answer stream), about 700 lines on the same launch path. Mac P2 diagnostics hand the probes' host runner.log's WARN (macHost.warn, 8 lines) and pin it with a test (12 lines): measured 16854/8411. Mac probe deadlines bound the booted simctl list, move the worker's wait for the probes out of its lock (hold) and warn when a probe run reaches its limit (about 24 lines); their tests (mac_stall_test.go: a fake xcrun that never answers, probes stalled while an update applies, about 270 lines) beside the Mac host they drive: measured 16846/8399. Release slice 1 merged onto main: measured 16822/8130. Release slice 1 (hosted checks) adds the hub's hosted CI verdict for checks: the deferred one-read poll with its persisted deadline, the one-snapshot verdict, the failing units and the restart case (judge_hosted.go, about 200 lines) and the forge's CI reads (forge.go, about 40); measured 16821. Its tests (judge_hosted_test.go, about 270 lines) take the package's tests to 8113, beside the step engine they drive. The leftover helper's debug line adds 3 lines: measured 16572. The Mac host's hang fix and probe pacing add the process group and its kill (procgroup_unix.go, procgroup_other.go), the bounded wait for a command's output, and the untrusted report's rerun decision with its tool fingerprint (about 165 lines); measured 16569. Runner startup logs add the info lines a silent start is pinned to a phase by (startup phases, the Mac host's xcode-select and capability commands, slow-command warnings, the probes, and the link's connecting, hello and welcome lines: startPhase, openRunner, watchSlow and logged, about 155 lines); measured 16405. Merge authority thin v1 adds the review's measured change facts (facts.go: raw and numstat listings, modes, signing lines, the revert tree check, about 230 lines), the merge_request confirmation and the merge's provenance; measured 16196 with spend-1 merged. Spend 1 resumes a fix round in Engineering's kept session on its healthy connection (fixSession, fixPlan, fixPrompt, keptCommit, about 90 lines); measured 15873. Claude's sign-in by a link's review round 1 contains its setup-token in a recorded namespace (the contained terminal, its proven stop and the start's recovery before a home goes, about 130 lines); measured 15787. Claude's sign-in by a link adds the runner's own setup-token attempt, the code's sealed delivery with its crash boundaries and the shared token commit (signin.go, about 300 lines, less the removed terminal watcher); measured 15655. Claude setup tokens add sealed delivery, the token check, Check again and recovery (token.go, tokencheck.go, about 700 lines) beside the composer and Mac lines; measured 15239. Astra round 2 moves the attachment quota to admission: arriving files counted by declared size, admissions protecting a file until its message names it, room made from the oldest unprotected files, refusal as runner_storage_full, and a sweep that stops when protection cannot be read (about 150 lines); measured 12191. Mac runners slices A and B add protocol negotiation (link.go), the capability report, the start authorization, the pack relay (relay.go), the primary's publication, the worker executor (worker.go) and the test-build fake worker, about 2700 lines on the same step engine. Composer attachments add the chunked receipt with exactly-once writes, the read-only desk delivery and its checks (files.go, about 230 lines), image blocks and localImage inputs, the attachment read through read_file; measured 11736. Connections slice 1 Astra round 1 adds the Codex step path (codexstep.go: Engineering and Review on the pinned app-server in the implement and inspect containment, about 300 lines); measured 11345. Connections slice 1 (after Astra round 1) also keeps a durable ledger of each turn's write tools so a later attempt never repeats one (effects.go), the waiting state between attempts and usage rows per attempt, about 500 lines more; measured 10590 before gate 1d. Connections slice 1 adds the Codex coordinator beside the Claude one (codex.go: the pinned app-server over JSON-RPC in the converse containment, sharing the coordinator base, desk, tool socket and session table), the connection registry over the bindings with health and provider limits (conns.go), in-app sign-in attempts (connector.go) and turn failover and holding (failover.go), about 1500 lines; the pure parts (the choice function, limit parsing, the app-server client, the sign-in flows) live in internal/runner/connect. Measured 10097. Thin v1 UX1 adds step activity lines from the specialist's stream, the repository head and checks gate in the index and project-tagged notes (about 120 lines); measured 8615 with slice 4c's review fixes. Thin v1 slice 4c adds the merge step (mergestep.go, about 190 lines) and the rebase round beside the slice 4b ask fixes. Thin v1 slice 3 adds Engineering steps beside the coordinator: the durable step state and engine (step.go) and the executor that checks out the task tree, runs the CLI in the implement containment, commits and pushes (engineer.go), about 800 lines sharing the coordinator's launch, tool socket and account selection. Measured 5686 source lines. Splitting would export the launch internals; revisit at the slice 7 sweep. Slice 4 adds checks and review on a candidate (judge.go) and the merge watch (merge.go), about 800 lines, sharing the Engineer launch path; measured 6808, 7035 after review round 1 (branch head watch, deadlines, streamed outputs). Slice 4b keeps Engineering and Review sessions and answers the creator's questions from them (ask.go: kept-session and ask state, read-only git tools, the answer stream), about 700 lines on the same launch path. The paste box house rule merged onto the runner logs: measured 16573. The leftover helper's debug line adds 3 lines: measured 16572. The Mac host's hang fix and probe pacing add the process group and its kill (procgroup_unix.go, procgroup_other.go), the bounded wait for a command's output, and the untrusted report's rerun decision with its tool fingerprint (about 165 lines); measured 16569. Runner startup logs add the info lines a silent start is pinned to a phase by (startup phases, the Mac host's xcode-select and capability commands, slow-command warnings, the probes, and the link's connecting, hello and welcome lines: startPhase, openRunner, watchSlow and logged, about 155 lines); measured 16405. Merge authority thin v1 adds the review's measured change facts (facts.go: raw and numstat listings, modes, signing lines, the revert tree check, about 230 lines), the merge_request confirmation and the merge's provenance; measured 16196 with spend-1 merged. Spend 1 resumes a fix round in Engineering's kept session on its healthy connection (fixSession, fixPlan, fixPrompt, keptCommit, about 90 lines); measured 15873. Claude's sign-in by a link's review round 1 contains its setup-token in a recorded namespace (the contained terminal, its proven stop and the start's recovery before a home goes, about 130 lines); measured 15787. Claude's sign-in by a link adds the runner's own setup-token attempt, the code's sealed delivery with its crash boundaries and the shared token commit (signin.go, about 300 lines, less the removed terminal watcher); measured 15655. Claude setup tokens add sealed delivery, the token check, Check again and recovery (token.go, tokencheck.go, about 700 lines) beside the composer and Mac lines; measured 15239. Astra round 2 moves the attachment quota to admission: arriving files counted by declared size, admissions protecting a file until its message names it, room made from the oldest unprotected files, refusal as runner_storage_full, and a sweep that stops when protection cannot be read (about 150 lines); measured 12191. Mac runners slices A and B add protocol negotiation (link.go), the capability report, the start authorization, the pack relay (relay.go), the primary's publication, the worker executor (worker.go) and the test-build fake worker, about 2700 lines on the same step engine. Composer attachments add the chunked receipt with exactly-once writes, the read-only desk delivery and its checks (files.go, about 230 lines), image blocks and localImage inputs, the attachment read through read_file; measured 11736. Connections slice 1 Astra round 1 adds the Codex step path (codexstep.go: Engineering and Review on the pinned app-server in the implement and inspect containment, about 300 lines); measured 11345. Connections slice 1 (after Astra round 1) also keeps a durable ledger of each turn's write tools so a later attempt never repeats one (effects.go), the waiting state between attempts and usage rows per attempt, about 500 lines more; measured 10590 before gate 1d. Connections slice 1 adds the Codex coordinator beside the Claude one (codex.go: the pinned app-server over JSON-RPC in the converse containment, sharing the coordinator base, desk, tool socket and session table), the connection registry over the bindings with health and provider limits (conns.go), in-app sign-in attempts (connector.go) and turn failover and holding (failover.go), about 1500 lines; the pure parts (the choice function, limit parsing, the app-server client, the sign-in flows) live in internal/runner/connect. Measured 10097. Thin v1 UX1 adds step activity lines from the specialist's stream, the repository head and checks gate in the index and project-tagged notes (about 120 lines); measured 8615 with slice 4c's review fixes. Thin v1 slice 4c adds the merge step (mergestep.go, about 190 lines) and the rebase round beside the slice 4b ask fixes. Thin v1 slice 3 adds Engineering steps beside the coordinator: the durable step state and engine (step.go) and the executor that checks out the task tree, runs the CLI in the implement containment, commits and pushes (engineer.go), about 800 lines sharing the coordinator's launch, tool socket and account selection. Measured 5686 source lines. Splitting would export the launch internals; revisit at the slice 7 sweep. Slice 4 adds checks and review on a candidate (judge.go) and the merge watch (merge.go), about 800 lines, sharing the Engineer launch path; measured 6808, 7035 after review round 1 (branch head watch, deadlines, streamed outputs). Slice 4b keeps Engineering and Review sessions and answers the creator's questions from them (ask.go: kept-session and ask state, read-only git tools, the answer stream), about 700 lines on the same launch path.
+size internal/runner/thin 17833 9436 Release previews Astra round 2 adds the credential file checks (no link, exactly 0600, owned, never inside a mounted root, errors without content), the empty account listing and the cancelled reconcile (about 55 lines) and their tests (about 90); measured 17833 source and 9436 test lines. Release previews add the preview step (preview.go: the strict config from git objects, the export from git objects with its caps and digest, the fixed carlos commands each behind a publish check, the marker check that follows no redirect, the restart reconcile, about 560 lines) and its tests (preview_test.go, about 430 lines); measured 17777 source and 9347 test lines. Mac pending cleanup: the warm waits while an attempt's cleanup is pending (5 lines, test 4); measured 17165/8918. Mac simulators before T: quietSimulators shuts every simulator down (bounded) before a T cleanup and logs what is left (about 43 lines), and its test with a hung simctl (about 45 lines); measured 17160/8914. Mac user temp: the Mac host resolves the user's T and refuses an untrusted one (macUserTemp, why in words), gives every gate one turn across the worker and the probe command, and warms Xcode's plugin cache once per Xcode outside the sandbox (warm, warmNow; about 71 lines); its tests pin T on the srt gates, a refused T and the warm's once, retry and turn (about 46 lines); measured 17117/8869. Engineering in an empty repository: the step starts from no base and tells Engineering so, the push names an unborn default, Review reads an initial commit against the empty tree (changeDiff), checks list its files, and a repository whose only branches are task branches stays empty (onlyTaskBranches; about 60 lines); their tests (the task-branch, review diff and prompt tests in index_empty_test.go, about 92 lines): measured 17046/8823. Mac checks wait for the sandbox: macChecks.Run refuses unproven without the dispatch's consent, the consent context, the worker's refusal report and the link's protocol 7 gate (about 38 lines), and their tests (sandbox_consent_test.go, about 131 lines); measured 16986/8731. Mac Xcode scratch: the Mac host test pins the gate's environment (the runner user's HOME kept, no scratch home; 6 lines); measured 16948/8600. Empty repositories merged onto main: measured 16948/8594. Empty repositories: the index lists a reachable repository with no commits as empty, DefaultBranch tells that from no access (lsRemote), reads of it say so, and the handshake hello keeps empty entries back until a protocol 6 welcome (about 52 lines); their tests (index_empty_test.go, the handshake hello at protocols 5 and 6, startLinkWith; about 183 lines). Token row facts merged onto main: measured 16896/8411. Token row facts read the check's rate limit and record it as a turn's (TokenCheck, the Verify wiring, about 40 lines); measured 16614. The leftover helper's debug line adds 3 lines: measured 16572. The Mac host's hang fix and probe pacing add the process group and its kill (procgroup_unix.go, procgroup_other.go), the bounded wait for a command's output, and the untrusted report's rerun decision with its tool fingerprint (about 165 lines); measured 16569. Runner startup logs add the info lines a silent start is pinned to a phase by (startup phases, the Mac host's xcode-select and capability commands, slow-command warnings, the probes, and the link's connecting, hello and welcome lines: startPhase, openRunner, watchSlow and logged, about 155 lines); measured 16405. Merge authority thin v1 adds the review's measured change facts (facts.go: raw and numstat listings, modes, signing lines, the revert tree check, about 230 lines), the merge_request confirmation and the merge's provenance; measured 16196 with spend-1 merged. Spend 1 resumes a fix round in Engineering's kept session on its healthy connection (fixSession, fixPlan, fixPrompt, keptCommit, about 90 lines); measured 15873. Claude's sign-in by a link's review round 1 contains its setup-token in a recorded namespace (the contained terminal, its proven stop and the start's recovery before a home goes, about 130 lines); measured 15787. Claude's sign-in by a link adds the runner's own setup-token attempt, the code's sealed delivery with its crash boundaries and the shared token commit (signin.go, about 300 lines, less the removed terminal watcher); measured 15655. Claude setup tokens add sealed delivery, the token check, Check again and recovery (token.go, tokencheck.go, about 700 lines) beside the composer and Mac lines; measured 15239. Astra round 2 moves the attachment quota to admission: arriving files counted by declared size, admissions protecting a file until its message names it, room made from the oldest unprotected files, refusal as runner_storage_full, and a sweep that stops when protection cannot be read (about 150 lines); measured 12191. Mac runners slices A and B add protocol negotiation (link.go), the capability report, the start authorization, the pack relay (relay.go), the primary's publication, the worker executor (worker.go) and the test-build fake worker, about 2700 lines on the same step engine. Composer attachments add the chunked receipt with exactly-once writes, the read-only desk delivery and its checks (files.go, about 230 lines), image blocks and localImage inputs, the attachment read through read_file; measured 11736. Connections slice 1 Astra round 1 adds the Codex step path (codexstep.go: Engineering and Review on the pinned app-server in the implement and inspect containment, about 300 lines); measured 11345. Connections slice 1 (after Astra round 1) also keeps a durable ledger of each turn's write tools so a later attempt never repeats one (effects.go), the waiting state between attempts and usage rows per attempt, about 500 lines more; measured 10590 before gate 1d. Connections slice 1 adds the Codex coordinator beside the Claude one (codex.go: the pinned app-server over JSON-RPC in the converse containment, sharing the coordinator base, desk, tool socket and session table), the connection registry over the bindings with health and provider limits (conns.go), in-app sign-in attempts (connector.go) and turn failover and holding (failover.go), about 1500 lines; the pure parts (the choice function, limit parsing, the app-server client, the sign-in flows) live in internal/runner/connect. Measured 10097. Thin v1 UX1 adds step activity lines from the specialist's stream, the repository head and checks gate in the index and project-tagged notes (about 120 lines); measured 8615 with slice 4c's review fixes. Thin v1 slice 4c adds the merge step (mergestep.go, about 190 lines) and the rebase round beside the slice 4b ask fixes. Thin v1 slice 3 adds Engineering steps beside the coordinator: the durable step state and engine (step.go) and the executor that checks out the task tree, runs the CLI in the implement containment, commits and pushes (engineer.go), about 800 lines sharing the coordinator's launch, tool socket and account selection. Measured 5686 source lines. Splitting would export the launch internals; revisit at the slice 7 sweep. Slice 4 adds checks and review on a candidate (judge.go) and the merge watch (merge.go), about 800 lines, sharing the Engineer launch path; measured 6808, 7035 after review round 1 (branch head watch, deadlines, streamed outputs). Slice 4b keeps Engineering and Review sessions and answers the creator's questions from them (ask.go: kept-session and ask state, read-only git tools, the answer stream), about 700 lines on the same launch path. Mac P2 diagnostics hand the probes' host runner.log's WARN (macHost.warn, 8 lines) and pin it with a test (12 lines): measured 16854/8411. Mac probe deadlines bound the booted simctl list, move the worker's wait for the probes out of its lock (hold) and warn when a probe run reaches its limit (about 24 lines); their tests (mac_stall_test.go: a fake xcrun that never answers, probes stalled while an update applies, about 270 lines) beside the Mac host they drive: measured 16846/8399. Release slice 1 merged onto main: measured 16822/8130. Release slice 1 (hosted checks) adds the hub's hosted CI verdict for checks: the deferred one-read poll with its persisted deadline, the one-snapshot verdict, the failing units and the restart case (judge_hosted.go, about 200 lines) and the forge's CI reads (forge.go, about 40); measured 16821. Its tests (judge_hosted_test.go, about 270 lines) take the package's tests to 8113, beside the step engine they drive. The leftover helper's debug line adds 3 lines: measured 16572. The Mac host's hang fix and probe pacing add the process group and its kill (procgroup_unix.go, procgroup_other.go), the bounded wait for a command's output, and the untrusted report's rerun decision with its tool fingerprint (about 165 lines); measured 16569. Runner startup logs add the info lines a silent start is pinned to a phase by (startup phases, the Mac host's xcode-select and capability commands, slow-command warnings, the probes, and the link's connecting, hello and welcome lines: startPhase, openRunner, watchSlow and logged, about 155 lines); measured 16405. Merge authority thin v1 adds the review's measured change facts (facts.go: raw and numstat listings, modes, signing lines, the revert tree check, about 230 lines), the merge_request confirmation and the merge's provenance; measured 16196 with spend-1 merged. Spend 1 resumes a fix round in Engineering's kept session on its healthy connection (fixSession, fixPlan, fixPrompt, keptCommit, about 90 lines); measured 15873. Claude's sign-in by a link's review round 1 contains its setup-token in a recorded namespace (the contained terminal, its proven stop and the start's recovery before a home goes, about 130 lines); measured 15787. Claude's sign-in by a link adds the runner's own setup-token attempt, the code's sealed delivery with its crash boundaries and the shared token commit (signin.go, about 300 lines, less the removed terminal watcher); measured 15655. Claude setup tokens add sealed delivery, the token check, Check again and recovery (token.go, tokencheck.go, about 700 lines) beside the composer and Mac lines; measured 15239. Astra round 2 moves the attachment quota to admission: arriving files counted by declared size, admissions protecting a file until its message names it, room made from the oldest unprotected files, refusal as runner_storage_full, and a sweep that stops when protection cannot be read (about 150 lines); measured 12191. Mac runners slices A and B add protocol negotiation (link.go), the capability report, the start authorization, the pack relay (relay.go), the primary's publication, the worker executor (worker.go) and the test-build fake worker, about 2700 lines on the same step engine. Composer attachments add the chunked receipt with exactly-once writes, the read-only desk delivery and its checks (files.go, about 230 lines), image blocks and localImage inputs, the attachment read through read_file; measured 11736. Connections slice 1 Astra round 1 adds the Codex step path (codexstep.go: Engineering and Review on the pinned app-server in the implement and inspect containment, about 300 lines); measured 11345. Connections slice 1 (after Astra round 1) also keeps a durable ledger of each turn's write tools so a later attempt never repeats one (effects.go), the waiting state between attempts and usage rows per attempt, about 500 lines more; measured 10590 before gate 1d. Connections slice 1 adds the Codex coordinator beside the Claude one (codex.go: the pinned app-server over JSON-RPC in the converse containment, sharing the coordinator base, desk, tool socket and session table), the connection registry over the bindings with health and provider limits (conns.go), in-app sign-in attempts (connector.go) and turn failover and holding (failover.go), about 1500 lines; the pure parts (the choice function, limit parsing, the app-server client, the sign-in flows) live in internal/runner/connect. Measured 10097. Thin v1 UX1 adds step activity lines from the specialist's stream, the repository head and checks gate in the index and project-tagged notes (about 120 lines); measured 8615 with slice 4c's review fixes. Thin v1 slice 4c adds the merge step (mergestep.go, about 190 lines) and the rebase round beside the slice 4b ask fixes. Thin v1 slice 3 adds Engineering steps beside the coordinator: the durable step state and engine (step.go) and the executor that checks out the task tree, runs the CLI in the implement containment, commits and pushes (engineer.go), about 800 lines sharing the coordinator's launch, tool socket and account selection. Measured 5686 source lines. Splitting would export the launch internals; revisit at the slice 7 sweep. Slice 4 adds checks and review on a candidate (judge.go) and the merge watch (merge.go), about 800 lines, sharing the Engineer launch path; measured 6808, 7035 after review round 1 (branch head watch, deadlines, streamed outputs). Slice 4b keeps Engineering and Review sessions and answers the creator's questions from them (ask.go: kept-session and ask state, read-only git tools, the answer stream), about 700 lines on the same launch path. The paste box house rule merged onto the runner logs: measured 16573. The leftover helper's debug line adds 3 lines: measured 16572. The Mac host's hang fix and probe pacing add the process group and its kill (procgroup_unix.go, procgroup_other.go), the bounded wait for a command's output, and the untrusted report's rerun decision with its tool fingerprint (about 165 lines); measured 16569. Runner startup logs add the info lines a silent start is pinned to a phase by (startup phases, the Mac host's xcode-select and capability commands, slow-command warnings, the probes, and the link's connecting, hello and welcome lines: startPhase, openRunner, watchSlow and logged, about 155 lines); measured 16405. Merge authority thin v1 adds the review's measured change facts (facts.go: raw and numstat listings, modes, signing lines, the revert tree check, about 230 lines), the merge_request confirmation and the merge's provenance; measured 16196 with spend-1 merged. Spend 1 resumes a fix round in Engineering's kept session on its healthy connection (fixSession, fixPlan, fixPrompt, keptCommit, about 90 lines); measured 15873. Claude's sign-in by a link's review round 1 contains its setup-token in a recorded namespace (the contained terminal, its proven stop and the start's recovery before a home goes, about 130 lines); measured 15787. Claude's sign-in by a link adds the runner's own setup-token attempt, the code's sealed delivery with its crash boundaries and the shared token commit (signin.go, about 300 lines, less the removed terminal watcher); measured 15655. Claude setup tokens add sealed delivery, the token check, Check again and recovery (token.go, tokencheck.go, about 700 lines) beside the composer and Mac lines; measured 15239. Astra round 2 moves the attachment quota to admission: arriving files counted by declared size, admissions protecting a file until its message names it, room made from the oldest unprotected files, refusal as runner_storage_full, and a sweep that stops when protection cannot be read (about 150 lines); measured 12191. Mac runners slices A and B add protocol negotiation (link.go), the capability report, the start authorization, the pack relay (relay.go), the primary's publication, the worker executor (worker.go) and the test-build fake worker, about 2700 lines on the same step engine. Composer attachments add the chunked receipt with exactly-once writes, the read-only desk delivery and its checks (files.go, about 230 lines), image blocks and localImage inputs, the attachment read through read_file; measured 11736. Connections slice 1 Astra round 1 adds the Codex step path (codexstep.go: Engineering and Review on the pinned app-server in the implement and inspect containment, about 300 lines); measured 11345. Connections slice 1 (after Astra round 1) also keeps a durable ledger of each turn's write tools so a later attempt never repeats one (effects.go), the waiting state between attempts and usage rows per attempt, about 500 lines more; measured 10590 before gate 1d. Connections slice 1 adds the Codex coordinator beside the Claude one (codex.go: the pinned app-server over JSON-RPC in the converse containment, sharing the coordinator base, desk, tool socket and session table), the connection registry over the bindings with health and provider limits (conns.go), in-app sign-in attempts (connector.go) and turn failover and holding (failover.go), about 1500 lines; the pure parts (the choice function, limit parsing, the app-server client, the sign-in flows) live in internal/runner/connect. Measured 10097. Thin v1 UX1 adds step activity lines from the specialist's stream, the repository head and checks gate in the index and project-tagged notes (about 120 lines); measured 8615 with slice 4c's review fixes. Thin v1 slice 4c adds the merge step (mergestep.go, about 190 lines) and the rebase round beside the slice 4b ask fixes. Thin v1 slice 3 adds Engineering steps beside the coordinator: the durable step state and engine (step.go) and the executor that checks out the task tree, runs the CLI in the implement containment, commits and pushes (engineer.go), about 800 lines sharing the coordinator's launch, tool socket and account selection. Measured 5686 source lines. Splitting would export the launch internals; revisit at the slice 7 sweep. Slice 4 adds checks and review on a candidate (judge.go) and the merge watch (merge.go), about 800 lines, sharing the Engineer launch path; measured 6808, 7035 after review round 1 (branch head watch, deadlines, streamed outputs). Slice 4b keeps Engineering and Review sessions and answers the creator's questions from them (ask.go: kept-session and ask state, read-only git tools, the answer stream), about 700 lines on the same launch path.
time internal/thintest 180s Mac runners slices A and B add role, scoping, migration, placement, withdrawal, transfer and publication contracts, and Astra round 1 eight transition contracts (about 15s; the package measured 126s locally under load). Housekeeping slice 1 adds six contract tests (combine, Undo round trips and the race, Pause, auto-disable, quiet hours, restart while claimed; about 6s); the package measured 67.7s beside other packages locally, so 75s. Thin v1 slice 4c adds the merge, adoption, cancel and retention contract tests (CI measured 35.7s). Thin v1 contract tests: a real instance and a scripted runner per test, fixtures replayed against every request, frame and event. Slice 3 adds the task, step-sync and grant contracts; CI measured 14.805s. 30s keeps room for the slice 4 review contracts. UX1 adds step activity, task source and duplicates, coordinator merging and project facts (four contracts, about 6s); the package measured 34s locally under load, so 40s. UX1's inner screens gallery (two owners, seven tasks, every page) adds about 3s; measured 40.9s locally under load, so 60s.
time internal/runner/mac 30s Mac runners (Darwin worker): real process groups killed after a grace and proven gone (SIGTERM, SIGKILL, the marker sweep), and the probes run end to end with fake srt and xcodebuild, P6 killing a waiting test two seconds after it starts. About 6s alone; loaded CI measured 12.5s.
time internal/runner/thin 45s Thin v1 slice 4 review: real git repositories for the merge and squash checks, a stalled fetch, and a 16 MiB candidate streamed through the review diff and the checks pack (about 5s). Measured 17.8s locally under load. Slice 4b review adds a 16 MiB git output bound, an injected index-pack failure and stall (3s deadline) and held-answer tests; measured 30.3s locally under load. 45s keeps 33 percent headroom.
@@ -49,7 +49,7 @@ perf GET /api/v1/notebook skip Thin v1 person API: bearer-only JSON for devices;
perf GET /api/v1/thinking skip Thin v1 person API: bearer-only JSON for devices; the browser reads thinking words on /settings/thinking.
perf GET /api/v1/tasks skip Thin v1 person API: bearer-only JSON for devices; the browser reads tasks through /tasks.
perf GET /api/v1/tasks/{id} skip Thin v1 person API: bearer-only JSON for devices; the browser reads a task through /tasks/{id}.
-size internal/equipo/chat 15619 - Release previews add the preview step's store side (preview.go: scheduling once per approved candidate, the start and publish checks inside the lease transaction, the built and done reports' acceptance, the fence for older runners and the audit rows, about 260 lines); measured 15619. Needs-you triage: triage's three actions, the stall sweep, the ledger's rounds, the view and RoundTask (triage.go, about 690 lines; retryStep factored out of RetryTask); measured 15343. Mac checks wait for the sandbox: placement holds checks off a Mac whose sandbox is not proven (waiting_sandbox), the refusal puts them back to wait, a newly proven hello places them, recheckMac skips an unproven Mac, and RunUnsandboxed records and audits the creator's choice (macsandbox.go; about 186 lines); measured 14519. Empty repositories merged onto main: measured 14333. Empty repositories: the read gate answers empty and not read yet, find covers repositories on the runner's list, and the access card names a namespace only from ns/repo (AccessName, GrantNamespace; about 58 lines). Token row facts merged onto main: measured 14275. Token row facts add the stated email's store write with its shape check and the row facts read (StatedEmailShape, SetStatedEmail, ConnectionRowFacts, about 95 lines); measured 14195. Turn batching adds turnText, the frame fit (fitTail, batchFull) and the stranded-turn recovery in sync (about 115 lines); measured 14095. The re-run ruling (recheckMayMerge, refreshAfterRecheck, about 70 lines); measured 13981. Merge authority thin v1 adds the gate's store side (mergeauth.go: authorizeMerge before dispatch and at each hub request, the fence for runners below the merge-facts protocol, the ask card in Equipo's words, the ships question, receipts with Undo, the policy tool and API, about 1000 lines); the gate is pure, in internal/equipo/mergegate, but its inputs and audit must be read and written inside the store's transactions. Measured 13204. Mac recheck runs a waiting task's needs_macos checks again when a Mac that fits arrives (macrecheck.go, about 90 lines); measured 12485. Spend 1 merged onto Projects UX: measured 12376 with both. Spend 1 adds a task's spend from its usage rows (TaskSpend, about 60 lines) and the usage rows' round; measured 12047. Projects UX adds per-person project stars with the auto-star reconciliation, the person's and the coordinator's star_project (stars.go, about 210 lines) and the project's own repository in its view; measured 12206. Claude's sign-in by a link adds the code route beside the token's in SendSecret, the sign-in prompt and the kind it becomes (about 40 lines); measured 11933. Mac runners slices A and B add per-runner mailboxes, placement, withdrawal, the offline rule, the runners view, transfers and publication (runners.go, transfers.go, about 1100 lines). Composer attachments add uploads, the message link, the mailbox relay with chunk frames hydrated from the stored file, and serving (attachments.go, attachments_http.go, about 330 lines); the link and relay run inside the send and dispatch transactions, so they live beside them; sniffing and stripping are pure, in internal/attach. Measured 10292. Merged with UX1 thinking words (f2602d3), measured 9801. Housekeeping slice 1 adds the loop's ledger and state machine, the housekeeping principal's checks inside the shared store functions, reservations, Pause, quiet hours, the digest, claim recovery and the API (housekeeping.go, housekeeping_control.go, housekeeping_http.go, about 1,350 lines); the checks must run inside the store's transactions, so they live beside them; the detectors themselves are pure, in internal/equipo/housekeeping. Measured 9637. Thin v1 UX1 thinking words adds the per-person set and its API (thinking.go, about 100 lines); measured 8305. Connections slice 1 review round 2: the mutation ledger matches record_task by subject only and refuses an ambiguous call with the earlier operations, the preference and forget (about 120 lines); measured 8236. Thin v1 UX1 round 3 adds Equipo combining duplicate tasks reversibly (duplicates.go: detection, the in-transaction fold checks, fold, Undo, about 400 lines) and headlines on findings and steps (headline.go); measured 7898. Connections slice 1 adds connection records from hello and attempts, the connect mailbox, the API, usage rows and the turn's mutation ledger (connections.go and tools.go, about 600 lines); measured 7400 after merging UX1. Thin v1 UX1 adds step activity lines, duplicates and their fold, the coordinator at work on a task, project facts from the runner catalog and open merge cards for the pages (inner.go, about 330 lines); measured 6610 with slice 4c's review fixes. Thin v1 slice 4c adds the merge policy, the merge card, the rebase round and duplicate reports (merge.go, about 380 lines). Thin v1 instance core: conversation, projects, tasks, review and, from slice 4b, questions to the specialists (questions.go, about 470 lines) share one store, transaction and event log; splitting would export the transaction internals. Measured 5514 source lines; revisit at the slice 7 sweep. The duplicate keep rule merged onto main: measured 14175. The duplicate combine keeps the decided task: the housekeeping view reads each task's newest merge card and marks it Decided (about 12 lines); measured 14110. Turn batching adds turnText, the frame fit (fitTail, batchFull) and the stranded-turn recovery in sync (about 115 lines); measured 14095. The re-run ruling (recheckMayMerge, refreshAfterRecheck, about 70 lines); measured 13981. Merge authority thin v1 adds the gate's store side (mergeauth.go: authorizeMerge before dispatch and at each hub request, the fence for runners below the merge-facts protocol, the ask card in Equipo's words, the ships question, receipts with Undo, the policy tool and API, about 1000 lines); the gate is pure, in internal/equipo/mergegate, but its inputs and audit must be read and written inside the store's transactions. Measured 13204. Mac recheck runs a waiting task's needs_macos checks again when a Mac that fits arrives (macrecheck.go, about 90 lines); measured 12485. Spend 1 merged onto Projects UX: measured 12376 with both. Spend 1 adds a task's spend from its usage rows (TaskSpend, about 60 lines) and the usage rows' round; measured 12047. Projects UX adds per-person project stars with the auto-star reconciliation, the person's and the coordinator's star_project (stars.go, about 210 lines) and the project's own repository in its view; measured 12206. Claude's sign-in by a link adds the code route beside the token's in SendSecret, the sign-in prompt and the kind it becomes (about 40 lines); measured 11933. Mac runners slices A and B add per-runner mailboxes, placement, withdrawal, the offline rule, the runners view, transfers and publication (runners.go, transfers.go, about 1100 lines). Composer attachments add uploads, the message link, the mailbox relay with chunk frames hydrated from the stored file, and serving (attachments.go, attachments_http.go, about 330 lines); the link and relay run inside the send and dispatch transactions, so they live beside them; sniffing and stripping are pure, in internal/attach. Measured 10292. Merged with UX1 thinking words (f2602d3), measured 9801. Housekeeping slice 1 adds the loop's ledger and state machine, the housekeeping principal's checks inside the shared store functions, reservations, Pause, quiet hours, the digest, claim recovery and the API (housekeeping.go, housekeeping_control.go, housekeeping_http.go, about 1,350 lines); the checks must run inside the store's transactions, so they live beside them; the detectors themselves are pure, in internal/equipo/housekeeping. Measured 9637. Thin v1 UX1 thinking words adds the per-person set and its API (thinking.go, about 100 lines); measured 8305. Connections slice 1 review round 2: the mutation ledger matches record_task by subject only and refuses an ambiguous call with the earlier operations, the preference and forget (about 120 lines); measured 8236. Thin v1 UX1 round 3 adds Equipo combining duplicate tasks reversibly (duplicates.go: detection, the in-transaction fold checks, fold, Undo, about 400 lines) and headlines on findings and steps (headline.go); measured 7898. Connections slice 1 adds connection records from hello and attempts, the connect mailbox, the API, usage rows and the turn's mutation ledger (connections.go and tools.go, about 600 lines); measured 7400 after merging UX1. Thin v1 UX1 adds step activity lines, duplicates and their fold, the coordinator at work on a task, project facts from the runner catalog and open merge cards for the pages (inner.go, about 330 lines); measured 6610 with slice 4c's review fixes. Thin v1 slice 4c adds the merge policy, the merge card, the rebase round and duplicate reports (merge.go, about 380 lines). Thin v1 instance core: conversation, projects, tasks, review and, from slice 4b, questions to the specialists (questions.go, about 470 lines) share one store, transaction and event log; splitting would export the transaction internals. Measured 5514 source lines; revisit at the slice 7 sweep. Release slice 1 (hosted checks) adds the hosted CI offer, the binding's acceptance inside the step report's transaction, the hosted sandbox rule and the fix round's failing units (about 65 lines); measured 14160. Turn batching adds turnText, the frame fit (fitTail, batchFull) and the stranded-turn recovery in sync (about 115 lines); measured 14095. The re-run ruling (recheckMayMerge, refreshAfterRecheck, about 70 lines); measured 13981. Merge authority thin v1 adds the gate's store side (mergeauth.go: authorizeMerge before dispatch and at each hub request, the fence for runners below the merge-facts protocol, the ask card in Equipo's words, the ships question, receipts with Undo, the policy tool and API, about 1000 lines); the gate is pure, in internal/equipo/mergegate, but its inputs and audit must be read and written inside the store's transactions. Measured 13204. Mac recheck runs a waiting task's needs_macos checks again when a Mac that fits arrives (macrecheck.go, about 90 lines); measured 12485. Spend 1 merged onto Projects UX: measured 12376 with both. Spend 1 adds a task's spend from its usage rows (TaskSpend, about 60 lines) and the usage rows' round; measured 12047. Projects UX adds per-person project stars with the auto-star reconciliation, the person's and the coordinator's star_project (stars.go, about 210 lines) and the project's own repository in its view; measured 12206. Claude's sign-in by a link adds the code route beside the token's in SendSecret, the sign-in prompt and the kind it becomes (about 40 lines); measured 11933. Mac runners slices A and B add per-runner mailboxes, placement, withdrawal, the offline rule, the runners view, transfers and publication (runners.go, transfers.go, about 1100 lines). Composer attachments add uploads, the message link, the mailbox relay with chunk frames hydrated from the stored file, and serving (attachments.go, attachments_http.go, about 330 lines); the link and relay run inside the send and dispatch transactions, so they live beside them; sniffing and stripping are pure, in internal/attach. Measured 10292. Merged with UX1 thinking words (f2602d3), measured 9801. Housekeeping slice 1 adds the loop's ledger and state machine, the housekeeping principal's checks inside the shared store functions, reservations, Pause, quiet hours, the digest, claim recovery and the API (housekeeping.go, housekeeping_control.go, housekeeping_http.go, about 1,350 lines); the checks must run inside the store's transactions, so they live beside them; the detectors themselves are pure, in internal/equipo/housekeeping. Measured 9637. Thin v1 UX1 thinking words adds the per-person set and its API (thinking.go, about 100 lines); measured 8305. Connections slice 1 review round 2: the mutation ledger matches record_task by subject only and refuses an ambiguous call with the earlier operations, the preference and forget (about 120 lines); measured 8236. Thin v1 UX1 round 3 adds Equipo combining duplicate tasks reversibly (duplicates.go: detection, the in-transaction fold checks, fold, Undo, about 400 lines) and headlines on findings and steps (headline.go); measured 7898. Connections slice 1 adds connection records from hello and attempts, the connect mailbox, the API, usage rows and the turn's mutation ledger (connections.go and tools.go, about 600 lines); measured 7400 after merging UX1. Thin v1 UX1 adds step activity lines, duplicates and their fold, the coordinator at work on a task, project facts from the runner catalog and open merge cards for the pages (inner.go, about 330 lines); measured 6610 with slice 4c's review fixes. Thin v1 slice 4c adds the merge policy, the merge card, the rebase round and duplicate reports (merge.go, about 380 lines). Thin v1 instance core: conversation, projects, tasks, review and, from slice 4b, questions to the specialists (questions.go, about 470 lines) share one store, transaction and event log; splitting would export the transaction internals. Measured 5514 source lines; revisit at the slice 7 sweep.
+size internal/equipo/chat 15664 - Release previews Astra round 2 adds settlePreview: a started preview is never replaced, a withdrawn one keeps its outcome (about 45 lines); measured 15664. Release previews add the preview step's store side (preview.go: scheduling once per approved candidate, the start and publish checks inside the lease transaction, the built and done reports' acceptance, the fence for older runners and the audit rows, about 260 lines); measured 15619. Needs-you triage: triage's three actions, the stall sweep, the ledger's rounds, the view and RoundTask (triage.go, about 690 lines; retryStep factored out of RetryTask); measured 15343. Mac checks wait for the sandbox: placement holds checks off a Mac whose sandbox is not proven (waiting_sandbox), the refusal puts them back to wait, a newly proven hello places them, recheckMac skips an unproven Mac, and RunUnsandboxed records and audits the creator's choice (macsandbox.go; about 186 lines); measured 14519. Empty repositories merged onto main: measured 14333. Empty repositories: the read gate answers empty and not read yet, find covers repositories on the runner's list, and the access card names a namespace only from ns/repo (AccessName, GrantNamespace; about 58 lines). Token row facts merged onto main: measured 14275. Token row facts add the stated email's store write with its shape check and the row facts read (StatedEmailShape, SetStatedEmail, ConnectionRowFacts, about 95 lines); measured 14195. Turn batching adds turnText, the frame fit (fitTail, batchFull) and the stranded-turn recovery in sync (about 115 lines); measured 14095. The re-run ruling (recheckMayMerge, refreshAfterRecheck, about 70 lines); measured 13981. Merge authority thin v1 adds the gate's store side (mergeauth.go: authorizeMerge before dispatch and at each hub request, the fence for runners below the merge-facts protocol, the ask card in Equipo's words, the ships question, receipts with Undo, the policy tool and API, about 1000 lines); the gate is pure, in internal/equipo/mergegate, but its inputs and audit must be read and written inside the store's transactions. Measured 13204. Mac recheck runs a waiting task's needs_macos checks again when a Mac that fits arrives (macrecheck.go, about 90 lines); measured 12485. Spend 1 merged onto Projects UX: measured 12376 with both. Spend 1 adds a task's spend from its usage rows (TaskSpend, about 60 lines) and the usage rows' round; measured 12047. Projects UX adds per-person project stars with the auto-star reconciliation, the person's and the coordinator's star_project (stars.go, about 210 lines) and the project's own repository in its view; measured 12206. Claude's sign-in by a link adds the code route beside the token's in SendSecret, the sign-in prompt and the kind it becomes (about 40 lines); measured 11933. Mac runners slices A and B add per-runner mailboxes, placement, withdrawal, the offline rule, the runners view, transfers and publication (runners.go, transfers.go, about 1100 lines). Composer attachments add uploads, the message link, the mailbox relay with chunk frames hydrated from the stored file, and serving (attachments.go, attachments_http.go, about 330 lines); the link and relay run inside the send and dispatch transactions, so they live beside them; sniffing and stripping are pure, in internal/attach. Measured 10292. Merged with UX1 thinking words (f2602d3), measured 9801. Housekeeping slice 1 adds the loop's ledger and state machine, the housekeeping principal's checks inside the shared store functions, reservations, Pause, quiet hours, the digest, claim recovery and the API (housekeeping.go, housekeeping_control.go, housekeeping_http.go, about 1,350 lines); the checks must run inside the store's transactions, so they live beside them; the detectors themselves are pure, in internal/equipo/housekeeping. Measured 9637. Thin v1 UX1 thinking words adds the per-person set and its API (thinking.go, about 100 lines); measured 8305. Connections slice 1 review round 2: the mutation ledger matches record_task by subject only and refuses an ambiguous call with the earlier operations, the preference and forget (about 120 lines); measured 8236. Thin v1 UX1 round 3 adds Equipo combining duplicate tasks reversibly (duplicates.go: detection, the in-transaction fold checks, fold, Undo, about 400 lines) and headlines on findings and steps (headline.go); measured 7898. Connections slice 1 adds connection records from hello and attempts, the connect mailbox, the API, usage rows and the turn's mutation ledger (connections.go and tools.go, about 600 lines); measured 7400 after merging UX1. Thin v1 UX1 adds step activity lines, duplicates and their fold, the coordinator at work on a task, project facts from the runner catalog and open merge cards for the pages (inner.go, about 330 lines); measured 6610 with slice 4c's review fixes. Thin v1 slice 4c adds the merge policy, the merge card, the rebase round and duplicate reports (merge.go, about 380 lines). Thin v1 instance core: conversation, projects, tasks, review and, from slice 4b, questions to the specialists (questions.go, about 470 lines) share one store, transaction and event log; splitting would export the transaction internals. Measured 5514 source lines; revisit at the slice 7 sweep. The duplicate keep rule merged onto main: measured 14175. The duplicate combine keeps the decided task: the housekeeping view reads each task's newest merge card and marks it Decided (about 12 lines); measured 14110. Turn batching adds turnText, the frame fit (fitTail, batchFull) and the stranded-turn recovery in sync (about 115 lines); measured 14095. The re-run ruling (recheckMayMerge, refreshAfterRecheck, about 70 lines); measured 13981. Merge authority thin v1 adds the gate's store side (mergeauth.go: authorizeMerge before dispatch and at each hub request, the fence for runners below the merge-facts protocol, the ask card in Equipo's words, the ships question, receipts with Undo, the policy tool and API, about 1000 lines); the gate is pure, in internal/equipo/mergegate, but its inputs and audit must be read and written inside the store's transactions. Measured 13204. Mac recheck runs a waiting task's needs_macos checks again when a Mac that fits arrives (macrecheck.go, about 90 lines); measured 12485. Spend 1 merged onto Projects UX: measured 12376 with both. Spend 1 adds a task's spend from its usage rows (TaskSpend, about 60 lines) and the usage rows' round; measured 12047. Projects UX adds per-person project stars with the auto-star reconciliation, the person's and the coordinator's star_project (stars.go, about 210 lines) and the project's own repository in its view; measured 12206. Claude's sign-in by a link adds the code route beside the token's in SendSecret, the sign-in prompt and the kind it becomes (about 40 lines); measured 11933. Mac runners slices A and B add per-runner mailboxes, placement, withdrawal, the offline rule, the runners view, transfers and publication (runners.go, transfers.go, about 1100 lines). Composer attachments add uploads, the message link, the mailbox relay with chunk frames hydrated from the stored file, and serving (attachments.go, attachments_http.go, about 330 lines); the link and relay run inside the send and dispatch transactions, so they live beside them; sniffing and stripping are pure, in internal/attach. Measured 10292. Merged with UX1 thinking words (f2602d3), measured 9801. Housekeeping slice 1 adds the loop's ledger and state machine, the housekeeping principal's checks inside the shared store functions, reservations, Pause, quiet hours, the digest, claim recovery and the API (housekeeping.go, housekeeping_control.go, housekeeping_http.go, about 1,350 lines); the checks must run inside the store's transactions, so they live beside them; the detectors themselves are pure, in internal/equipo/housekeeping. Measured 9637. Thin v1 UX1 thinking words adds the per-person set and its API (thinking.go, about 100 lines); measured 8305. Connections slice 1 review round 2: the mutation ledger matches record_task by subject only and refuses an ambiguous call with the earlier operations, the preference and forget (about 120 lines); measured 8236. Thin v1 UX1 round 3 adds Equipo combining duplicate tasks reversibly (duplicates.go: detection, the in-transaction fold checks, fold, Undo, about 400 lines) and headlines on findings and steps (headline.go); measured 7898. Connections slice 1 adds connection records from hello and attempts, the connect mailbox, the API, usage rows and the turn's mutation ledger (connections.go and tools.go, about 600 lines); measured 7400 after merging UX1. Thin v1 UX1 adds step activity lines, duplicates and their fold, the coordinator at work on a task, project facts from the runner catalog and open merge cards for the pages (inner.go, about 330 lines); measured 6610 with slice 4c's review fixes. Thin v1 slice 4c adds the merge policy, the merge card, the rebase round and duplicate reports (merge.go, about 380 lines). Thin v1 instance core: conversation, projects, tasks, review and, from slice 4b, questions to the specialists (questions.go, about 470 lines) share one store, transaction and event log; splitting would export the transaction internals. Measured 5514 source lines; revisit at the slice 7 sweep. Release slice 1 (hosted checks) adds the hosted CI offer, the binding's acceptance inside the step report's transaction, the hosted sandbox rule and the fix round's failing units (about 65 lines); measured 14160. Turn batching adds turnText, the frame fit (fitTail, batchFull) and the stranded-turn recovery in sync (about 115 lines); measured 14095. The re-run ruling (recheckMayMerge, refreshAfterRecheck, about 70 lines); measured 13981. Merge authority thin v1 adds the gate's store side (mergeauth.go: authorizeMerge before dispatch and at each hub request, the fence for runners below the merge-facts protocol, the ask card in Equipo's words, the ships question, receipts with Undo, the policy tool and API, about 1000 lines); the gate is pure, in internal/equipo/mergegate, but its inputs and audit must be read and written inside the store's transactions. Measured 13204. Mac recheck runs a waiting task's needs_macos checks again when a Mac that fits arrives (macrecheck.go, about 90 lines); measured 12485. Spend 1 merged onto Projects UX: measured 12376 with both. Spend 1 adds a task's spend from its usage rows (TaskSpend, about 60 lines) and the usage rows' round; measured 12047. Projects UX adds per-person project stars with the auto-star reconciliation, the person's and the coordinator's star_project (stars.go, about 210 lines) and the project's own repository in its view; measured 12206. Claude's sign-in by a link adds the code route beside the token's in SendSecret, the sign-in prompt and the kind it becomes (about 40 lines); measured 11933. Mac runners slices A and B add per-runner mailboxes, placement, withdrawal, the offline rule, the runners view, transfers and publication (runners.go, transfers.go, about 1100 lines). Composer attachments add uploads, the message link, the mailbox relay with chunk frames hydrated from the stored file, and serving (attachments.go, attachments_http.go, about 330 lines); the link and relay run inside the send and dispatch transactions, so they live beside them; sniffing and stripping are pure, in internal/attach. Measured 10292. Merged with UX1 thinking words (f2602d3), measured 9801. Housekeeping slice 1 adds the loop's ledger and state machine, the housekeeping principal's checks inside the shared store functions, reservations, Pause, quiet hours, the digest, claim recovery and the API (housekeeping.go, housekeeping_control.go, housekeeping_http.go, about 1,350 lines); the checks must run inside the store's transactions, so they live beside them; the detectors themselves are pure, in internal/equipo/housekeeping. Measured 9637. Thin v1 UX1 thinking words adds the per-person set and its API (thinking.go, about 100 lines); measured 8305. Connections slice 1 review round 2: the mutation ledger matches record_task by subject only and refuses an ambiguous call with the earlier operations, the preference and forget (about 120 lines); measured 8236. Thin v1 UX1 round 3 adds Equipo combining duplicate tasks reversibly (duplicates.go: detection, the in-transaction fold checks, fold, Undo, about 400 lines) and headlines on findings and steps (headline.go); measured 7898. Connections slice 1 adds connection records from hello and attempts, the connect mailbox, the API, usage rows and the turn's mutation ledger (connections.go and tools.go, about 600 lines); measured 7400 after merging UX1. Thin v1 UX1 adds step activity lines, duplicates and their fold, the coordinator at work on a task, project facts from the runner catalog and open merge cards for the pages (inner.go, about 330 lines); measured 6610 with slice 4c's review fixes. Thin v1 slice 4c adds the merge policy, the merge card, the rebase round and duplicate reports (merge.go, about 380 lines). Thin v1 instance core: conversation, projects, tasks, review and, from slice 4b, questions to the specialists (questions.go, about 470 lines) share one store, transaction and event log; splitting would export the transaction internals. Measured 5514 source lines; revisit at the slice 7 sweep.
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/specs/2026-11-11-equipo-release-preview.md b/docs/superpowers/specs/2026-11-11-equipo-release-preview.md
index 9dfe7550..c97e8027 100644
--- a/docs/superpowers/specs/2026-11-11-equipo-release-preview.md
+++ b/docs/superpowers/specs/2026-11-11-equipo-release-preview.md
@@ -146,6 +146,29 @@ A preview is never called shipped, deployed or live.
its wall time and bytes. A first preview uses one of the
principal's temporary create attempts.
+10. **Round 2 fixes** (Astra round 2 on 5885855, findings in
+ `CODEX-FINDINGS-RELEASE-PREVIEW-R2.md`).
+ - **No replacement after a start.** A preview attempt that started is
+ never replaced. Withdrawn, or its runner removed, it ends done and
+ "could not be confirmed" once its export was recorded as built
+ (it may have published), and cancelled before that.
+ - **A withdrawn attempt keeps its report.** A withdrawn attempt's
+ own done report is kept as it says.
+ - **Cancelled previews reconcile.** After a restart, a preview that
+ may have published reconciles from the marker even when cancelled.
+ - **The credential file is refused unless all of these hold:**
+ - it is a regular file, not a link (lstat, then `O_NOFOLLOW`);
+ - its mode is exactly 0600 and the runner's user owns it;
+ - it is outside every directory a sandbox mounts (the workspace,
+ scratch, step git directories, the Go root and the module
+ cache);
+ - its JSON decodes as expected.
+
+ Every error is a fixed sentence, never content or keys. The path
+ is one of the protected paths.
+ - **An empty account is a listing.** `carlos apps list` printing "no
+ apps in this account" counts as an empty list.
+
## 2. States and the card
- **The timeline:** "Prepared 12 files (340 KiB)." once built, then
diff --git a/docs/superpowers/specs/CODEX-FINDINGS-RELEASE-PREVIEW-R2.md b/docs/superpowers/specs/CODEX-FINDINGS-RELEASE-PREVIEW-R2.md
new file mode 100644
index 00000000..8935603d
--- /dev/null
+++ b/docs/superpowers/specs/CODEX-FINDINGS-RELEASE-PREVIEW-R2.md
@@ -0,0 +1,27 @@
+**Verdict: NOT READY.** Reviewed `5885855` against `origin/main...HEAD`. Read-only; no tests, providers, database queries or writes.
+
+Round-1 findings:
+
+1. **RESOLVED — mutation authority.** Creation deploys only the runner-written placeholder. Renew, ship and promote each have their own instance authorization immediately before invocation ([preview.go:474](/home/paulca/.cache/tmp/equipo/prevrev.XKiY/wt/internal/runner/thin/preview.go:474), [505](/home/paulca/.cache/tmp/equipo/prevrev.XKiY/wt/internal/runner/thin/preview.go:505), [517](/home/paulca/.cache/tmp/equipo/prevrev.XKiY/wt/internal/runner/thin/preview.go:517)).
+
+2. **RESOLVED — redirect exposure.** Repository content never enters bundled deploy/watch. The credential-free marker probe refuses redirects, bounds reads, requires HTTP 200 and compares exact task/candidate/step/attempt/digest ([preview.go:548](/home/paulca/.cache/tmp/equipo/prevrev.XKiY/wt/internal/runner/thin/preview.go:548)).
+
+3. **RESOLVED — start/digest authorization.** Current attempt, assignment and withdrawal are checked; preview authorization additionally verifies owner, approval, newest candidate and persisted digest. Config is reread ([runners.go:584](/home/paulca/.cache/tmp/equipo/prevrev.XKiY/wt/internal/equipo/chat/runners.go:584), [preview.go:84](/home/paulca/.cache/tmp/equipo/prevrev.XKiY/wt/internal/equipo/chat/preview.go:84)).
+
+4. **RESOLVED — export.** No repository code executes in the preview path. Export reads regular git blobs, rejects unsafe paths, enforces limits, creates private files and excludes the marker from the digest ([preview.go:197](/home/paulca/.cache/tmp/equipo/prevrev.XKiY/wt/internal/runner/thin/preview.go:197)).
+
+5. **PARTLY — uncertain outcomes.** Ordinary restart reconciliation sends no mutations. However, withdrawn reports discard their outcome and invoke replacement, permitting another attempt after possible publication ([tasks.go:976](/home/paulca/.cache/tmp/equipo/prevrev.XKiY/wt/internal/equipo/chat/tasks.go:976), [runners.go:81](/home/paulca/.cache/tmp/equipo/prevrev.XKiY/wt/internal/equipo/chat/runners.go:81)). Cancelled restart recovery also skips reconciliation ([step.go:387](/home/paulca/.cache/tmp/equipo/prevrev.XKiY/wt/internal/runner/thin/step.go:387)). Preserve unconfirmed outcomes and prohibit replacement.
+
+6. **RESOLVED — lifecycle safeguards.** Fixed task app; kept/Trash refuse before mutation; renewal precedes upload; cap refusal stops creation ([preview.go:463](/home/paulca/.cache/tmp/equipo/prevrev.XKiY/wt/internal/runner/thin/preview.go:463)).
+
+7. **RESOLVED — uniqueness/ancillary behavior.** Full step-plus-attempt versions, candidate deduplication and progress exclusion ([preview.go:508](/home/paulca/.cache/tmp/equipo/prevrev.XKiY/wt/internal/runner/thin/preview.go:508), [chat/preview.go:43](/home/paulca/.cache/tmp/equipo/prevrev.XKiY/wt/internal/equipo/chat/preview.go:43), [review.go:50](/home/paulca/.cache/tmp/equipo/prevrev.XKiY/wt/internal/equipo/chat/review.go:50)).
+
+8. **RESOLVED — old protocols.** Dispatch encoding refuses previews below 8; reconnect fences queued/running previews; publish checks cannot downgrade ([runners.go:414](/home/paulca/.cache/tmp/equipo/prevrev.XKiY/wt/internal/wire/runners.go:414), [preview.go:184](/home/paulca/.cache/tmp/equipo/prevrev.XKiY/wt/internal/equipo/chat/preview.go:184), [link.go:247](/home/paulca/.cache/tmp/equipo/prevrev.XKiY/wt/internal/runner/thin/link.go:247)).
+
+9. **RESOLVED — budget wording.** Platform code confirms 50 attempts per principal; explicitly named creation has no retry loop ([authcli.go:124](/home/paulca/amadan.net/carlos/platform/internal/console/authcli.go:124), [temporary.go:153](/home/paulca/amadan.net/carlos/platform/temporary.go:153)).
+
+**NEW Important:**
+
+- **Credential protections are incomplete.** The loader follows symlinks and accepts permissions other than exactly 0600; decoder errors are logged verbatim, potentially exposing secret-bearing unknown keys ([preview.go:56](/home/paulca/.cache/tmp/equipo/prevrev.XKiY/wt/internal/runner/thin/preview.go:56)). `PreviewCredentialPath` is absent from protected paths ([connections.go:30](/home/paulca/.cache/tmp/equipo/prevrev.XKiY/wt/internal/runner/connections.go:30)); placing it beneath a mounted directory can expose it inside the sandbox. Enforce private-file validation, redact errors and protect its canonical path.
+
+- **Empty preview accounts cannot publish.** Carlos prints “no apps in this account” without a header ([temporary.go:320](/home/paulca/amadan.net/carlos/platform/temporary.go:320)); the parser requires a header and returns `preview_state` ([preview.go:355](/home/paulca/.cache/tmp/equipo/prevrev.XKiY/wt/internal/runner/thin/preview.go:355)). Recognize the successful empty-list response explicitly.
\ No newline at end of file
diff --git a/internal/equipo/chat/preview.go b/internal/equipo/chat/preview.go
index 8ac07c39..9c92b58a 100644
--- a/internal/equipo/chat/preview.go
+++ b/internal/equipo/chat/preview.go
@@ -141,7 +141,9 @@ func acceptPreviewDone(l Lease, role string, s *stepRecord, v *wire.StepReport)
if d == nil || built == nil || d.Phase != wire.PreviewDone || role != wire.RolePrimary || l.Protocol < wire.ProtocolPreview || !v.Termination {
return "", false
}
- if d.App != "tmp-"+s.TaskID || d.Digest != built.Digest {
+ // An unconfirmed outcome may come without the digest (a restart that
+ // lost the export's marker): it is still this attempt's outcome.
+ if d.App != "tmp-"+s.TaskID || d.Digest != built.Digest && (d.Outcome != wire.PreviewUnconfirmed || d.Digest != "") {
return "", false
}
out := wire.PreviewResult{Phase: wire.PreviewDone, App: d.App, Digest: built.Digest, Files: built.Files, Bytes: built.Bytes, Outcome: d.Outcome}
@@ -215,3 +217,21 @@ func (t *txn) fencePreviews(l Lease) error {
}
return nil
}
+
+// settlePreview ends a preview attempt that started but cannot run on and
+// gave no outcome (withdrawn, its runner removed): once its export was
+// recorded as built it may have published, so it is done and could not be
+// confirmed; before that nothing was published and it is cancelled.
+// Either way no replacement attempt follows. The caller saves the step.
+func (t *txn) settlePreview(k *taskRecord, s *stepRecord) error {
+ now := t.now()
+ s.Terminated, s.FinishedAt, s.Withdrawn = true, &now, false
+ kind := "preview.failed"
+ if built := decodePreview(s.Preview); built != nil && built.Digest != "" {
+ raw, _ := json.Marshal(wire.PreviewResult{Phase: wire.PreviewDone, App: "tmp-" + s.TaskID, Digest: built.Digest, Files: built.Files, Bytes: built.Bytes, Outcome: wire.PreviewUnconfirmed})
+ s.State, s.Reason, s.Preview, kind = wire.StepDone, "withdrawn", string(raw), "preview.unconfirmed"
+ } else {
+ s.State, s.Reason = wire.StepCancelled, "withdrawn"
+ }
+ return t.auditPreview(s.RunnerID, kind, s, "withdrawn")
+}
diff --git a/internal/equipo/chat/preview_test.go b/internal/equipo/chat/preview_test.go
index 5119438a..12f94d57 100644
--- a/internal/equipo/chat/preview_test.go
+++ b/internal/equipo/chat/preview_test.go
@@ -4,6 +4,7 @@ import (
"testing"
"amadan.net/oficina/equipo/internal/wire"
+ "gorm.io/gorm"
)
// TestProgressSkipsPreviews: a preview step, done or failed, is never the
@@ -21,3 +22,67 @@ func TestProgressSkipsPreviews(t *testing.T) {
t.Fatalf("progress %+v", p.last)
}
}
+
+// previewRig is a task with a preview step that started on RUNNER1, its
+// export recorded as built when built is set.
+func previewRig(t *testing.T, built bool) (*hkRig, taskRecord, stepRecord) {
+ r := newHKRig(t)
+ r.s.authority.RunnerRole = func(*gorm.DB, string) (string, error) { return wire.RolePrimary, nil }
+ k := r.task("tkpv1", "Barber mockups", "owner@example.com")
+ start := r.now
+ s := stepRecord{ID: "s_pv", TaskID: k.ID, Idx: 5, Specialist: wire.SpecialistPreview, Person: "owner@example.com", State: wire.StepRunning, Attempt: 1, CandidateSHA: "2222222222222222222222222222222222222222", RunnerID: "RUNNER1", StartedAt: &start, Revision: 1, CreatedAt: r.now, UpdatedAt: r.now}
+ if built {
+ s.Preview = `{"phase":"built","digest":"` + digestA + `","files":3,"bytes":100}`
+ }
+ r.must(r.tx(func(t *txn) error { return t.db.Create(&s).Error }))
+ return r, k, s
+}
+
+var digestA = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
+
+// TestPreviewNeverReplacedAfterStart: a preview attempt that started is
+// never followed by another: once built it may have published, so it is
+// done and could not be confirmed; before that it is cancelled.
+func TestPreviewNeverReplacedAfterStart(t *testing.T) {
+ for _, built := range []bool{true, false} {
+ r, k, s := previewRig(t, built)
+ r.must(r.tx(func(t *txn) error {
+ if err := t.replace(&k, &s); err != nil {
+ return err
+ }
+ return t.saveStep(&s, &k)
+ }))
+ var got stepRecord
+ r.must(r.tx(func(t *txn) error { return t.db.Where("id = ?", "s_pv").First(&got).Error }))
+ p := decodePreview(got.Preview)
+ switch {
+ case got.Attempt != 1:
+ t.Fatalf("built %v: a replacement attempt %d", built, got.Attempt)
+ case built && (got.State != wire.StepDone || p == nil || p.Outcome != wire.PreviewUnconfirmed || p.Digest != digestA):
+ t.Fatalf("built: %s %+v", got.State, p)
+ case !built && got.State != wire.StepCancelled:
+ t.Fatalf("not built: %s", got.State)
+ }
+ if n := r.count("SELECT count(*) FROM runner_commands WHERE kind = ?", wire.FrameDispatch); n != 0 {
+ t.Fatalf("dispatched %d", n)
+ }
+ }
+}
+
+// TestPreviewWithdrawnKeepsOutcome: a withdrawn preview's done report is
+// kept as it says (here deployed, with its link), and nothing replaces it.
+func TestPreviewWithdrawnKeepsOutcome(t *testing.T) {
+ r, _, s := previewRig(t, true)
+ r.must(r.tx(func(t *txn) error {
+ return t.db.Model(&stepRecord{}).Where("id = ?", s.ID).Update("withdrawn", true).Error
+ }))
+ l := Lease{Runner: RunnerPrincipal{RunnerID: "RUNNER1", Person: "owner@example.com"}, Protocol: wire.ProtocolPreview}
+ rep := &wire.StepReport{TaskID: s.TaskID, StepID: s.ID, Attempt: 1, State: wire.StepDone, CandidateSHA: s.CandidateSHA, Termination: true, Findings: []wire.Finding{},
+ Preview: &wire.PreviewResult{Phase: wire.PreviewDone, App: "tmp-tkpv1", URL: "https://tmp-tkpv1.bds.oncarlos.com/", Digest: digestA, Outcome: wire.PreviewDeployed}}
+ r.must(r.tx(func(t *txn) error { return t.stepReport(l, rep) }))
+ var got stepRecord
+ r.must(r.tx(func(t *txn) error { return t.db.Where("id = ?", s.ID).First(&got).Error }))
+ if p := decodePreview(got.Preview); got.Attempt != 1 || got.State != wire.StepDone || got.Withdrawn || p == nil || p.Outcome != wire.PreviewDeployed || p.URL == "" {
+ t.Fatalf("withdrawn report %s attempt %d %+v", got.State, got.Attempt, p)
+ }
+}
diff --git a/internal/equipo/chat/runners.go b/internal/equipo/chat/runners.go
index 1b9846fd..3e97e7ca 100644
--- a/internal/equipo/chat/runners.go
+++ b/internal/equipo/chat/runners.go
@@ -64,6 +64,13 @@ func (t *txn) withdrawnEnded(k *taskRecord, s *stepRecord) error {
}
func (t *txn) withdrawnSettle(k *taskRecord, s *stepRecord) error {
+ if s.Specialist == wire.SpecialistPreview {
+ // Its proof arrived without an outcome: never replaced.
+ if err := t.settlePreview(k, s); err != nil {
+ return err
+ }
+ return t.saveStep(s, k)
+ }
if k.CancelRequested || wire.FinalStage(k.Stage) {
// Cancelled meanwhile: the proof finishes the cancellation and
// nothing is placed.
@@ -523,6 +530,11 @@ func (t *txn) replace(k *taskRecord, s *stepRecord) error {
if err := t.voidAttempt(*s); err != nil {
return err
}
+ if s.Specialist == wire.SpecialistPreview && s.StartedAt != nil {
+ // A preview attempt that started may have published: no
+ // replacement ever runs after it (settlePreview).
+ return t.settlePreview(k, s)
+ }
s.Attempt++
s.State, s.Reason, s.Terminated, s.StartedAt, s.FinishedAt, s.Withdrawn, s.TerminationKind = wire.StepQueued, "", false, nil, nil, false, ""
s.Summary, s.LogTail, s.Checks, s.Gate, s.ExitCode, s.Output = "", "", "", "", nil, ""
diff --git a/internal/equipo/chat/tasks.go b/internal/equipo/chat/tasks.go
index cf18852d..8deaf7ae 100644
--- a/internal/equipo/chat/tasks.go
+++ b/internal/equipo/chat/tasks.go
@@ -973,6 +973,22 @@ func (t *txn) stepReport(l Lease, v *wire.StepReport) error {
if v.TerminationKind != "" && s.TerminationKind == "" && (v.TerminationKind == wire.TerminationNamespace || v.TerminationKind == wire.TerminationProcessGroup) {
s.TerminationKind = v.TerminationKind
}
+ if s.Withdrawn && s.Specialist == wire.SpecialistPreview && v.State == wire.StepDone && v.Termination && !advanced {
+ // A withdrawn preview may still have published before it stopped:
+ // its outcome is kept (deployed, or could not be confirmed), and no
+ // other attempt follows it.
+ if done, ok := acceptPreviewDone(l, role, &s, v); ok && v.CandidateSHA == s.CandidateSHA {
+ now := t.now()
+ s.Preview, s.Reason, s.State, s.Terminated, s.FinishedAt, s.Withdrawn = done, v.Reason, wire.StepDone, true, &now, false
+ if err := t.auditPreview(l.Runner.RunnerID, "preview."+decodePreview(done).Outcome, &s, "withdrawn"); err != nil {
+ return err
+ }
+ if err := t.saveStep(&s, &k); err != nil {
+ return err
+ }
+ return t.removalProgress(l.Runner.RunnerID)
+ }
+ }
if s.Withdrawn {
// A withdrawn attempt's results never count, whatever arrives first;
// only its termination proof does, and it places the next attempt.
diff --git a/internal/runner/checks/sandbox.go b/internal/runner/checks/sandbox.go
index 5607e1ce..bef6ad96 100644
--- a/internal/runner/checks/sandbox.go
+++ b/internal/runner/checks/sandbox.go
@@ -40,7 +40,7 @@ type CodexSandbox struct {
}
func NewCodexSandbox(ctx context.Context, cfg SandboxConfig) (*CodexSandbox, error) {
- paths := append([]string{cfg.Protected.RunnerState, cfg.Protected.RunnerConfig, cfg.Protected.Journal, cfg.Protected.Bearer, cfg.Protected.Cleanup, cfg.Protected.ForgeCredential, cfg.Protected.LegacyHome, cfg.Protected.SSH}, cfg.Protected.ProviderHomes...)
+ paths := append(cfg.Protected.Credentials(), cfg.Protected.ProviderHomes...)
if len(cfg.Protected.ProviderHomes) == 0 {
return nil, provider.ErrPolicy
}
diff --git a/internal/runner/connections.go b/internal/runner/connections.go
index 9fbfc1c3..d780ae77 100644
--- a/internal/runner/connections.go
+++ b/internal/runner/connections.go
@@ -27,11 +27,11 @@ func (c Config) securityPaths(bs []AccountBinding) workspace.SecurityPaths {
homes = append(homes, b.CredentialHome)
}
}
- return workspace.SecurityPaths{RunnerState: c.StateDir, RunnerConfig: c.AccountBindingsPath, Journal: filepath.Join(c.StateDir, "journal.db"), Bearer: filepath.Join(c.StateDir, "credentials.json"), Cleanup: filepath.Join(c.StateDir, "credentials.json"), ForgeCredential: c.AmadanCredentialPath, LegacyHome: filepath.Join(home, ".paseo"), SSH: filepath.Join(home, ".ssh"), ProviderHomes: homes}
+ return workspace.SecurityPaths{RunnerState: c.StateDir, RunnerConfig: c.AccountBindingsPath, Journal: filepath.Join(c.StateDir, "journal.db"), Bearer: filepath.Join(c.StateDir, "credentials.json"), Cleanup: filepath.Join(c.StateDir, "credentials.json"), ForgeCredential: c.AmadanCredentialPath, LegacyHome: filepath.Join(home, ".paseo"), SSH: filepath.Join(home, ".ssh"), ProviderHomes: homes, PreviewCredential: c.PreviewCredentialPath}
}
func bindingPolicy(c Config, bs []AccountBinding, b AccountBinding) (provider.ReadPolicy, error) {
s := c.securityPaths(bs)
- paths := append([]string{s.RunnerState, s.RunnerConfig, s.Journal, s.Bearer, s.Cleanup, s.ForgeCredential, s.LegacyHome, s.SSH}, s.ProviderHomes...)
+ paths := append(s.Credentials(), s.ProviderHomes...)
paths = append(paths, filepath.Join(c.StateDir, "private"))
var denied []string
for _, p := range paths {
diff --git a/internal/runner/connections_preview_test.go b/internal/runner/connections_preview_test.go
new file mode 100644
index 00000000..8cce81f1
--- /dev/null
+++ b/internal/runner/connections_preview_test.go
@@ -0,0 +1,22 @@
+package runner
+
+import (
+ "slices"
+ "testing"
+)
+
+// TestPreviewCredentialProtected: the preview credential is one of the
+// protected paths when it is set (never mounted into, or read from, a
+// sandbox), and adds nothing when previews are off.
+func TestPreviewCredentialProtected(t *testing.T) {
+ c := Config{StateDir: "/state", AccountBindingsPath: "/state/bindings.json", AmadanCredentialPath: "/state/amadan.json", PreviewCredentialPath: "/state/preview.json"}
+ if !slices.Contains(c.securityPaths(nil).Credentials(), "/state/preview.json") {
+ t.Fatal("the preview credential is not protected")
+ }
+ c.PreviewCredentialPath = ""
+ for _, p := range c.securityPaths(nil).Credentials() {
+ if p == "" {
+ t.Fatal("an empty protected path")
+ }
+ }
+}
diff --git a/internal/runner/thin/preview.go b/internal/runner/thin/preview.go
index 6a4bbdc0..c304955c 100644
--- a/internal/runner/thin/preview.go
+++ b/internal/runner/thin/preview.go
@@ -22,8 +22,10 @@ import (
"strings"
"time"
+ "amadan.net/oficina/equipo/internal/runner"
"amadan.net/oficina/equipo/internal/runner/workspace"
"amadan.net/oficina/equipo/internal/wire"
+ "golang.org/x/sys/unix"
)
// PreviewOptions is what a preview step publishes with: the carlos binary
@@ -44,46 +46,88 @@ type PreviewOptions struct {
URL func(app string) string `json:"-"`
}
-// previewOptions loads the preview credential when one is configured; a
-// file that is refused leaves previews off, said once in the log.
-func previewOptions(file string, logger *slog.Logger) *PreviewOptions {
- if file == "" {
+// previewOptions loads the preview credential when one is configured,
+// and only from a place no sandbox mounts. A file that is refused leaves
+// previews off, said once in the log without its content.
+func previewOptions(c runner.Config, logger *slog.Logger) *PreviewOptions {
+ if c.PreviewCredentialPath == "" {
return nil
}
- o, err := LoadPreviewOptions(file)
+ o, err := LoadPreviewOptions(c.PreviewCredentialPath)
+ if err == nil {
+ err = previewCredentialPlace(c)
+ }
if err != nil {
if logger != nil {
- logger.Warn("previews are off: the preview credential file was refused", "err", err)
+ logger.Warn("previews are off: the preview credential file was refused", "reason", err.Error())
}
return nil
}
return o
}
+// Errors of the preview credential, fixed words only: never the file's
+// content, a key it holds or the decoder's message.
+var (
+ errPreviewCredentialFile = errors.New("preview credential must be a regular file, not a link, mode 0600, owned by this user")
+ errPreviewCredentialShape = errors.New("preview credential file is not the expected JSON")
+ errPreviewCredentialPlace = errors.New("preview credential file is inside a directory sandboxes mount")
+)
+
+// previewCredentialPlace refuses a credential file that sits inside any
+// directory a step's sandbox mounts or works in.
+func previewCredentialPlace(c runner.Config) error {
+ file, err := filepath.EvalSymlinks(c.PreviewCredentialPath)
+ if err != nil {
+ return errPreviewCredentialFile
+ }
+ for _, root := range []string{c.WorkspaceRoot, c.ScratchRoot, filepath.Join(c.StateDir, "steps"), c.GoRoot, c.ModuleCache, homeModuleCache()} {
+ if root == "" {
+ continue
+ }
+ real, err := filepath.EvalSymlinks(root)
+ if err != nil {
+ real = filepath.Clean(root)
+ }
+ if rel, err := filepath.Rel(real, file); err == nil && rel != ".." && !strings.HasPrefix(rel, "../") {
+ return errPreviewCredentialPlace
+ }
+ }
+ return nil
+}
+
var previewDomain = regexp.MustCompile(`^[a-z0-9-]+(\.[a-z0-9-]+)+$`)
-// LoadPreviewOptions reads the preview credential file: owner-only, every
-// field present, the carlos binary an absolute path.
+// LoadPreviewOptions reads the preview credential file: a regular file,
+// not a link (refused before and while opening), mode exactly 0600, owned
+// by this user, at most 8 KiB, every field present, the carlos binary an
+// absolute path. Its errors never carry its content.
func LoadPreviewOptions(file string) (*PreviewOptions, error) {
- info, err := os.Stat(file)
+ if info, err := os.Lstat(file); err != nil || !info.Mode().IsRegular() {
+ return nil, errPreviewCredentialFile
+ }
+ fd, err := unix.Open(file, unix.O_RDONLY|unix.O_NOFOLLOW|unix.O_CLOEXEC, 0)
if err != nil {
- return nil, err
+ return nil, errPreviewCredentialFile
}
- if info.Mode().Perm()&0o077 != 0 {
- return nil, errors.New("preview credential file must be 0600")
+ f := os.NewFile(uintptr(fd), file)
+ defer f.Close()
+ var st unix.Stat_t
+ if unix.Fstat(fd, &st) != nil || st.Mode&unix.S_IFMT != unix.S_IFREG || st.Mode&0o7777 != 0o600 || int(st.Uid) != os.Getuid() {
+ return nil, errPreviewCredentialFile
}
- raw, err := os.ReadFile(file)
- if err != nil {
- return nil, err
+ raw, err := io.ReadAll(io.LimitReader(f, 8<<10+1))
+ if err != nil || len(raw) > 8<<10 {
+ return nil, errPreviewCredentialShape
}
var o PreviewOptions
d := json.NewDecoder(bytes.NewReader(raw))
d.DisallowUnknownFields()
- if err := d.Decode(&o); err != nil {
- return nil, err
+ if d.Decode(&o) != nil || d.More() {
+ return nil, errPreviewCredentialShape
}
if !filepath.IsAbs(o.Carlos) || o.Token == "" || strings.ContainsAny(o.Token, "\r\n") || !strings.HasPrefix(o.Console, "https://") || o.Account == "" || !previewDomain.MatchString(o.Domain) {
- return nil, errors.New("preview credential file is incomplete")
+ return nil, errPreviewCredentialShape
}
return &o, nil
}
@@ -330,10 +374,19 @@ const (
appTrashed = "trashed"
)
+// ansi is a terminal colour sequence carlos may print around a line.
+var ansi = regexp.MustCompile(`\x1b\[[0-9;]*m`)
+
func appState(list, app string) (string, bool) {
+ list = ansi.ReplaceAllString(list, "")
sc := bufio.NewScanner(strings.NewReader(list))
header := false
for sc.Scan() {
+ if strings.TrimSpace(sc.Text()) == "no apps in this account" {
+ // An account with no apps at all: listed, and empty.
+ header = true
+ continue
+ }
f := strings.Fields(sc.Text())
if len(f) >= 2 && f[0] == "APP" && f[1] == "STATE" {
header = true
@@ -407,7 +460,9 @@ func (e *Engineer) preview(ctx context.Context, r stepRow, progress func(wire.St
if err != nil || json.Unmarshal(raw, &mark) != nil {
return e.previewDone(rep, r, previewExport{}, nil, false)
}
- return e.previewDone(rep, r, previewExport{Digest: mark.Digest}, nil, e.previewServed(ctx, r, mark))
+ // Even when the step was cancelled meanwhile: the marker says what
+ // is served, within its own bounded window.
+ return e.previewDone(rep, r, previewExport{Digest: mark.Digest}, nil, e.previewServed(context.WithoutCancel(ctx), r, mark))
}
tree, reason, err := e.judgeTree(ctx, r)
if err != nil {
diff --git a/internal/runner/thin/preview_test.go b/internal/runner/thin/preview_test.go
index bb899df8..dd975a15 100644
--- a/internal/runner/thin/preview_test.go
+++ b/internal/runner/thin/preview_test.go
@@ -12,6 +12,7 @@ import (
"testing"
"time"
+ "amadan.net/oficina/equipo/internal/runner"
"amadan.net/oficina/equipo/internal/wire"
)
@@ -427,3 +428,91 @@ func TestHasPreviewAndOptions(t *testing.T) {
}
}
}
+
+// TestPreviewCredentialRefusals: a link, any mode but 0600, a file inside
+// a directory sandboxes mount, or content that is not the expected JSON
+// is refused, and the error never carries the content.
+func TestPreviewCredentialRefusals(t *testing.T) {
+ dir := t.TempDir()
+ good := `{"carlos":"/usr/local/bin/carlos","token":"t0ken","console":"https://console.example","account":"previews","domain":"bds.oncarlos.com"}`
+ file := filepath.Join(dir, "cred.json")
+ os.WriteFile(file, []byte(good), 0o600)
+ if _, err := LoadPreviewOptions(file); err != nil {
+ t.Fatal(err)
+ }
+ link := filepath.Join(dir, "link.json")
+ os.Symlink(file, link)
+ if _, err := LoadPreviewOptions(link); err == nil {
+ t.Fatal("a link was followed")
+ }
+ for _, mode := range []os.FileMode{0o400, 0o640, 0o644, 0o700, os.ModeSetuid | 0o600} {
+ os.Chmod(file, mode)
+ if _, err := LoadPreviewOptions(file); err == nil {
+ t.Fatalf("mode %o taken", mode)
+ }
+ }
+ os.Chmod(file, 0o600)
+ os.WriteFile(file, []byte(`{"token":"s3cret-value","stray_key_with_secret":"s3cret-value"}`), 0o600)
+ _, err := LoadPreviewOptions(file)
+ if err == nil || strings.Contains(err.Error(), "s3cret") || strings.Contains(err.Error(), "stray_key") {
+ t.Fatalf("decoder error leaked: %v", err)
+ }
+ os.WriteFile(file, []byte(good), 0o600)
+ work := filepath.Join(dir, "work")
+ os.MkdirAll(work, 0o700)
+ inside := filepath.Join(work, "cred.json")
+ os.WriteFile(inside, []byte(good), 0o600)
+ cfg := runner.Config{PreviewCredentialPath: inside, WorkspaceRoot: work, ScratchRoot: filepath.Join(dir, "scratch"), StateDir: filepath.Join(dir, "state")}
+ if previewOptions(cfg, nil) != nil {
+ t.Fatal("a credential inside the workspace root was taken")
+ }
+ cfg.PreviewCredentialPath = file
+ if previewOptions(cfg, nil) == nil {
+ t.Fatal("a credential outside every mounted root was refused")
+ }
+}
+
+// TestPreviewEmptyAccount: a previews account with no apps at all is a
+// listing (carlos says "no apps in this account", with no header), so the
+// first preview is created.
+func TestPreviewEmptyAccount(t *testing.T) {
+ for _, list := range []string{"no apps in this account\n", "using https://console.example as a service credential (CARLOS_SERVICE_TOKEN)\n\x1b[2mno apps in this account\x1b[0m\n"} {
+ e, fc, _, r := previewRig(t, mockups, nil)
+ fc.list = list
+ rep := e.Exec(context.Background(), r, func(wire.StepReport) {})
+ if rep.Preview == nil || rep.Preview.Outcome != wire.PreviewDeployed || fc.verbs() != "apps list, deploy, ship, channels, promote" {
+ t.Fatalf("%q: %+v %s", list, rep, fc.verbs())
+ }
+ }
+}
+
+// TestPreviewCancelledAfterRestart: a preview cancelled while it may have
+// published still reconciles after a restart: never a plain cancel, never
+// a command.
+func TestPreviewCancelledAfterRestart(t *testing.T) {
+ e, fc, _, r := previewRig(t, mockups, nil)
+ fc.fail["ship"] = "lost"
+ e.Exec(context.Background(), r, func(wire.StepReport) {})
+ ctx := context.Background()
+ if err := e.O.State.RequestStepCancel(ctx, "cancel-1", wire.CancelStepCommand{Person: r.Person, TaskID: r.TaskID, StepID: r.StepID, Attempt: r.Attempt}); err != nil {
+ t.Fatal(err)
+ }
+ if err := e.O.State.RecoverSteps(ctx, nil); err != nil {
+ t.Fatal(err)
+ }
+ if reps := outbox(t, e.O.State); len(reps) != 0 {
+ t.Fatalf("recovery reported %+v", reps)
+ }
+ held, ok, err := e.O.State.nextStep(ctx)
+ if err != nil || !ok || held.Phase != phasePreviewPublishing || !held.Cancel {
+ t.Fatalf("held %+v %v %v", held, ok, err)
+ }
+ before := len(fc.calls)
+ cctx, cancel := context.WithCancel(ctx)
+ cancel()
+ fc.served = filepath.Join(e.root(), stepKey(r), "preview")
+ rep := e.Exec(cctx, held, func(wire.StepReport) {})
+ if rep.State != wire.StepDone || rep.Preview == nil || rep.Preview.Outcome != wire.PreviewDeployed || len(fc.calls) != before {
+ t.Fatalf("reconciled %s %+v, %d commands", rep.State, rep.Preview, len(fc.calls)-before)
+ }
+}
diff --git a/internal/runner/thin/run.go b/internal/runner/thin/run.go
index f05d5627..ae182da6 100644
--- a/internal/runner/thin/run.go
+++ b/internal/runner/thin/run.go
@@ -282,7 +282,7 @@ func Run(ctx context.Context, c runner.Config, o Options) error {
if err = engine.Start(ctx); err != nil {
return err
}
- engineer := &Engineer{O: o.Claude, Codex: o.Codex, Clones: clones, Forge: fg, CI: hostedCIOf(fg), Authorize: link.Confirm, AuthorizeStep: link.ConfirmStep, ConfirmMerge: link.ConfirmMerge, ConfirmPreview: link.ConfirmPreview, Preview: previewOptions(c.PreviewCredentialPath, o.Logger), ConfirmPublication: link.ConfirmPublication, Owners: withPerson(coordinatorPersons(c)(), creds.Bearer.Person), MaxStep: o.MaxStep, Note: o.StepNote, Healthy: conns.Usable, Conns: conns, Delta: link.Delta, Activity: link.Activity, StepActivity: link.StepActivity, Retention: o.KeptRetention, Host: c.MachineLabel}
+ engineer := &Engineer{O: o.Claude, Codex: o.Codex, Clones: clones, Forge: fg, CI: hostedCIOf(fg), Authorize: link.Confirm, AuthorizeStep: link.ConfirmStep, ConfirmMerge: link.ConfirmMerge, ConfirmPreview: link.ConfirmPreview, Preview: previewOptions(c, o.Logger), ConfirmPublication: link.ConfirmPublication, Owners: withPerson(coordinatorPersons(c)(), creds.Bearer.Person), MaxStep: o.MaxStep, Note: o.StepNote, Healthy: conns.Usable, Conns: conns, Delta: link.Delta, Activity: link.Activity, StepActivity: link.StepActivity, Retention: o.KeptRetention, Host: c.MachineLabel}
link.Forget = engineer.RemoveKept
merges := &MergeWatch{State: state, Clones: clones, Git: c.GitPath, Notify: link.Notify, Logger: o.Logger, Every: o.MergeEvery}
if merges.Every <= 0 {
diff --git a/internal/runner/thin/step.go b/internal/runner/thin/step.go
index 35c5bfbc..d9c21230 100644
--- a/internal/runner/thin/step.go
+++ b/internal/runner/thin/step.go
@@ -384,9 +384,10 @@ func (s *State) RecoverSteps(ctx context.Context, verify func(context.Context, s
// A merge settles itself from its record and the default
// branch: it runs again and never merges twice.
continue
- case r.Specialist == wire.SpecialistPreview && r.Phase == phasePreviewPublishing && !r.Cancel:
+ case r.Specialist == wire.SpecialistPreview && r.Phase == phasePreviewPublishing:
// A preview that may have changed Carloku reconciles from the
- // marker; it never sends again.
+ // marker, cancelled or not; it never sends again, and its
+ // outcome is never lost to a plain "cancelled".
continue
case r.Specialist == wire.SpecialistChecks && r.Phase == phaseHosted && !r.Cancel:
// Checks waiting for hosted CI ran nothing here: they read
diff --git a/internal/runner/workspace/workspace.go b/internal/runner/workspace/workspace.go
index 72d7b59b..d1423fc2 100644
--- a/internal/runner/workspace/workspace.go
+++ b/internal/runner/workspace/workspace.go
@@ -37,10 +37,23 @@ type ForgeRead interface {
type SecurityPaths struct {
RunnerState, RunnerConfig, Journal, Bearer, Cleanup, ForgeCredential, LegacyHome, SSH string
ProviderHomes []string
+ // PreviewCredential is the preview credential file, "" when previews
+ // are off.
+ PreviewCredential string
}
func (p SecurityPaths) all() []string {
- return append([]string{p.RunnerState, p.RunnerConfig, p.Journal, p.Bearer, p.Cleanup, p.ForgeCredential, p.LegacyHome, p.SSH}, p.ProviderHomes...)
+ return append(p.Credentials(), p.ProviderHomes...)
+}
+
+// Credentials are the protected single paths: never mounted into, or
+// read from, a sandbox. The preview credential only when set.
+func (p SecurityPaths) Credentials() []string {
+ out := []string{p.RunnerState, p.RunnerConfig, p.Journal, p.Bearer, p.Cleanup, p.ForgeCredential, p.LegacyHome, p.SSH}
+ if p.PreviewCredential != "" {
+ out = append(out, p.PreviewCredential)
+ }
+ return out
}
type Config struct {