Status: done (2026-11-23)
Priority: 1
Size: S
Design ref: design.md section 7, A leg, and its end; The cut and the call; Help between households; docs/review-agency.md, section 8
Goal: Mends a red check. node tests/oxen.js fails on the run’s branch after its merge with main (OXEN FAIL: rates 0 1.96, 1 1.01, 2 0.95, 3 0.98, 4 1.31, 5 1.04): household 4, which has no ox team, shows 1.31 hours of ploughing done a pawn-hour, above a hand’s pace (1.18). It passes on main alone and on the branch before the merge, so it is an interaction of the two: main’s day’s end (VB-1546 the afternoon allotment, VB-1547 a core task finished past the day’s end, eveningCall in sim/jobs, the day’s end in sim/clock and sim/agents) with this branch’s own time (sim/pastimes, ownTime, called from sim/clock) or VB-1554’s change in refreshJobs. Traced so far (founders, seed 7, the probe island of tests/oxen.js, game day 50): pawn 3, wife of household 1, lent as a helper (sim/hands) to household 4’s plow, is seen with a.job still that task while its phase is go, work, then home, then null: it walks home without being released from the task’s claims, and the task is credited 11.35 hours of work for 6.0 hours in phase work that day (a task’s progress is reckoned in closed form from the rate of the hands in j.claims, sim/work). Find which path sends a hand home (or leaves it free) without release (sim/agents), mend it there so that one rule lets go of work at the day’s end for a member and a helper alike, and add the invariant: no agent holds a full task (a.job) in phase home or null. A script that prints the day-by-day tally is in the notes.
Acceptance criteria:
node tests/oxen.js passes with its bound unchanged; the cause is named in the notes (which call, of which merge side).tests/lib/invariants.js: an agent with a full task in hand is in phase go, work or back (or what the code’s own phases allow, said in the notes), never home or null; a test on a constructed state holds a helper released at the day’s end.npm run format, npm run verify, node tests/smoke.js and node tests/browser.js pass.
Notes:node x.js:
const VB=require('./src/load.js'),Sim=VB.sim,T=Sim.HERD.team,DAY=VB['sim/rules'].DAY,s=Sim.seed(require('./tests/lib/probe.js').island(7),7,'founders'),day={};for(let k=0;k<2*Sim.YEAR*10;k++){const was=new Map();for(const q of s.jobs.values())if(T.kinds.includes(q.kind)&&q.owner.id===4)was.set(q,q.done);const d=Math.floor(s.t/DAY);Sim.advance(s,0.1);const e=day[d]=day[d]||{w:0,h:0,who:new Set()};for(const[q,x]of was)e.w+=q.done-x;for(const a of s.agents)if(a.job&&T.kinds.includes(a.job.kind)&&a.job.owner.id===4){e.who.add(a.id+':'+a.phase+':'+a.basis);if(a.phase==='work')e.h+=0.1}}for(const[d,e]of Object.entries(day))if(e.w||e.h)console.log(d,e.w.toFixed(2),e.h.toFixed(1),[...e.who].join(' '))
It prints for day 50: work 11.35, hours 6.0, 3:go:helper 3:work:helper 3:home:helper 3:null:helper; days 51, 52 and 54 agree to within a sample.sim/hands step (this branch’s VB-470/704 side, unchanged by the merge) sends a lent hand whose hours are given home by issue(goHome) without release: the verb’s frees was honoured only by the player’s queue, so the helper walked home in phase home still in j.claims and the task’s closed-form pace (sim/work) credited it until the day’s end released it. The merge only changed the timing that exposed it (household 4’s helpers given their hours mid-day). tests/helpers.js’ old check (no helper in phase work) let it pass; tightened, it fails without the fix.goHome (sim/agents) lets go of the job in hand itself, whoever issues it (queue, day’s end, hands, pastimes, days, occasions): one rule. sim/hands step leaves a hand bringing a load in (phase back) until it has, as the day’s end does.tests/lib/invariants.js): a.job only in phases go, work, back (back carries a load home, the code’s own). Constructed test: tests/helpers.js, a helper lent at 16:00 for 4 hours lets the hoeing go at the day’s end.