fix: retain Copy flags and update compatibility checks
9 files changed,
+34
−17
.rastrillo/budgets.txt+1 −1internal/copydesk/copy.go+9 −1internal/copydesk/copy_test.go+2 −2internal/equipo/chat/copy_flow.go+2 −2internal/equipo/settings_hub.go+1 −1internal/runner/thin/copy_test.go+6 −2internal/thintest/pages_test.go+3 −3internal/thintest/settings_browser_test.go+3 −3internal/wire/connections_test.go+7 −2
CI passed — run details
diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt| index 15e20f09..d6ae3308 100644 |
| --- a/.rastrillo/budgets.txt |
| +++ b/.rastrillo/budgets.txt |
| @@ -38,7 +38,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; |
| -size internal/runner/thin 24951 16857 Copy validation lives in copydesk; contained execution and publication use the runner’s private state and launch helpers. |
| +size internal/runner/thin 24951 16861 Copy validation lives in copydesk; contained execution and publication use the runner’s private state and launch helpers. |
| time internal/thintest 240s Thin contract and page tests, the Assistant's and the models' included, share one harness. Measured 202s on a shared 16 CPU box (2026-11-13); CI runs two lanes. |
| 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. |
| 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). |
diff --git a/internal/copydesk/copy.go b/internal/copydesk/copy.go| index b54c3088..cb509e5a 100644 |
| --- a/internal/copydesk/copy.go |
| +++ b/internal/copydesk/copy.go |
| @@ -47,6 +47,7 @@ type Review struct { |
| Strings []Wording `json:"strings"` |
| } |
| type Record struct { |
| + Flag string |
| Key, Hash, Candidate, Owner string |
| Revision int64 |
| } |
| @@ -232,7 +233,14 @@ func ReviewedWords(ex []Literal, candidate string, d Delegation, records []Recor |
| if !Accepted(s, candidate, d, records) { |
| return Review{}, false |
| } |
| - r.Strings = append(r.Strings, Wording{Key: s.Key, Text: s.Text, Action: "accept"}) |
| + flag := "" |
| + for _, record := range records { |
| + if Accepted(s, candidate, d, []Record{record}) { |
| + flag = record.Flag |
| + break |
| + } |
| + } |
| + r.Strings = append(r.Strings, Wording{Key: s.Key, Text: s.Text, Action: "accept", Flag: flag}) |
| } |
| return r, true |
| } |
diff --git a/internal/copydesk/copy_test.go b/internal/copydesk/copy_test.go| index 781fd1c1..62064345 100644 |
| --- a/internal/copydesk/copy_test.go |
| +++ b/internal/copydesk/copy_test.go |
| @@ -113,8 +113,8 @@ func TestCopyBookkeepingSkipsModelOnlyWithRecords(t *testing.T) { |
| if _, ok := ReviewedWords(ex, "head", d, nil); ok { |
| t.Fatal("marker alone skipped model") |
| } |
| - r, ok := ReviewedWords(ex, "head", d, []Record{{Key: "save", Hash: Hash("Save"), Owner: "paul", Revision: 1, Candidate: "head"}}) |
| - if !ok || len(r.Strings) != 1 || r.Strings[0].Text != "Save" { |
| + r, ok := ReviewedWords(ex, "head", d, []Record{{Key: "save", Hash: Hash("Save"), Owner: "paul", Revision: 1, Candidate: "head", Flag: "Check wording"}}) |
| + if !ok || len(r.Strings) != 1 || r.Strings[0].Text != "Save" || r.Strings[0].Flag != "Check wording" { |
| t.Fatal("matching record did not skip model") |
| } |
| } |
diff --git a/internal/equipo/chat/copy_flow.go b/internal/equipo/chat/copy_flow.go| index 15787d5b..4160eda4 100644 |
| --- a/internal/equipo/chat/copy_flow.go |
| +++ b/internal/equipo/chat/copy_flow.go |
| @@ -71,11 +71,11 @@ func (t *txn) copyDispatch(k taskRecord, s *stepRecord) (*wire.CopyDispatch, err |
| } |
| } |
| var records []copyReviewRecord |
| - if err := t.db.Where("task_id = ? AND candidate = ? AND owner = ? AND delegation = ?", k.ID, s.CandidateSHA, s.CopyOwner, s.CopyRevision).Find(&records).Error; err != nil { |
| + if err := t.db.Where("task_id = ? AND candidate = ? AND owner = ? AND delegation = ?", k.ID, s.CandidateSHA, s.CopyOwner, s.CopyRevision).Order("created_at DESC,id DESC").Find(&records).Error; err != nil { |
| return nil, err |
| } |
| for _, v := range records { |
| - cmd.Records = append(cmd.Records, copydesk.Record{Key: v.Key, Hash: v.Hash, Candidate: v.Candidate, Owner: v.Owner, Revision: v.Delegation}) |
| + cmd.Records = append(cmd.Records, copydesk.Record{Flag: v.Flag, Key: v.Key, Hash: v.Hash, Candidate: v.Candidate, Owner: v.Owner, Revision: v.Delegation}) |
| } |
| if s.Round > 0 { |
| cmd.Compared = k.BaseSHA |
diff --git a/internal/equipo/settings_hub.go b/internal/equipo/settings_hub.go| index d167d94b..cc11b33b 100644 |
| --- a/internal/equipo/settings_hub.go |
| +++ b/internal/equipo/settings_hub.go |
| @@ -43,11 +43,11 @@ type settingsLink struct { |
| } |
| var settingsSections = []settingsLink{ |
| - {Key: "copy", Href: "/conversation/settings/copy", CopyKey: "copy.title", Icon: "type"}, |
| {Key: "thinking", Href: "/conversation/settings/thinking", CopyKey: "thinking.title", Icon: "type"}, |
| {Key: "connections", Href: "/conversation/settings/connections", CopyKey: "settings.connections", Icon: "plug"}, |
| {Key: "machines", Href: "/conversation/settings/machines", CopyKey: "runner.title", Icon: "monitor"}, |
| {Key: "housekeeping", Href: "/conversation/settings/housekeeping", CopyKey: "settings.housekeeping", Icon: "list-checks"}, |
| + {Key: "copy", Href: "/conversation/settings/copy", CopyKey: "copy.title", Icon: "type"}, |
| {Key: "notebook", Href: "/conversation/settings/notebook", CopyKey: "settings.notebook_open", Icon: "notebook"}, |
| {Key: "teams", Href: "/teams", CopyKey: "settings.teams_open", Icon: "users"}, |
| } |
diff --git a/internal/runner/thin/copy_test.go b/internal/runner/thin/copy_test.go| index 0761ba67..eff1ac47 100644 |
| --- a/internal/runner/thin/copy_test.go |
| +++ b/internal/runner/thin/copy_test.go |
| @@ -8,8 +8,8 @@ import ( |
| "amadan.net/oficina/equipo/internal/wire" |
| "context" |
| "os" |
| + "os/exec" |
| "path/filepath" |
| - "runtime" |
| "strings" |
| "testing" |
| ) |
| @@ -59,7 +59,11 @@ func TestCopyCommandPreservesStructuredOutput(t *testing.T) { |
| func TestCopyStructuredPassPublishesAndFlags(t *testing.T) { |
| install := fakePiInstall(t) |
| r := newMeteredRig(t, bigBudget, rigConn{local: piLocal, provider: wire.ProviderTensorX, harness: wire.HarnessPi, upstream: "https://api.tensorx.ai", model: "z-ai/glm-5.2", key: fakepi.TestKey}, func(e *Engineer) { e.Pi = PiOptions{Install: install} }) |
| - r.e.O.Runner.GoRoot = runtime.GOROOT() |
| + goRoot, err := exec.Command("go", "env", "GOROOT").Output() |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + r.e.O.Runner.GoRoot = strings.TrimSpace(string(goRoot)) |
| root := t.TempDir() |
| seed := filepath.Join(root, "seed") |
| remote := r.e.Forge.(*hubForge).dir |
diff --git a/internal/thintest/pages_test.go b/internal/thintest/pages_test.go| index ce51007b..da8e8ca9 100644 |
| --- a/internal/thintest/pages_test.go |
| +++ b/internal/thintest/pages_test.go |
| @@ -320,7 +320,7 @@ var hrefs = regexp.MustCompile(`href="([^"]*)"`) |
| func TestPagesRail(t *testing.T) { |
| r := newToolRig(t) |
| owner := r.inst.Cookie() |
| - allowed := regexp.MustCompile(`^/(conversation|conversation/settings|tasks|projects|people|work|usage|tasks\?needs=you|tasks/tk[a-z0-9]+|team/(engineering|review|checks))$`) |
| + allowed := regexp.MustCompile(`^/(conversation|conversation/settings|tasks|projects|people|work|usage|tasks\?needs=you|tasks/tk[a-z0-9]+|team/(engineering|copy|review|checks))$`) |
| for _, path := range []string{"/conversation", "/tasks", "/projects", "/people", "/tasks?needs=you"} { |
| rail := railOf(t, r.get(owner, path, 200)) |
| for _, m := range hrefs.FindAllStringSubmatch(rail, -1) { |
| @@ -328,14 +328,14 @@ func TestPagesRail(t *testing.T) { |
| t.Fatalf("%s: the sidebar links %q", path, m[1]) |
| } |
| } |
| - for _, gone := range []string{"Journey", "Playbooks", "Product", "Design", "Copy", "nav-coordinator", "nav-connections", `id="nav-settings"`} { |
| + for _, gone := range []string{"Journey", "Playbooks", "Product", "Design", "nav-coordinator", "nav-connections", `id="nav-settings"`} { |
| if strings.Contains(rail, gone) { |
| t.Fatalf("%s: the sidebar shows %s", path, gone) |
| } |
| } |
| } |
| rail := railOf(t, r.get(owner, "/conversation", 200)) |
| - if !strings.Contains(rail, `data-specialist="engineering" data-state="idle"`) || !strings.Contains(rail, `data-specialist="review" data-state="idle"`) || strings.Contains(rail, "data-count>") { |
| + if !strings.Contains(rail, `data-specialist="copy" data-state="idle"`) || !strings.Contains(rail, `data-specialist="engineering" data-state="idle"`) || !strings.Contains(rail, `data-specialist="review" data-state="idle"`) || strings.Contains(rail, "data-count>") { |
| t.Fatalf("idle sidebar: %s", rail) |
| } |
| id := taskID(t, r.call("n1", wire.ToolRecordTask, map[string]string{"repo": "oficina/sample", "title": "Swipe back does nothing", "brief": "x"})) |
diff --git a/internal/thintest/settings_browser_test.go b/internal/thintest/settings_browser_test.go| index 085d4c2d..674fc3b5 100644 |
| --- a/internal/thintest/settings_browser_test.go |
| +++ b/internal/thintest/settings_browser_test.go |
| @@ -92,7 +92,7 @@ func (p *innerPage) waitFor(cond func() bool, what string) { |
| // Settings menu is a second sidebar beside the section, the current one |
| // marked, the app's rail still there, and a section is a link away; at |
| // 390 /conversation/settings is the menu as full-row drill-ins with |
| -// chevrons (six since Machines moved under Settings), and a section is its own page with Settings in its bar and no |
| +// chevrons (seven with Copy), and a section is its own page with Settings in its bar and no |
| // menu. Light and dark; EQUIPO_BROWSER_ARTIFACTS keeps the shots. |
| func TestBrowserSettingsMenu(t *testing.T) { |
| r := newToolRig(t) |
| @@ -117,7 +117,7 @@ func TestBrowserSettingsMenu(t *testing.T) { |
| // Phone. |
| q := openInner(t, r.inst.URL, r.inst.Cookie(), 390, 844, true, scheme, "no-preference") |
| q.open("/conversation/settings") |
| - q.check(`(()=>{const ls=[...document.querySelectorAll('[equipo-settings-link]')];const body=document.querySelector('[equipo-settings-body]');return ls.length===6&&ls.every(a=>{const r=a.getBoundingClientRect();return r.height>=44&&r.width>=340&&getComputedStyle(a.querySelector('.icon:last-child')).display!=='none'})&&getComputedStyle(body).display==='none'&&document.documentElement.scrollWidth<=390})()`, scheme+" 390: the menu is not full-row drill-ins") |
| + q.check(`(()=>{const ls=[...document.querySelectorAll('[equipo-settings-link]')];const body=document.querySelector('[equipo-settings-body]');return ls.length===7&&ls.every(a=>{const r=a.getBoundingClientRect();return r.height>=44&&r.width>=340&&getComputedStyle(a.querySelector('.icon:last-child')).display!=='none'})&&getComputedStyle(body).display==='none'&&document.documentElement.scrollWidth<=390})()`, scheme+" 390: the menu is not full-row drill-ins") |
| q.wait(`document.getAnimations().every(a=>a.playState!=='running'||a.effect&&a.effect.getTiming().iterations===Infinity)`, "the slide settled") |
| q.shot("settings-list-390-" + scheme) |
| q.click(`[data-settings-link="thinking"]`) |
| @@ -153,7 +153,7 @@ func TestBrowserSettingsRail(t *testing.T) { |
| p.check(`(()=>{sessionStorage.setItem('rail',JSON.stringify(document.querySelector('[rst-shell-rail]').getBoundingClientRect()));return document.querySelector('#rail').checkVisibility() && !document.querySelector('[equipo-settings-rail]')})()`, "1280: the main nav is not the rail outside Settings") |
| p.click(`#rail a[href="/conversation/settings"]`) |
| p.wait(`location.pathname==='/conversation/settings' && `+sliding+`(document.querySelector('[equipo-settings-rail]'))`, "the Settings nav slides in") |
| - p.check(`(()=>{const was=JSON.parse(sessionStorage.getItem('rail')),now=document.querySelector('[rst-shell-rail]').getBoundingClientRect();const n=document.querySelector('[equipo-settings-rail]');const links=[...n.querySelectorAll('a')].map(a=>a.dataset.railSettings||'leave');return Math.abs(was.left-now.left)<1&&Math.abs(was.width-now.width)<1&&!document.querySelector('#rail').checkVisibility()&&links.join()==='leave,thinking,connections,connections-add,machines,machines-add,housekeeping,notebook,teams'&&n.querySelector('[data-settings-leave]').textContent.trim()==='Equipo'&&n.querySelector('[data-settings-leave]').getAttribute('href')==='/tasks'})()`, "1280: the rail moved, or is not ‹ Equipo and the sections, or ‹ Equipo does not lead back to Tasks") |
| + p.check(`(()=>{const was=JSON.parse(sessionStorage.getItem('rail')),now=document.querySelector('[rst-shell-rail]').getBoundingClientRect();const n=document.querySelector('[equipo-settings-rail]');const links=[...n.querySelectorAll('a')].map(a=>a.dataset.railSettings||'leave');return Math.abs(was.left-now.left)<1&&Math.abs(was.width-now.width)<1&&!document.querySelector('#rail').checkVisibility()&&links.join()==='leave,thinking,connections,connections-add,machines,machines-add,housekeeping,copy,notebook,teams'&&n.querySelector('[data-settings-leave]').textContent.trim()==='Equipo'&&n.querySelector('[data-settings-leave]').getAttribute('href')==='/tasks'})()`, "1280: the rail moved, or is not ‹ Equipo and the sections, or ‹ Equipo does not lead back to Tasks") |
| p.check(`(()=>{const n=document.querySelector('[equipo-settings-rail]').getBoundingClientRect(),b=document.querySelector('[equipo-settings-body]').getBoundingClientRect();return n.right<=b.left&&b.left-n.right<120&&!document.querySelector('[equipo-settings-nav]').checkVisibility()})()`, "1280: Settings is not two columns") |
| p.wait(settled, "the slide settled") |
| p.shot("settings-rail-1280") |
diff --git a/internal/wire/connections_test.go b/internal/wire/connections_test.go| index ea830c14..e386a1a1 100644 |
| --- a/internal/wire/connections_test.go |
| +++ b/internal/wire/connections_test.go |
| @@ -42,8 +42,13 @@ func TestConnectionTypesCarryNoSecrets(t *testing.T) { |
| fieldNames(reflect.TypeOf(v), seen, &names) |
| } |
| // seal_key is the runner's public key (spec §2.4): public by design. |
| - // An advice card's key is its kind and subject (connectors spec §9). |
| - allowed := map[string]bool{"Advice.key": true, "Hello.seal_key": true, "Runner.seal_key": true, "Usage.input_tokens": true, "Usage.output_tokens": true, "Usage.cached_input_tokens": true, "Usage.cache_write_tokens": true, "Usage.reasoning_output_tokens": true} |
| + // An advice card’s key is its kind and subject (connectors spec §9). |
| + // CopyFlag.key identifies an app string; CopyResult.tokens is its numeric usage. |
| + allowed := map[string]bool{"CopyFlag.key": true, "CopyResult.tokens": true, "Advice.key": true, "Hello.seal_key": true, "Runner.seal_key": true, "Usage.input_tokens": true, "Usage.output_tokens": true, "Usage.cached_input_tokens": true, "Usage.cache_write_tokens": true, "Usage.reasoning_output_tokens": true} |
| + counter, _ := reflect.TypeOf(wire.CopyResult{}).FieldByName("Tokens") |
| + if counter.Type.Kind() != reflect.Int64 { |
| + t.Fatal("Copy token counter must remain numeric") |
| + } |
| for _, n := range names { |
| _, field, _ := strings.Cut(n, ".") |
| for _, bad := range secretShaped { |