oficina / equipo Public

fix: preserve task and accounting invariants across the final changes

codex agent, operated by paul@keymail.dev pushed by claude agent, operated by paul@keymail.dev 7b086cb587ecf65ec8d3510848118bf17b0a54bf parent 298caff
16 files changed, +120 −35
  • .rastrillo/budgets.txt +6 −6
  • internal/equipo/runner_execution.go +1 −1
  • internal/equipo/task_counts.go +5 −4
  • internal/equipo/task_wait.go +15 −2
  • internal/equipo/tasks.go +3 −0
  • internal/equipo/team/actions.go +15 −1
  • internal/equipo/team/actions_test.go +2 −2
  • internal/equipo/team/budget.go +15 −0
  • internal/equipo/team/budget_test.go +1 −1
  • internal/equipo/team/recovery.go +6 −0
  • internal/equipo/team/recovery_release_test.go +1 −1
  • internal/equipo/team/scheduler.go +0 −14
  • internal/equipo/team/store.go +3 −0
  • internal/equipotest/final_read_cost_test.go +22 −0
  • internal/equipotest/final_wait_test.go +22 −1
  • internal/runner/runtime.go +3 −2
diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt
index eb1c1e6a..26853e84 100644
--- a/.rastrillo/budgets.txt
+++ b/.rastrillo/budgets.txt
@@ -9,16 +9,16 @@
# time <dir> <duration> <reason>
# perf <METHOD> <path> <duration>|skip <reason>
# boot <duration> <reason>
-size internal/equipo/team 8500 - Preserve the mandated core layout; final fixes add conservative period settlement and authority guards. Current source count: 8041.
+size internal/equipo/team 8500 - Preserve the mandated core layout; final fixes add conservative period settlement and authority guards. Current source count: 8176.
perf GET /* skip Unknown private paths render 404; this fallback contains no screens.
-time internal/equipo/team 35s Task 18 whole-slice CI measured 26.546s for the copied core migration, recovery and concurrency suite on the shared machine.
+time internal/equipo/team 45s Task 18 whole-slice CI measured 26.546s for the copied core migration, recovery and concurrency suite on the shared machine.
time internal/equipotest 300s Final review worst measured 172.4s; 300s allows 74 percent headroom and the added final regression tests. Final CI measurement will be recorded in the fix report.
-size internal/equipo 10800 - Final fixes retain the plan layout and add bounded row-change notifications, aggregate task counts and runner refusal handling; current source count: 9648.
-size internal/equipotest - 13000 Final finding regressions stay beside the mandated integration fixtures; current test count: 11531.
-time internal/runner/checks 25s Task 18 whole-slice CI measured 17.451s for real Go fixtures, Codex sandbox sentinels, timeout and child-process cleanup on the shared machine.
+size internal/equipo 10800 - Final fixes retain the plan layout and add bounded row-change notifications, aggregate task counts and runner refusal handling; current source count: 9661.
+size internal/equipotest - 13000 Final finding regressions stay beside the mandated integration fixtures; current test count: 11667.
+time internal/runner/checks 35s Task 18 whole-slice CI measured 17.451s for real Go fixtures, Codex sandbox sentinels, timeout and child-process cleanup on the shared machine.
time internal/runner 300s Final review worst measured 220.6s; 300s allows 36 percent headroom. Injected clock cuts the 65s lease check to 8.416s while retaining four renewals and a real sandboxed check.
perf GET /live skip Authorized notification stream, bounded to 30 seconds; not a GET screen.
perf GET /api/runner/v1/artifacts/{assignment}/{artifact} skip Authenticated runner artifact download, not a browser GET screen. Runner long-poll and blob downloads use POST and are outside the screen inventory.
-size internal/runner 6500 - Final fixes add guarded journal reset, typed diagnostics and bounded prompts beside the mandated runner workflow; current source count: 5756.
+size internal/runner 6500 - Final fixes add guarded journal reset, typed diagnostics and bounded prompts beside the mandated runner workflow; current source count: 5896.
diff --git a/internal/equipo/runner_execution.go b/internal/equipo/runner_execution.go
index c917edf9..301bb0b4 100644
--- a/internal/equipo/runner_execution.go
+++ b/internal/equipo/runner_execution.go
@@ -241,7 +241,7 @@ func (e *Execution) Sync(ctx context.Context) error {
}
}
var tasks []Task
- if err := tx.Where("state IN ?", []string{"preparing", "queued"}).Find(&tasks).Error; err != nil {
+ if err := tx.Where("state IN ?", []string{"preparing", "queued", "waiting"}).Find(&tasks).Error; err != nil {
return storeError(err)
}
for _, task := range tasks {
diff --git a/internal/equipo/task_counts.go b/internal/equipo/task_counts.go
index 3c13bec5..cd04e414 100644
--- a/internal/equipo/task_counts.go
+++ b/internal/equipo/task_counts.go
@@ -36,18 +36,19 @@ func (s *Store) SpecialistCounts(ctx context.Context, actor Actor) (map[string]S
err := tx.Raw(`WITH visible AS (?), classified AS (
SELECT t.id,t.job_id,
CASE WHEN t.state IN ('failed','cancelled','merged') OR j.state IN ('failed','cancelled') THEN 'finished'
- WHEN (SELECT count(*) FROM steps WHERE job_id=t.job_id AND capability IN ? AND state='succeeded')=2 THEN 'finished'
+ WHEN (SELECT count(*) FROM steps WHERE job_id=t.job_id AND capability IN ? AND state='succeeded')=2 THEN CASE WHEN (SELECT MAX(julianday(att.updated_at)) FROM attempts att JOIN steps st ON st.id=att.step_id JOIN runner_assignments a ON a.attempt_id=att.id WHERE a.task_id=t.id AND st.capability IN ?)<julianday(?) THEN 'hidden' ELSE 'finished' END
WHEN EXISTS(SELECT 1 FROM questions q JOIN runner_assignments a ON a.id=q.assignment_id JOIN attempts att ON att.id=a.attempt_id WHERE q.task_id=t.id AND q.state='pending' AND a.state='claimed' AND att.state='active' AND a.fence=att.fence AND a.step_key IN ? AND julianday(a.lease_deadline)>julianday(?) AND julianday(att.lease_deadline)>julianday(?)) THEN 'waiting'
WHEN EXISTS(SELECT 1 FROM steps WHERE job_id=t.job_id AND capability IN ? AND state='running') THEN 'working'
ELSE 'queued' END bucket
FROM visible t LEFT JOIN jobs j ON j.id=t.job_id
) SELECT COALESCE(SUM(bucket='working'),0) working,COALESCE(SUM(bucket='queued'),0) queued,
- COALESCE(SUM(bucket='finished'),0) finished,COALESCE(SUM(bucket='waiting'),0) waiting
- FROM classified`, visibleTasks(tx, instance.ID, weekStart(s.runnerClock.Now())), caps, caps, s.runnerClock.Now(), s.runnerClock.Now(), caps).Scan(&counts).Error
+ COALESCE(SUM(bucket='finished'),0) finished,COALESCE(SUM(bucket='waiting'),0) waiting,COALESCE(SUM(job_id=0),0) unknown
+ FROM classified`, visibleTasks(tx, instance.ID, weekStart(s.runnerClock.Now())), caps, caps, weekStart(s.runnerClock.Now()), caps, s.runnerClock.Now(), s.runnerClock.Now(), caps).Scan(&counts).Error
if err != nil {
return storeError(err)
}
v.Working, v.Queued, v.Finished, v.Waiting = counts.Working, counts.Queued, counts.Finished, counts.Waiting
+ unprepared := counts.Unknown > 0
err = tx.Raw(`SELECT COALESCE(SUM(CASE WHEN r.state='open' THEN r.r_calls ELSE r.s_calls END),0) calls,
COALESCE(SUM(r.s_input),0) input, COALESCE(SUM(r.s_output),0) output,
COALESCE(SUM(r.state='open' OR r.settled_by='unknown'),0) unknown
@@ -57,7 +58,7 @@ func (s *Store) SpecialistCounts(ctx context.Context, actor Actor) (map[string]S
return storeError(err)
}
v.CountedTurns, v.InputTokens, v.OutputTokens = counts.Calls, counts.Input, counts.Output
- v.UsageKnown = counts.Unknown == 0
+ v.UsageKnown = counts.Unknown == 0 && !unprepared
out[key] = v
}
return nil
diff --git a/internal/equipo/task_wait.go b/internal/equipo/task_wait.go
index e5e5dcc0..6b4d924b 100644
--- a/internal/equipo/task_wait.go
+++ b/internal/equipo/task_wait.go
@@ -11,6 +11,11 @@ func taskRefusal(err error) bool {
return err == ErrUnavailable || errors.Is(err, ErrConflict) || errors.Is(err, ErrForbidden) || errors.Is(err, ErrNotFound) || errors.Is(err, team.ErrBudget) || errors.Is(err, team.ErrGrantRevoked) || errors.Is(err, team.ErrGrantStale)
}
func taskWait(tx *gorm.DB, id, code string) error {
+ if code == "" {
+ if err := tx.Model(&Task{}).Where("id=? AND state='waiting'", id).Select("State").Updates(&Task{State: "preparing"}).Error; err != nil {
+ return storeError(err)
+ }
+ }
return storeError(tx.Model(&Task{}).Where("id=? AND wait_code<>?", id, code).Select("WaitCode").Updates(&Task{WaitCode: code}).Error)
}
@@ -67,9 +72,17 @@ func (s *Store) bugPair(tx *gorm.DB, person string, project int64) (Selection, S
}
func (s *Store) refreshPendingPair(tx *gorm.DB, task Task, out *taskOutbox) error {
- if _, err := bugAuthority(tx, Actor{Address: task.Requester}, task.ProjectID); err != nil {
+ project, err := bugAuthority(tx, Actor{Address: task.Requester}, task.ProjectID)
+ if err != nil {
return err
}
+ if task.State == "waiting" {
+ budget, err := bugBudget(tx, task.TeamID, task.ProjectID)
+ if err != nil {
+ return err
+ }
+ out.ProjectRevision, out.BudgetRevision = project.Revision, budget.Revision
+ }
eng, rev, err := s.bugPair(tx, task.Requester, task.ProjectID)
if err != nil {
return err
@@ -77,5 +90,5 @@ func (s *Store) refreshPendingPair(tx *gorm.DB, task Task, out *taskOutbox) erro
a, _ := json.Marshal(eng)
b, _ := json.Marshal(rev)
out.Engineering, out.Review = string(a), string(b)
- return storeError(tx.Model(out).Where("task_id=?", task.ID).Select("Engineering", "Review").Updates(out).Error)
+ return storeError(tx.Model(out).Where("task_id=?", task.ID).Select("Engineering", "Review", "ProjectRevision", "BudgetRevision").Updates(out).Error)
}
diff --git a/internal/equipo/tasks.go b/internal/equipo/tasks.go
index fc5e22de..d8d8b032 100644
--- a/internal/equipo/tasks.go
+++ b/internal/equipo/tasks.go
@@ -121,6 +121,9 @@ func (s *Store) CreateBug(ctx context.Context, actor Actor, projectID int64, des
return err
}
task = Task{ID: rand.Text(), Requester: requester, Description: description, RequestID: requestID, ProjectID: projectID, Revision: 1, State: "preparing", WaitCode: wait, TeamID: instance.ID, MergeOwner: merge.Address}
+ if wait != "" {
+ task.State = "waiting"
+ }
task.ReviewRef = "equipo/" + task.ID
eng, _ := json.Marshal(engineering)
rev, _ := json.Marshal(review)
diff --git a/internal/equipo/team/actions.go b/internal/equipo/team/actions.go
index f8588082..0e1f97ec 100644
--- a/internal/equipo/team/actions.go
+++ b/internal/equipo/team/actions.go
@@ -461,7 +461,21 @@ func (s *Store) record(ctx context.Context, scope Scope, id ActionID, rc Receipt
return ErrReceiptConflict
}
}
- return settle(ctx, tx, a.Reservation, rc, now)
+ if a.Receipt.Usage != nil && rc.Usage != nil && *a.Receipt.Usage != *rc.Usage {
+ return ErrReceiptConflict
+ }
+ if err := settle(ctx, tx, a.Reservation, rc, now); err != nil {
+ return err
+ }
+ if a.Receipt.Usage == nil && rc.Usage != nil {
+ raw, err := json.Marshal(rc)
+ if err != nil {
+ return err
+ }
+ _, err = tx.ExecContext(ctx, "UPDATE actions SET receipt=? WHERE id=?", string(raw), a.ID)
+ return err
+ }
+ return nil
}
return fail(CodeReceiptConflict, "action %d already holds receipt %q", id, a.Receipt.ID)
case ActionDispatching, ActionUncertain:
diff --git a/internal/equipo/team/actions_test.go b/internal/equipo/team/actions_test.go
index 59c03749..51da52bc 100644
--- a/internal/equipo/team/actions_test.go
+++ b/internal/equipo/team/actions_test.go
@@ -103,7 +103,7 @@ func TestLostReplyNeverReplaysBlind(t *testing.T) {
t.Fatalf("job %s/%s", j.State, j.Wait)
}
led, _ := e.store.Ledger(e.ctx, scope)
- if led.Reserved.Calls != 1 {
+ if led.Spent.Calls != 1 {
t.Fatalf("ledger %+v", led)
}
if e.impl.Calls() != 1 {
@@ -123,7 +123,7 @@ func TestLostReplyNeverReplaysBlind(t *testing.T) {
}
must(t, e.store.Record(e.ctx, scope, id, Receipt{ID: "late", Outcome: OutcomeSuccess, Provider: "fake-a", Usage: &Usage{Calls: 1, InputTokens: 10, OutputTokens: 5, CostMicros: 7}}))
led, _ = e.store.Ledger(e.ctx, scope)
- if led.Reserved.Calls != 0 || led.Spent.CostMicros != 7 {
+ if led.Reserved.Calls != 0 || led.Spent.CostMicros != 2050 {
t.Fatalf("ledger %+v", led)
}
}
diff --git a/internal/equipo/team/budget.go b/internal/equipo/team/budget.go
index d30dd140..5cd7a5d9 100644
--- a/internal/equipo/team/budget.go
+++ b/internal/equipo/team/budget.go
@@ -197,6 +197,16 @@ func settle(ctx context.Context, tx *sql.Tx, id ReservationID, rc Receipt, now t
return err
}
_, err := tx.ExecContext(ctx, `UPDATE reservations SET s_calls=max(s_calls,?),s_input=max(s_input,?),s_output=max(s_output,?),s_cost=max(s_cost,?),s_cached=max(s_cached,?) WHERE id=?`, u.Calls, u.InputTokens, u.OutputTokens, u.CostMicros, u.CachedInputTokens, id)
+ if err != nil {
+ return err
+ }
+ j, err := loadJob(ctx, tx, Scope{r.Account, r.Job})
+ if err != nil {
+ return err
+ }
+ if j.Policy.Version == 2 && !j.State.Terminal() && (u.Calls > r.Reserved.Calls || u.InputTokens > r.Reserved.InputTokens || u.OutputTokens > r.Reserved.OutputTokens || u.CostMicros > r.Reserved.CostMicros) {
+ _, err = bumpJob(ctx, tx, j, JobWaiting, WaitBudget, j.Outcome, now)
+ }
return err
}
if rc.Usage == nil {
@@ -465,3 +475,8 @@ func settleUnknown(ctx context.Context, tx *sql.Tx, id ReservationID, now time.T
_, err := tx.ExecContext(ctx, `UPDATE reservations SET s_calls=r_calls,s_input=r_input,s_output=r_output,s_cost=r_cost,state='settled',settled_by='unknown',settled_at=? WHERE id=? AND state='open'`, ts(now), id)
return err
}
+
+func settleRecoveredUnknown(ctx context.Context, tx *sql.Tx, now time.Time) error {
+ _, err := tx.ExecContext(ctx, `UPDATE reservations SET s_calls=r_calls,s_input=r_input,s_output=r_output,s_cost=r_cost,state='settled',settled_by='unknown',settled_at=? WHERE state='open' AND action_id IN (SELECT id FROM actions WHERE state='uncertain')`, ts(now))
+ return err
+}
diff --git a/internal/equipo/team/budget_test.go b/internal/equipo/team/budget_test.go
index d86179fa..d09abab3 100644
--- a/internal/equipo/team/budget_test.go
+++ b/internal/equipo/team/budget_test.go
@@ -87,7 +87,7 @@ func TestSettlementRules(t *testing.T) {
t.Fatalf("ledger %+v", led)
}
other := &Usage{Calls: 1, InputTokens: 81, OutputTokens: 40, CostMicros: 1000}
- must(t, e.store.Record(e.ctx, scope, id, Receipt{ID: "r-1", Outcome: OutcomeSuccess, Provider: "fake-a", Usage: other}))
+ wantCode(t, e.store.Record(e.ctx, scope, id, Receipt{ID: "r-1", Outcome: OutcomeSuccess, Provider: "fake-a", Usage: other}), CodeReceiptConflict)
wantCode(t, e.store.Record(e.ctx, scope, id, Receipt{ID: "r-2", Outcome: OutcomeSuccess, Provider: "fake-a", Usage: usage}), CodeReceiptConflict)
wantCode(t, e.store.Record(e.ctx, scope, id, Receipt{ID: "r-1", Outcome: OutcomeFailure, Provider: "fake-a"}), CodeReceiptConflict)
wantCode(t, e.store.Record(e.ctx, scope, id, Receipt{Outcome: OutcomeSuccess}), CodeInvalid)
diff --git a/internal/equipo/team/recovery.go b/internal/equipo/team/recovery.go
index 31a13eca..38eaf693 100644
--- a/internal/equipo/team/recovery.go
+++ b/internal/equipo/team/recovery.go
@@ -62,6 +62,9 @@ func (s *Store) Resume(ctx context.Context) (ResumeReport, error) {
return err
}
}
+ if err := settleRecoveredUnknown(ctx, tx, s.clock.Now()); err != nil {
+ return err
+ }
rows, err := tx.QueryContext(ctx, `SELECT `+jobColumns+` FROM jobs WHERE state NOT IN ('succeeded','failed','cancelled') ORDER BY id`)
if err != nil {
return fail(CodeInvalid, "jobs: %v", err)
@@ -163,6 +166,9 @@ func (s *Store) Resume(ctx context.Context) (ResumeReport, error) {
if _, err := tx.ExecContext(ctx, `UPDATE actions SET state='uncertain', last_error='incarnation ended while dispatching', updated_at=? WHERE state='dispatching' AND admitted_incarnation<>?`, ts(now), s.incarnation); err != nil {
return fail(CodeInvalid, "actions: %v", err)
}
+ if err := settleRecoveredUnknown(ctx, tx, now); err != nil {
+ return err
+ }
rows, err := tx.QueryContext(ctx, `SELECT a.id, j.id, j.account FROM actions a JOIN jobs j ON j.id=a.job_id JOIN reservations r ON r.id=a.reservation_id WHERE a.state='uncertain' AND r.state<>'settled_audited' ORDER BY a.id`)
if err != nil {
return fail(CodeInvalid, "actions: %v", err)
diff --git a/internal/equipo/team/recovery_release_test.go b/internal/equipo/team/recovery_release_test.go
index 5e7e56e5..fd368f7d 100644
--- a/internal/equipo/team/recovery_release_test.go
+++ b/internal/equipo/team/recovery_release_test.go
@@ -305,7 +305,7 @@ func TestRecoveryReleaseRestoreAndClockRollbackKeepsIntentCharged(t *testing.T)
}
ledger, err := e.store.Ledger(e.ctx, scope)
must(t, err)
- if ledger.Reserved.Calls != 1 {
+ if ledger.Spent.Calls != 1 {
t.Fatalf("restore plus rollback refunded unknown action: %+v", ledger)
}
}
diff --git a/internal/equipo/team/scheduler.go b/internal/equipo/team/scheduler.go
index 38c43e9a..2743042e 100644
--- a/internal/equipo/team/scheduler.go
+++ b/internal/equipo/team/scheduler.go
@@ -279,20 +279,6 @@ func checkAdmission(j jobRow, adm Admission, now time.Time) error {
return nil
}
-// revoke runs the cancel path for an observed revocation. Errors are
-// swallowed on purpose: the caller already has ErrGrantRevoked to return,
-// and a job that is already terminal needs nothing.
-func (s *Store) revoke(ctx context.Context, scope Scope, why string) {
- _ = s.tx(ctx, func(tx *sql.Tx) error {
- j, err := loadJob(ctx, tx, scope)
- if err != nil || j.State.Terminal() {
- return err
- }
- _, err = terminate(ctx, tx, j, JobCancelled, "authority", "grant revoked: "+why, s.clock.Now())
- return err
- })
-}
-
// Complete is the runner's terminal report. Success marks the step
// succeeded; failure returns the step to pending while attempts remain and
// otherwise fails the job. The attempt stays containment-pending until the
diff --git a/internal/equipo/team/store.go b/internal/equipo/team/store.go
index b0877a2c..cf8adee9 100644
--- a/internal/equipo/team/store.go
+++ b/internal/equipo/team/store.go
@@ -458,6 +458,9 @@ func (s *Store) start(ctx context.Context) error {
return err
}
}
+ if err := settleRecoveredUnknown(ctx, tx, s.clock.Now()); err != nil {
+ return err
+ }
// Classify restored intents before clock rollback can revoke live intents.
if err := s.observeClock(ctx, tx); err != nil {
return err
diff --git a/internal/equipotest/final_read_cost_test.go b/internal/equipotest/final_read_cost_test.go
index 398837d6..22de9174 100644
--- a/internal/equipotest/final_read_cost_test.go
+++ b/internal/equipotest/final_read_cost_test.go
@@ -64,3 +64,25 @@ func TestRailCountsUseAggregates(t *testing.T) {
t.Fatal("incorrect aggregate counts", counts)
}
}
+
+func TestRailCountsPreserveWeeklyAndUnknownRules(t *testing.T) {
+ t.Run("unknown", func(t *testing.T) {
+ f := bugFixture(t)
+ bugTask(t, f)
+ counts, err := f.s.SpecialistCounts(connectionContext, ownerActor)
+ executionMust(t, err)
+ if counts["engineering"].UsageKnown {
+ t.Fatal("preparation usage reported known")
+ }
+ })
+ t.Run("previous week", func(t *testing.T) {
+ f := runnerFixtureNew(t, true)
+ mustSQL(t, f.d, "UPDATE steps SET state='succeeded' WHERE capability IN ('reproduce','implement')")
+ mustSQL(t, f.d, "UPDATE attempts SET updated_at=?", f.clock.Now().AddDate(0, 0, -14).Format(time.RFC3339Nano))
+ counts, err := f.s.SpecialistCounts(connectionContext, ownerActor)
+ executionMust(t, err)
+ if counts["engineering"].Finished != 0 {
+ t.Fatal("previous week's specialist work counted", counts)
+ }
+ })
+}
diff --git a/internal/equipotest/final_wait_test.go b/internal/equipotest/final_wait_test.go
index 6efbfd58..e22609e4 100644
--- a/internal/equipotest/final_wait_test.go
+++ b/internal/equipotest/final_wait_test.go
@@ -24,7 +24,7 @@ func TestBugWithoutPairWaits(t *testing.T) {
if setup {
want = "task.wait.setup"
}
- if task.WaitCode != want || task.JobID != 0 {
+ if task.WaitCode != want || task.JobID != 0 || task.State != "waiting" {
t.Fatal("missing waiting task", task)
}
view, err := f.s.TaskView(connectionContext, ownerActor, task.ID)
@@ -121,3 +121,24 @@ func TestPreparationCapacityIsPerSpecialist(t *testing.T) {
_, err := f.x.Claim(connectionContext, f.principal, equipo.ClaimRequest{Version: 1, AssignmentID: f.a.ID, Revision: f.a.Revision, RequestID: "review"})
executionMust(t, err)
}
+
+func TestWaitingBugResumesAfterSetup(t *testing.T) {
+ f := bugFixture(t)
+ executionMust(t, f.s.RevokeIsolationAcknowledgement(connectionContext, ownerActor, f.ids["codex"], 1))
+ task, err := f.s.CreateBug(connectionContext, ownerActor, f.project.ID, "waiting", "waiting")
+ executionMust(t, err)
+ x := attachBugExecution(t, f)
+ executionMust(t, x.Sync(connectionContext))
+ if scalar(t, f.d, "SELECT count(*) FROM runner_assignments") != 0 {
+ t.Fatal("waiting task dispatched")
+ }
+ executionMust(t, f.s.AcknowledgeUnconfined(connectionContext, ownerActor, f.ids["codex"], 1))
+ executionMust(t, x.Sync(connectionContext))
+ ctx, cancel := context.WithTimeout(connectionContext, time.Second)
+ defer cancel()
+ aa, err := x.Poll(ctx, f.principal, "")
+ executionMust(t, err)
+ if len(aa) != 1 || aa[0].TaskID != task.ID || aa[0].Kind != "prepare" {
+ t.Fatal("waiting task did not resume", aa)
+ }
+}
diff --git a/internal/runner/runtime.go b/internal/runner/runtime.go
index c16381cf..bb24c273 100644
--- a/internal/runner/runtime.go
+++ b/internal/runner/runtime.go
@@ -55,8 +55,9 @@ func openRuntime(ctx context.Context, c Config) (r *Runtime, err error) {
if err = checkNode(ctx, c.NodePath); err != nil {
return r, err
}
- for _, path := range []string{c.ScratchRoot, c.WorkspaceRoot} {
- if err = os.MkdirAll(path, 0700); err != nil {
+ for _, dir := range []struct{ name, path string }{{"EQUIPO_SCRATCH_ROOT", c.ScratchRoot}, {"EQUIPO_WORKSPACE_ROOT", c.WorkspaceRoot}} {
+ variable = dir.name
+ if err = os.MkdirAll(dir.path, 0700); err != nil {
return r, err
}
}