oficina / equipo Public

CI fixes: harness name, ask scenario on a merge card, held review

The merge's agent harness is "equipo" (the dead-reference inventory
refuses the runner's old executable name in new code). 4b_ask asks while
its task waits on a merge card (an iOS change), since a task Equipo
merges ends and its kept sessions go. 3_engineering holds review so the
branch is read before the merge. The fake's "sleep:" no longer matches
inside "reviewsleep:". The removed work.merge row leaves the inventory.
SLICE4C-PROGRESS.md: the slice, the permission finding, the witness.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 2d1edaf08eedce9c1add0d6de584cdd7debddff0 parent d521a44
7 files changed, +252 −9
  • docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md +0 −1
  • docs/superpowers/plans/SLICE4C-PROGRESS.md +239 −1
  • internal/fakeclaude/fake.go +1 −1
  • internal/headless/ask_test.go +6 −2
  • internal/headless/engineering_test.go +3 −1
  • internal/runner/forge/merge_test.go +2 −2
  • internal/runner/thin/mergestep.go +1 −1

CI passed — run details

diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
index d43eb926..3c00602a 100644
--- a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
+++ b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
@@ -4831,7 +4831,6 @@ records remain unchanged.
| `work.review.other_family` | another model family | Thin v1 slice 4 review and checks (task card, task and Tasks pages, sidebar) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| `work.review.same_family` | same family | Thin v1 slice 4 review and checks (task card, task and Tasks pages, sidebar) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| `work.review.same_account` | same family, same account | Thin v1 slice 4 review and checks (task card, task and Tasks pages, sidebar) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
-| `work.merge` | (removed in slice 4c: Equipo merges; no button) | Thin v1 slice 4 review and checks | Removed |
| `work.needs.fix_rounds` | Needs you: still not approved after two fix rounds | Thin v1 slice 4 review and checks (task card, task and Tasks pages, sidebar) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| `work.needs.branch_moved` | Needs you: the branch moved on Amadan after it was checked | Thin v1 slice 4 review round 1 (task card and pages) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| `work.needs.review_blocked` | Needs you: the review ended without a verdict | Thin v1 slice 4 review and checks (task card, task and Tasks pages, sidebar) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
diff --git a/docs/superpowers/plans/SLICE4C-PROGRESS.md b/docs/superpowers/plans/SLICE4C-PROGRESS.md
index 3b6d8968..89487073 100644
--- a/docs/superpowers/plans/SLICE4C-PROGRESS.md
+++ b/docs/superpowers/plans/SLICE4C-PROGRESS.md
@@ -40,4 +40,242 @@ once it has earned Ready to merge. Conventions and scripts as in
## Done
-(filled in below as the slice lands)
+1. Contracts (`internal/wire/tasks.go`, fixtures): stage `merging`
+ (between `ready_to_merge` and `done`); specialist `merge`; strategies
+ `merge` and `squash`; Needs you `merge_conflict`; `MaxRebaseRounds` 1;
+ card kind `merge` with choices `merge` and `wait`; `Step` gained
+ `rebase`, `merge_sha`, `into`, `strategy`, `without_checks`; `Task`
+ gained `merged {sha, into, strategy, without_checks, at}` (null until
+ Equipo merged it; a person's merge leaves it null) and `reports`;
+ `DispatchCommand` gained `rebase`, `from_base`; `StepReport` gained
+ `merge_sha`, `into`, `strategy`; step reasons `merge_conflict`,
+ `branch_moved`, `amadan_ci_pending`, `amadan_ci_failed`,
+ `merge_forbidden`, `merge_failed`; tool `add_report`; `ValidBranchName`.
+ New fixtures `api/task-merged.json`, `api/card-merge.json`; task,
+ step, dispatch and needs-you fixtures gained the fields. Events go to
+ active members as before; the merge card and the merged line only to
+ the creator's conversation.
+
+2. Forge (`internal/runner/forge/merge.go`), the only holder of the
+ Amadan credential: `HubMerge` (the request above, the agent's bearer,
+ a 200 with a commit is the only success, an unreadable or 5xx answer
+ is uncertain) and `MergeBranch`, record-then-reconcile like the push:
+ validate (repository, task branch never the default, a full SHA, the
+ person among the runner's owners); read the remote first (already on
+ the default branch: done, never asked again; the head not at the
+ judged SHA: `moved`, no request); record `requested`; confirm the
+ lease right before the request; a lost answer, `up_to_date`, `moved`
+ or `no_such_branch` is settled from the default branch; refusals map
+ to conflict, CI pending, CI failed, forbidden, failed. One record per
+ task and SHA, so a new attempt reconciles from it. Tests:
+ `TestMergeBranch`, `TestMergeBranchReconcilesALostAnswer`,
+ `TestMergeBranchRecoversACrash` (crashed after recording, landed or
+ not), `TestMergeBranchNeverMergesAMovedBranch`,
+ `TestMergeBranchRefusals`, `TestMergeBranchRefusesInvalid`,
+ `TestHubMerge` (path, bearer, body, answers).
+
+3. Runner (`internal/runner/thin/mergestep.go`): the merge step runs in
+ the one step queue (never beside a write step): lease, then
+ `MergeBranch` with the remote read through one `ls-remote` (fetching
+ only when the tip is new) and the merge commit found on the default
+ branch's first-parent line. Uncertain: three tries with backoff. The
+ hub's CI still running: waited for (poll 15 s, up to 10 minutes). On
+ success the merge watch for that SHA ends without a report, so only
+ the step's report says it landed. A runner that dies mid-merge holds
+ the attempt and runs it again (the record settles it), never fails it
+ `runner_restarted`. Rebase round (`engineer.go`, `workspace.Rebase`):
+ the default branch's tip checked out, then the three-way merge of the
+ tip and the old candidate on the task's old base (`merge-tree
+ --merge-base`) replaces the tree, conflicted files carrying markers
+ and named in the prompt; Engineering resolves them; the runner commits
+ on the tip and pushes over its own earlier candidate. The merge's
+ agent block is `{session: equipo-<task>, harness: equipo, host:
+ <machine label>}`. Tests: `TestMergeStep`,
+ `TestMergeStepReconcilesALostAnswer`, `TestMergeStepRefusals`,
+ `TestRecoverStepsRerunsAMerge`, `TestTaskTreeRebase`;
+ `forgetest.Merge` is a hub-like local merge shared by the runner tests
+ and the headless forge.
+
+4. Instance (`internal/equipo/chat/merge.go`, migration 0046): the
+ policy runs in `advance`, deterministic, never a model's call. Checks
+ passed and an approving verdict on the newest candidate with the
+ branch at it: Ready to merge (its own event), then a merge step for
+ exactly that SHA (stage Merging). Done only on the runner's report of
+ a confirmed merge of the dispatched SHA (merge commit, a plain branch
+ name, a known strategy, termination); the task records it and the
+ coordinator's line goes into the creator's conversation once
+ ("Merged [title](/tasks/id) into <project>.", or "... without
+ checks."). Checks `cannot_run` or `none`: no merge; one `merge` card
+ per SHA in the creator's conversation; only the creator answers
+ (another person's answer is 404, a stale revision 409); Merge
+ dispatches the merge labelled without checks, Wait leaves the task at
+ Ready to merge (a person may still merge on Amadan; slice 4's watch
+ makes it Done). A new candidate or the task's end resolves an open
+ card. A refused merge: `merge_conflict` sends Engineering one rebase
+ round (the new candidate invalidates checks and review and is judged
+ from the new base); a second conflict is Needs you `merge_conflict`;
+ any other refusal (branch moved, Amadan CI, forbidden) leaves Ready to
+ merge with the reason and Retry, which is refused unless the SHA is
+ still the judged one as it stands. No automatic re-merge after the
+ branch moves and comes back (Retry does it). Cancel is not offered
+ while merging. Tests: `TestContractAutoMerge`,
+ `TestContractMergeWithoutChecks`, `TestContractMergeConflictRebase`,
+ `TestContractMergeRefusedAndRetry`, `TestContractDuplicateReports`;
+ `TestContractReviewAndChecks`, `TestContractBranchMovedInvalidatesReadiness`
+ and the pages tests now end in Equipo's merge (a person's merge while
+ Merging still makes it Done).
+
+5. Duplicates: `record_task` first looks for open tasks in the same
+ project that read like the report (significant words of title and
+ brief: title overlap at least 0.6 with two shared words, or title and
+ brief overlap at least 0.5 with three) and returns up to three as
+ `similar` without recording; `separate: true` records anyway.
+ `add_report(task, text)` puts the report on an open team task's thread
+ (`reports` counts them) and shows the task card in this turn. House
+ rule 2026-11-07.9: Equipo merges once checks and review pass (the
+ person is never asked to merge); never file the same problem twice.
+ The launcher's own allowlist of conversation tools gained
+ `add_report` (`TestConversePolicyCoversEveryTool`: it lagged once and
+ every coordinator start failed `policy_rejected`).
+ `TestOpeningReusesOpenTasks`.
+
+6. UI (kept minimal, Fable is redesigning the inner screens): stage
+ "Merging…"; done shows "Merged into main at abc1234" (", without
+ checks") with the quiet "Open on Amadan" link to the repository (the
+ branch link goes, the branch is deleted); "Open on Amadan to merge"
+ and its copy are removed; the merge card (Merge, Wait for checks; then
+ "Merging without checks." or "Waiting for checks.") stands in the
+ conversation at its own time; Stopped lines for the merge reasons;
+ the step list names Merge and "(rebase)".
+
+7. Headless (fake CLI in real bwrap, local forge with `forgetest.Merge`):
+ `4_review` now ends merged by Equipo (merge commit on main, second
+ parent the candidate, branch gone, the line in chat);
+ `4c_checks_card` (an iOS change: card; the branch moves and back;
+ Wait, then the person merges on the forge; the next task Merge, merged
+ without checks); `4c_rebase` (main changes the same line during
+ review: conflict, one rebase round on the new tip, judged again,
+ merged); `4c_duplicate`; `4b_ask` now asks while its task waits on a
+ merge card (an iOS change), since a merged task forgets its sessions.
+ `4c_witness` is staging only (`EQUIPO_STAGING_MERGE_WITNESS`).
+
+8. Mutation checks (ten, each observed failing a test unless noted):
+ auto-merge of unchecked work, a merge report for another SHA, Retry
+ of a merge while the branch is away, unlimited rebase rounds, no
+ duplicate check, forge without the landed check first, forge merging
+ a moved head, the merge watch kept after a merge, a crash failing the
+ merge. Survived, as defence in depth: the merge card's stale-SHA check
+ (the Ready to merge stage check refuses first, and a new candidate
+ resolves the card).
+
+9. Merged `thin-v1-slice4b` round-1 fixes at 56a623b (ask output bounds,
+ ask termination proof, ReportAnswer retry, git_show range): clean.
+
+## Decisions
+
+- The merge is a step (specialist `merge`) in the runner's one queue: it
+ reuses dispatch, durable reports, sync, attempts and Retry, and never
+ runs beside a write step. Nothing runs in a namespace, so its reports
+ always carry termination.
+- Strategy: the hub's default merge commit, recorded on the task and the
+ step. The branch is deleted by the hub (its page stays).
+- "Checks passed" means `passed`. `none` (no gate found) is treated like
+ `cannot_run`: the person is asked with the card.
+- Wait is final for that SHA's card: the task stays at Ready to merge
+ (checks pending); the person may still merge on Amadan.
+- After the branch moves away and back, Equipo does not merge again on
+ its own: Retry does, after re-checking the SHA (avoids a merge loop
+ while the watch and the merge race to report the head).
+- The coordinator's merged line is written by the instance (no model
+ turn), in the creator's conversation only, once per task.
+- A person's report of the same problem goes on the open task's thread
+ as a `report` entry (any team member may add one to an open task); an
+ ended task is never offered as similar.
+
+## Staging
+
+Release d521a44 (built by `scripts/staging-thin.py build`, deployed with
+`--swap hold` at 22:54:42, serving 22:55:48, both runner units installed
+by 22:55:49, about a minute of change-over).
+
+- Unapproved merges on the upgrade: the suite person's two earlier
+ witness tasks were at Ready to merge with checks passed and approval
+ (`tk2jhc6z46ar` from slice 4, `tkgzy4ioeoh7` from slice 4b). The new
+ policy merged both on the suite runner's first sync, 22:55:49 and
+ 22:55:50, into oficina/suite main (c758267, then cebae9f; README only:
+ the line break and the em dash fix, each judged on its SHA). Only the
+ witness task was approved for merging. Not reverted: reverting means a
+ push to suite's main, which needs Paul's or the controller's word.
+ Woodstar is untouched (its main moved only by Paul's own commits): its
+ three tasks' checks cannot run, so they wait at Ready to merge with a
+ merge card (Paul's `tkf6dufnbzcg` in his conversation, the suite's
+ `tklkbx5vid3y` in the suite's), or at Needs you retry (`tks6kwzzdngr`).
+ Production starts from a fresh database, so the cutover has no such
+ backlog; a deploy onto a database with ready tasks merges them.
+- Witness (`4c_witness`, real Claude CLI 2.1.312, suite person, one
+ message): "In the oficina/suite README, the `server/` bullet says "the
+ producer half — the bearer check, the three routes, their wire shapes
+ and cache headers, and the cursor reset — that an app mounts". Please
+ replace those two em dashes with commas so it reads "...". Change
+ nothing else." Task `tkeog27odnoo` "Replace em dashes in README
+ server/ bullet": noted 5.4 s, in progress 12.0 s, Engineering 12.4 s
+ (candidate 37e72437), checks `.amadan/ci.d` passed 9.8 s, review
+ approved (`same_account`) 25.8 s, Ready to merge 60.96 s, Merging
+ 60.97 s, Done 61.62 s (the merge step 0.6 s). Merged into suite's main
+ as 98380bce (a merge commit, second parent 37e72437), branch deleted.
+ The coordinator: "Merged [Replace em dashes in README server/
+ bullet](/tasks/tkeog27odnoo) into Suite." (no SHA, no path).
+- Checks that could not run: the card flow ran headless with the fake
+ CLI (`4c_checks_card`, both Wait and Merge). On staging the card is
+ live on the Woodstar tasks (`c_z5fbtn2e5fbrnppubttv665eae`, "Merge iOS
+ edge swipe to go back doesn't work on panes without checks?", options
+ merge and wait); nobody answered it.
+
+## Live runs (budget: 3 coordinator turns, 2 Engineering steps, 2 Review steps)
+
+Used: 1 coordinator turn, 1 Engineering step, 1 Review step (task
+`tkeog27odnoo`). The two unapproved merges spent no model run (merge
+steps only).
+
+## Open issues
+
+- The two unapproved merges above: the controller decides whether to
+ revert them on oficina/suite.
+- A task Equipo merges is done, so the runner forgets its kept sessions:
+ nobody can ask the implementer about merged work. `4b_ask` now asks
+ while a task waits on its merge card.
+- Amadan's `require_green` is not readable through the API; a merge
+ waiting for Amadan's CI holds the runner's step queue up to 10 minutes
+ before it reports `amadan_ci_pending`.
+- Version skew as before: an old runner refuses a `merge` dispatch;
+ install runners right after the instance.
+- The squash-merge detection of slice 4 still serves people's merges.
+
+## Copy for review
+
+Accepted for now with the existing marker in `copy.go` and listed in the
+plan 3 inventory:
+- `work.stage.merging` "Merging…"
+- `work.merged` "Merged into %s at %s", `work.merged_without_checks`
+ "Merged into %s at %s, without checks"
+- `work.specialist.merge` "Merge", `work.rebase` "rebase"
+- `work.needs.merge_conflict` "Needs you: it still conflicts with the
+ default branch after a rebase"
+- `work.reason.merge_conflict` "it conflicts with the default branch",
+ `.branch_moved` "the branch moved on Amadan", `.amadan_ci_pending`
+ "Amadan's own CI had not finished", `.amadan_ci_failed` "Amadan's own
+ CI did not pass", `.merge_forbidden` "Equipo may not merge in this
+ repository", `.merge_failed` "Amadan did not merge it"
+- `chat.card.merge_question` "Merge %s without checks?",
+ `chat.card.merge` "Merge", `chat.card.wait` "Wait for checks",
+ `chat.card.merge_chose_merge` "Merging without checks.",
+ `chat.card.merge_chose_wait` "Waiting for checks.",
+ `chat.card.merge_resolved` "Nothing to decide any more."
+- `chat.merged` "Merged [%s](%s) into %s.", `chat.merged_without_checks`
+ "Merged [%s](%s) into %s without checks."
+- `chat.activity.add_report` "Adding to the task…"
+- Removed: `work.merge` "Open on Amadan to merge".
+
+## Blockers
+
+None.
diff --git a/internal/fakeclaude/fake.go b/internal/fakeclaude/fake.go
index 0a339c17..32e902ed 100644
--- a/internal/fakeclaude/fake.go
+++ b/internal/fakeclaude/fake.go
@@ -227,7 +227,7 @@ func (f *fake) transcript() string {
return filepath.Join(home(), "projects", "-workspace", f.session+".jsonl")
}
-var sleepWord = regexp.MustCompile(`sleep:([0-9]+)`)
+var sleepWord = regexp.MustCompile(`\bsleep:([0-9]+)`)
// pauseWord waits after any tools and before the first text.
var pauseWord = regexp.MustCompile(`pause:([0-9]+)`)
diff --git a/internal/headless/ask_test.go b/internal/headless/ask_test.go
index 412ba1cf..7bcf1321 100644
--- a/internal/headless/ask_test.go
+++ b/internal/headless/ask_test.go
@@ -43,7 +43,8 @@ func (c askClock) seconds() map[string]float64 {
return map[string]float64{"first_activity_s": c.FirstActivity.Seconds(), "first_text_s": c.FirstText.Seconds(), "answered_s": c.Answered.Seconds()}
}
-// Ask the implementer: once a task is ready to merge, its creator asks
+// Ask the implementer: while a task waits at Ready to merge (its checks
+// could not run here, so Equipo asks before merging), its creator asks
// Engineering and then Review about their work. Each answer comes from
// the step's own resumed session (it knows what that session said), in
// a read-only tree of the step's commit: it reads the change with the
@@ -59,7 +60,10 @@ func scenarioAsk(t *testing.T, env *Env) {
s := open(t, env)
s.keep()
s.wait(t, "runner online", 30*time.Second, func(c *thintest.Conversation) bool { return c.Runner.Online })
- sent := s.send(t, "tool:record_task:oficina/sample|Fix the README typo|The README says teh panes.\ntool:start_task:$task|edit:README.md|teh panes|the panes")
+ // The change touches the iOS app too, so its checks cannot run here
+ // and Equipo asks before merging: the task waits at Ready to merge
+ // while its creator asks (a task Equipo merges ends at once).
+ sent := s.send(t, "tool:record_task:oficina/sample|Fix the README typo|The README says teh panes.\ntool:start_task:$task|edit:ios/App.swift|import SwiftUI|import SwiftUI // reading edit:README.md|teh panes|the panes")
id := s.taskOf(t, sent.Turn.ID)
k := s.settled(t, id, 5*time.Minute)
if k.Stage != wire.StageReadyToMerge {
diff --git a/internal/headless/engineering_test.go b/internal/headless/engineering_test.go
index 268139e9..4fb7dcb8 100644
--- a/internal/headless/engineering_test.go
+++ b/internal/headless/engineering_test.go
@@ -82,7 +82,9 @@ func scenarioEngineering(t *testing.T, env *Env) {
s := open(t, env)
s.keep()
s.wait(t, "runner online", 30*time.Second, func(c *thintest.Conversation) bool { return c.Runner.Online })
- text := "think Fix the README typo in sample.\ntool:record_task:oficina/sample|Fix the README typo|The README says teh panes.\ntool:read_file:oficina/sample|README.md\ntool:add_finding:$task|The README has teh for the.|oficina/sample|README.md|5\ntool:start_task:$task|Fix the typo. edit:README.md|teh panes|the panes"
+ // Review is held (reviewsleep) so the branch and main are read before
+ // Equipo merges the task (slice 4c).
+ text := "think Fix the README typo in sample.\ntool:record_task:oficina/sample|Fix the README typo|The README says teh panes.\ntool:read_file:oficina/sample|README.md\ntool:add_finding:$task|The README has teh for the.|oficina/sample|README.md|5\ntool:start_task:$task|Fix the typo. reviewsleep:20000 edit:README.md|teh panes|the panes"
if env.Live {
text = env.Witness
}
diff --git a/internal/runner/forge/merge_test.go b/internal/runner/forge/merge_test.go
index cc2cd823..ce0c6623 100644
--- a/internal/runner/forge/merge_test.go
+++ b/internal/runner/forge/merge_test.go
@@ -51,7 +51,7 @@ func mergeNow(h *fakeHub, req HubMergeRequest) (HubMergeResult, error) {
func newMerge(t *testing.T, h *fakeHub) BranchMerge {
return BranchMerge{Root: t.TempDir(), Repo: "amadan.net/oficina/sample", Branch: "equipo/tk1-fix-typo", Commit: strings.Repeat("a", 40), Task: "tk1", Message: "Fix typo", Strategy: "merge",
- Agent: AgentMeta{Session: "equipo-tk1", Harness: "equipo-runner", Host: "test"}, Person: "p@example.com", Owners: []string{"p@example.com"},
+ Agent: AgentMeta{Session: "equipo-tk1", Harness: "equipo", Host: "test"}, Person: "p@example.com", Owners: []string{"p@example.com"},
Inspect: h.inspect, Request: h.request, Confirm: func(context.Context) error { return nil }}
}
@@ -221,7 +221,7 @@ func TestHubMerge(t *testing.T) {
}))
defer srv.Close()
cred := Credential{Agent: "equipo~p@example.com", Bearer: "token-1"}
- req := HubMergeRequest{ExpectSHA: strings.Repeat("a", 40), Message: "Fix typo", Strategy: "merge", Agent: AgentMeta{Session: "equipo-tk1", Harness: "equipo-runner", Host: "docs-t1"}}
+ req := HubMergeRequest{ExpectSHA: strings.Repeat("a", 40), Message: "Fix typo", Strategy: "merge", Agent: AgentMeta{Session: "equipo-tk1", Harness: "equipo", Host: "docs-t1"}}
res, err := HubMerge(context.Background(), srv.Client(), srv.URL, cred, "amadan.net/oficina/sample", "equipo/tk1-fix-typo", req)
if err != nil || !res.Merged || res.SHA != strings.Repeat("8", 40) || res.Into != "main" || !res.BranchClosed {
t.Fatalf("%+v %v", res, err)
diff --git a/internal/runner/thin/mergestep.go b/internal/runner/thin/mergestep.go
index 4b03303e..2f2dfcc0 100644
--- a/internal/runner/thin/mergestep.go
+++ b/internal/runner/thin/mergestep.go
@@ -35,7 +35,7 @@ var (
)
// MergeAgentHarness names the runner to the hub in the merge's agent block.
-const MergeAgentHarness = "equipo-runner"
+const MergeAgentHarness = "equipo"
// mergeStep merges r.CandidateSHA into the default branch.
func (e *Engineer) mergeStep(ctx context.Context, r stepRow, progress func(wire.StepReport)) wire.StepReport {