Repository navigation
fix(walk): a two-body wait cycle is recovered in seconds, one walker steps aside (#2596) - #2605
Merged
Merged
Conversation
…steps aside (#2596) Walkers whose goals touch could wait a minute for each other: one stands at the end of its walk waiting for the other to leave its spot (walk.goal-occupied), the other waits for it to get out of the way (traffic.person), or two stand face to face. Routing round failed in the crowd and only the one-minute bound ended the walk (route.blocked). The deadlock recovery now asks a cycle's members for recovery once the cycle has stood unchanged for CYCLE_RECOVER_TICKS (3 s) instead of DEADLOCK_TICKS (10 s; the report is unchanged). When the existing person/load replan does not break a two-body cycle, one of the pair takes the existing face-off detour (stepAside, factored out of resolveFaceoff): the one at the end of its walk first. Nothing changes where no cycle stands. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
genekogan
marked this pull request as ready for review
November 16, 2026 12:35
Contributor
Proof check:
|
| Check | Status | Detail |
|---|---|---|
| maintainer sign-off | ok | waived by @genekogan (proof:waived) |
Proof links: 0 video, 0 image, no proof.json.
Updated on every edit, push, label and review. How to fill it: .claude/skills/journal/SKILL.md. T3-T4 also need the maintainer's sign-off (tools/proof/gate.mjs). A maintainer can waive with the proof:waived label.
… as a logged runtime policy (#2596) Review of PR 2605: an old log with a cycle of 3 s or more would replay differently at boot (clock-frontier.replay-differs). Both changes now run only under cycle-recover/1 (cfg cycleRecoverV1, rt.services), a named state-hash input adopted at boot after cede-passage/1 by one rules event; history before it replays without it. Off is tick-identical to main (per-tick state hash chains of the 12 jam variants equal; the off test pins main's bound refusals). Also: a carry's shared gather exec never steps aside (walkExecs(rt).get(ex.id) must be ex, and the other's exec must be its own); "a cycle never clears by itself" is now "rarely" with the measured figure; resolveFaceoff's doc names the native path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Review fixes pushed, head
|
…n main (#2596) A carry's gathering walkers share one walk exec under the carry's id, so moverEx.actor can be another crew member than the body resolveFaceoff chose. Also: movement.md lists cycle-recover/1 among the boot policies (cede-passage/1 is no longer last); the changelog fragment says it is a logged rule adopted at boot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Delta fixes pushed, head
|
genekogan
enabled auto-merge
November 16, 2026 13:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Walkers whose goals touch could wait a minute for each other. One stands at the end of its walk waiting for the other to leave its spot (
walk.goal-occupied), the other waits for it to get out of the way (traffic.person), or two stand face to face. In a crowd, routing round the other finds nothing, so only the one-minute bound ended the wait (deadlock.cycle, thenroute.blocked): a Soul visibly stood for a minute and then gave up a walk that had room. In N3's jam sweep (30 bodies converging on one fire ring), this ended 10 walks in 5 of 12 variants on main. Closes #2596.The fix is in the existing deadlock recovery, under a new logged runtime policy,
cycle-recover/1(cfgcycleRecoverV1, inrt.services). It follows the cede-passage/1 pattern: aRUNTIME_POLICY_FLAGSentry, a named state-hash input (cycleRecoverPolicy),WorldHost.enableCycleRecoverV1, and onerulesevent adopted at boot after cede-passage/1. History before that event replays without it, so an old log with a 3-s cycle still reaches the same clock-frontier hash. Without the policy, every tick is as on main.mars/viewer/engine/runtime/waits.ts). A cycle that has stood unchanged for 3 s rarely clears by itself: in the 12-variant jam, the reviewer measured one that cleared at 70 ticks. So under the policy its members request recovery once the cycle has stood unchanged forCYCLE_RECOVER_TICKS(60 ticks, 3 s) instead ofDEADLOCK_TICKS(200 ticks, 10 s). Waits on someone who may still move keep the 10 s, and thedeadlock.cyclereport still waits forDEADLOCK_TICKS.mars/viewer/engine/locomotion/walk.ts,recoverWaitandstepAsideInCycle). The existing person/load re-plan is tried first, exactly as before. If it does not break a two-body cycle, one of the pair takes the face-off detour that entity worlds already use (stepAside, factored out ofresolveFaceoffunchanged): it walks to the nearest free spot clear of the other's way, waits there until the other has passed, then walks back on. The one standing at the end of its walk goes first, since it comes back to the same spot. The recovery reportsdeadlock.stepped-aside.N5's local-pass design (
docs/design/local-steering.md) does not apply when the blocker stands on the goal, so it could not cover this case.Acceptance
node --test packages/engine-mars/src/goal-wait-cycle.test.ts-> 2 pass. The same file run against main's walk.ts and waits.ts (with only the read-onlymutualWaitshelper added) -> 2 fail. A1 on main:h_jam16 failed route.blocked at 1604,h_jam26 ... at 1695,h_jam18 ... at 1809, and the longest two-body wait cycle is 1193 ticks. The scene is N3's 30-body jam from 10 m to 1.9 m with no rotation. On main without N3's rule, the 8 m, 1.9 m, no-rotation scene ends with no walk at the bound, so I used the variant that does. It has both kinds of goal-occupied cycle: goal-occupied against person, and two bodies each standing on the other's spot.stateHash()chain over 2200 ticks of all 12 jam variants is equal between this branch with the policy off and main1655b393f(an extracted copy of main's engine, run through the same script). The off test ingoal-wait-cycle.test.tsalso pins main's three bound refusals at their ticks.node --test packages/engine-mars/src/goal-wait-cycle.test.ts-> pass. In the A1 scene, recovery steps a body aside inwalk.goal-occupied / traffic.personandwalk.goal-occupied / walk.goal-occupiedcycles, and the longest two-body wait cycle is 61 ticks (3 s; 1193 on main). Across all 12 variants the longest is 137 ticks (6.9 s): 75 ticks of the walk's own re-plan ladder, then 60 ticks to recovery. The test bar is under 200 ticks, before the 10-s deadlock report would name the cycle. The detour is the walk's existing face-off detour, stepped bystepWalk, andruntime.violations(motion.teleportincluded) is empty in every variant. Goldens:node --teston walk-perf, take-golden, captured-hash, walk, deadlock, deadlock-recovery and 11 more inmars/viewer/engine/test-> 141 pass, none regenerated. Walk gate:node tools/test-harness/walk/walk.mjs-> "walk: no place worse than the baseline" on all five worlds.node --test packages/engine-mars/src/goal-wait-cycle.test.ts-> pass ("A3 across the 12 variants"); sweep score: main ends 10 walks by the bound in 5 of 12 variants; this branch ends none, with 30/30 arrived in every variant and no violations.Proof
Tier: T3 (
node tools/proof/tier.mjs: engine path)ac25a1b1e; the reviewer verdict is added by the coordinator at sign-off)Self-audit
node --test packages/engine-mars/src/goal-wait-cycle.test.ts-> 4 pass: policy off pinned to main, the hash input, A1/A2 and A3 with it on. The first cut, run against main's code, failed as above.node --test apps/server/src/edge-runtime-rules.test.ts-> 4 pass (boot order with cycle-recover/1 last)1655b393f, 12 variants × 2200 ticks -> identicalnode --testinmars/viewer/engine/test/on captured-hash, deadlock-recovery, deadlock, make-way-claims, make-way-detour-snapshot, make-way-wait, open-jam, paired-walk, people-grid-patch, social-resume, social, take-golden, vehicle-deadlock, walk-perf, walk-point-at, walk-settle-wait and walk -> 141 pass, 0 failnode --testinpackages/engine-mars/src/on runtime-policy-registry, cede-passage, concurrent-link-egress-policy, concurrent-link-egress, doorway-passing, item-approach-wait, make-way-detour-snapshot, shared-water-wait, stair-make-way, stall-release-support, wait-bound and goal-wait-cycle -> 68 pass, 0 failtsc --noEmit -p mars/viewer,-p packages/engine-mars,-p apps/server-> cleannode tools/test-harness/walk/walk.mjs-> "walk: no place worse than the baseline" (the "better" places are main's, not this change: the audit is static navigation)node tools/changelog/compile.mjs --check-> valid;node .github/scripts/guards.mjs scrub --base origin/main-> 0 problemsconcurrent-link-egress.test.tsthrew (pointAt, reading 'length'). Fixed by requiring both of the pair to be on walk legs, asresolveFaceoffdoes underconcurrentLinkEgressV1. Before that, the step-aside also required the mover to be still (v < 0.02), but a body settling at its goal reads 0.05, so the goal-occupied side never qualified; the check was dropped (the record must still beblocked).mutualWaitsruns only inside a recovery request, and the cycle set is read from episodes that already exist. Where a cycle stands for 3 s, every action with a recovery hook gets its one attempt at 3 s instead of 10 s: walks, carries, and rides (recoverRide). TheSequenceRunner's "certified blocked" early stop, timed from that attempt, also comes 7 s sooner for cycles. A carry's gathering walkers share one walk exec under the carry's id, so they never step aside:stepAsideInCyclerequires the walk's own exec on both sides. Accepted trade-off: in one of the 7 variants with no bound end on main (8 m to 1.9 m, turned 1/3), the last arrival is 176 ticks later (816 against 640). A step aside resolved a cycle the crowd would have cleared by itself. Six of those seven variants end on the same tick as main.docs/mars/movement.md, "Persistent waits and bounded recovery".Changelog
changes/2596-goal-wait-cycle.mdRisk
Only worlds that adopt cycle-recover/1 change, from its rules event on; rollback is a later rules event setting it false. A walk in a two-body cycle now moves after 3 s, where before it stood until the bound. The move is the existing face-off detour, which entity worlds have used since October. It is snapshotted (make-way-detour-snapshot.test.ts passes), stepped by the walk itself, and guarded by the same body-step and intrusion checks. What could go wrong is a step aside into a crowd that blocks someone else. That would show up as a new person-wait, which gets its own recovery, never a stuck Soul. The 12-variant sweep is the scenario: it covers both goal-occupied cycles and face-offs. Old snapshots restore unchanged (
moverWaitshas the same shape).Outside Touches
docs/mars/movement.md: the recovery's description and the policy.packages/engine-mars/src/engine.ts: the policy flag, its state-hash input and the restore paths (cede-passage/1 pattern, 11 lines).apps/server/src/world.ts:enableCycleRecoverV1(3 lines).apps/server/src/edge-runtime-rules.ts: boot adoption after cede-passage/1 (3 lines).apps/server/src/edge-runtime-rules.test.ts: the boot-order indices shift by one, plus asserts for the new last rule (mechanical, 10 lines changed).These were added at the coordinator's review request.
Time
Started 12:19 UTC, PR opened 12:33, handed back 12:36 UTC. Review fixes ran 12:45 to 12:50 UTC. About 22 min of wall-clock work in total against a 3 h ceiling.
🤖 Generated with Claude Code
Coordinator sign-off (T3): two independent reviewer passes. The first requested
cycle-recover/1gating plus the carry and wording fixes. The delta re-check requested thestepAsidemover parameter. All are resolved: policy-off state-hash chains match main over 12 variants × 2200 ticks, and policy plumbing matches cede-passage/1 point for point. Clip waived: no clip kit on main shows a crowd at one spot; the jam sweep and walk gate are the evidence.