oficina / equipo Public

Keep merge detail separate from errors and shorten the budget reason

Paul Campbell pushed by paul@keymail.dev e189b48eb934639d2a42d7808627a5ab888ee097 parent 58a4244
3 files changed, +14 −13
  • .rastrillo/budgets.txt +1 −1
  • internal/runner/thin/mergestep.go +7 −6
  • internal/runner/thin/sandbox_masks.go +6 −6

CI passed — run details

diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt
index 0b800a3e..24fb68e7 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 24050 16479 The thin runner: steps, link, the coordinator and the Assistant, Mac worker, previews, merges, metered models, Research, scheduler, site host, OpenCode. Includes the publish and merge regression fixtures for sandbox placeholders. Measured 24050 source, 16479 test lines.
+size internal/runner/thin 24051 16479 Thin runner features share the step harness. Includes sandbox placeholder publish and merge guards. Measured 24051 source, 16479 test lines.
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/runner/thin/mergestep.go b/internal/runner/thin/mergestep.go
index 6d15b247..a8678ec8 100644
--- a/internal/runner/thin/mergestep.go
+++ b/internal/runner/thin/mergestep.go
@@ -11,6 +11,7 @@ import (
"amadan.net/oficina/equipo/internal/runner/forge"
"amadan.net/oficina/equipo/internal/runner/workspace"
+ "amadan.net/oficina/equipo/internal/runnerproto"
"amadan.net/oficina/equipo/internal/wire"
)
@@ -62,11 +63,11 @@ func (e *Engineer) mergeStep(ctx context.Context, r stepRow, progress func(wire.
if e.ConfirmMerge != nil {
confirm = func(ctx context.Context) error { return e.ConfirmMerge(ctx, r.StepID, r.Attempt) }
}
- var maskErr error
+ var maskDetail string
notAuthorized := false
confirmMerge := func(ctx context.Context) error {
- if maskErr = e.checkMergeSandboxMasks(ctx, r); maskErr != nil {
- return maskErr
+ if maskDetail = e.mergeSandboxDetail(ctx, r); maskDetail != "" {
+ return forge.ErrMergeRefused
}
err := confirm(ctx)
if errors.Is(err, ErrMergeNotAuthorized) {
@@ -102,15 +103,15 @@ func (e *Engineer) mergeStep(ctx context.Context, r stepRow, progress func(wire.
cctx, cancel := context.WithTimeout(mctx, 3*time.Minute)
out, err = forge.MergeBranch(cctx, m)
cancel()
- if maskErr != nil || notAuthorized || !errors.Is(err, forge.ErrMergeUncertain) || uncertain+1 >= mergeAttempts {
+ if maskDetail != "" || notAuthorized || !errors.Is(err, forge.ErrMergeUncertain) || uncertain+1 >= mergeAttempts {
break
}
time.Sleep(time.Duration(uncertain+1) * mergeBackoff)
}
// Why it did not merge, for the person (the stopped step's log tail):
// the hub's status, code and message, or the error's words.
- if maskErr != nil {
- rep.LogTail = forge.MergeDetail(maskErr)
+ if maskDetail != "" {
+ rep.LogTail = runnerproto.RedactDetail(maskDetail, runnerproto.DetailLimit)
return fail("policy_rejected")
}
rep.LogTail = forge.MergeDetail(err)
diff --git a/internal/runner/thin/sandbox_masks.go b/internal/runner/thin/sandbox_masks.go
index 4faf86d0..2164c9ea 100644
--- a/internal/runner/thin/sandbox_masks.go
+++ b/internal/runner/thin/sandbox_masks.go
@@ -15,23 +15,23 @@ const (
// Every actual merge request checks the judged commit against the current
// default branch. Reconciliation of an already landed merge needs no check.
-func (e *Engineer) checkMergeSandboxMasks(ctx context.Context, r stepRow) error {
+func (e *Engineer) mergeSandboxDetail(ctx context.Context, r stepRow) string {
ctx, cancel := context.WithTimeout(ctx, fetchTimeout)
defer cancel()
_, base, _, err := e.Clones.Heads(ctx, r.Repo, nil)
if err != nil && !errors.Is(err, ErrEmptyRepo) {
- return fmt.Errorf(copyMergeSandboxCheck, err)
+ return fmt.Sprintf(copyMergeSandboxCheck, err)
}
if err := e.fetch(ctx, r.Repo); err != nil {
- return fmt.Errorf(copyMergeSandboxCheck, err)
+ return fmt.Sprintf(copyMergeSandboxCheck, err)
}
tree := workspace.TaskTree{Git: e.O.Runner.GitPath, GitDir: e.Clones.Path(r.Repo), Dir: e.Clones.Path(r.Repo)}
paths, err := tree.AddedSandboxMasks(ctx, base, r.CandidateSHA)
if err != nil {
- return fmt.Errorf(copyMergeSandboxCheck, err)
+ return fmt.Sprintf(copyMergeSandboxCheck, err)
}
if len(paths) > 0 {
- return fmt.Errorf(copyMergeSandboxMask, fmt.Sprintf("%q", paths[0]))
+ return fmt.Sprintf(copyMergeSandboxMask, fmt.Sprintf("%q", paths[0]))
}
- return nil
+ return ""
}