fix(R4-V5): moveto wedge - StopCompletely's missing animation dispatch orphaned pending_motions; + the P1 autonomous store family

Live bug (2026-07-03, user door test): a server MoveTo armed
(movingTo=True) but the local body never moved; the retail observer saw
ACE walk the server-side player to the door; the next local input
reasserted the stale position (rubber-band). Log evidence: the player's
pending_motions queue was non-empty on 92/94 MotionDone pops (remotes:
0/40) - MoveToManager's retail wait-for-anims gate
(BeginTurnToHeading's MotionsPending check) never opened.

ROOT CAUSE (found via a production-faithful repro test - the original
suite force-drained the queue, masking it): the R3 port MISIDENTIFIED
retail's StopCompletely_Internal body. It is NOT a physics velocity
zero - CPhysicsObj::StopCompletely_Internal (0x0050ead0) tailcalls
CPartArray::StopCompletelyInternal (0x00518890) which is
MotionTableManager::PerformMovement(type 5): an ANIMATION-side full
stop whose UNCONDITIONALLY-queued pending_animations entry is the
completable partner of the A9 pending_motions node
CMotionInterp::StopCompletely enqueues (raw @00527e90 between the
state writes and add_to_queue). Without the dispatch, every
StopCompletely (login/teleport SetPosition + every MoveToManager
PerformMovement head) left an orphan node with no completion - the
queue never drained at idle. (The R3 code comment claimed a register
row for the stand-in; none was ever added - porting the real mechanism
closes that violation without a row.)

Fix set (all retail-anchored):
- IInterpretedMotionSink gains StopCompletely() (default true = the
  null-sink posture); MotionTableDispatchSink routes it to the R2
  manager's already-ported type-5 op (StopObjectCompletely +
  Ready-sentinel entry) + TurnStopped for the ObservedOmega seam.
- MotionInterpreter.StopCompletely calls DefaultSink?.StopCompletely()
  at the exact retail slot (after the state writes, before
  add_to_queue); the immediate set_velocity(Zero) is kept as the
  documented physics-effect stand-in.
- PlayerMovementController ticks CheckForCompletedMotions after
  UseTime - retail's per-tick CPartArray::HandleMovement slot
  (0x00517d60 = MotionTableManager::UseTime = CheckForCompletedMotions
  tailcall, called every tick from UpdateObjectInternal @005159a4).
  NOTE: a first-cut per-tick apply_current_movement pump was tried and
  REVERTED - retail's apply callers are all event-driven (hold-key,
  HitGround/LeaveGround, ReportExhaustion), not per-tick; the remote
  block's per-tick apply is a pre-existing adaptation outside this
  fix's scope.
- The P1 autonomous-store family, completing the pin's port shape
  (the gate landed in V5; the STORE side was missing):
  (a) the unpack store (00509730: last_move_was_autonomous = wire
  byte) in the GameWindow player branch - local player only for now
  (remote interps have no WeenieObj, which A3 reads as IsThePlayer;
  storing a remote's autonomous byte would mis-route their per-tick
  apply onto the raw branch);
  (b) input edges store =1 at the controller edge block - retail's
  CPhysicsObj::DoMotion @00510030 / StopMotion @005100e0 /
  TakeControlFromServer @006b32f4 input-boundary stores;
  (c) section 2's per-frame velocity write now PRESERVES the flag
  (V5's first cut stamped it per frame, the wrong altitude - retail
  stores it at event boundaries only);
  (d) InstallSpeculativeTurnToTarget stores false (models the wire
  mt-6's unpack store; part of the AP-23 adaptation) so the
  event-driven applies (e.g. HitGround mid-moveto) route interpreted
  and cannot clobber the manager's dispatched motions with idle raw
  state.

Tests: new ServerMoveToPosition_ProductionCompletionFeed_WalksToArrival
drives the controller under the PRODUCTION completion feed
(sequencer.Advance -> MotionDoneTarget) instead of force-draining -
this is the test that reproduced the live wedge (queue stuck at the
two A9 Ready orphans) and now proves the drain. Existing cutover tests
mirror the wire-path autonomous store before PerformMovement. Full
suite green: 3,957.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-07-03 14:15:36 +02:00
parent b87726dc2c
commit c2dc1a889c
6 changed files with 201 additions and 12 deletions

View file

@ -56,6 +56,22 @@ public interface IInterpretedMotionSink
/// — retail's <c>CPhysicsObj::StopInterpretedMotion</c> also returns a
/// result that gates the post-stop <c>add_to_queue</c> + state-removal.</returns>
bool StopMotion(uint motion);
/// <summary>
/// R4-V5 wedge fix — retail <c>CPhysicsObj::StopCompletely_Internal</c>
/// (0x0050ead0) → <c>CPartArray::StopCompletelyInternal</c> (0x00518890)
/// → <c>MotionTableManager::PerformMovement(MovementStruct{type=5})</c>:
/// the ANIMATION-side full stop dispatched from the middle of
/// <c>CMotionInterp::StopCompletely</c> (raw @00527e90). The manager
/// queues its pending_animations entry UNCONDITIONALLY for type 5, and
/// that entry's AnimationDone → MotionDone is the matched pop for the A9
/// pending_motions node <c>StopCompletely</c> enqueues right after this
/// call — without it the A9 node is an orphan and <c>MotionsPending</c>
/// never drains at idle (the 2026-07-03 moveto wedge). Default
/// implementation returns <c>true</c> (the null-sink "no animation
/// backend" posture — bare tests and sink-less interps are unaffected).
/// </summary>
bool StopCompletely() => true;
}
/// <summary>

View file

@ -69,4 +69,21 @@ public sealed class MotionTableDispatchSink : IInterpretedMotionSink
uint result = _sequencer.PerformMovement(MotionTableMovement.StopInterpreted(motion, 1f));
return result == MotionTableManagerError.Success;
}
/// <summary>
/// R4-V5 wedge fix — retail <c>CPartArray::StopCompletelyInternal</c>
/// (0x00518890): <c>MotionTableManager::PerformMovement(type 5)</c>.
/// The manager stops everything and queues its Ready-sentinel
/// pending_animations entry UNCONDITIONALLY — the completable partner
/// of the interp's A9 pending_motions node. A full stop ends any turn
/// cycle, so the ObservedOmega seam is notified like
/// <see cref="StopMotion"/>'s turn-class branch.
/// </summary>
public bool StopCompletely()
{
TurnStopped?.Invoke();
uint result = _sequencer.PerformMovement(MotionTableMovement.StopCompletely());
return result == MotionTableManagerError.Success;
}
}

View file

@ -1221,7 +1221,28 @@ public sealed class MotionInterpreter : IMotionDoneSink
InterpretedState.SideStepCommand = 0;
InterpretedState.TurnCommand = 0;
// StopCompletely_Internal (0x0050f5a0) stand-in.
// StopCompletely_Internal — R4-V5 wedge-fix CORRECTION of the R3
// misread: retail's body (0x0050ead0, tailcall
// CPartArray::StopCompletelyInternal 0x00518890) is
// MotionTableManager::PerformMovement(type 5) through the ANIMATION
// stack — NOT a physics-side velocity zero (the "0x0050f5a0" the R3
// note cited is a different function's interior). The manager
// queues its type-5 pending_animations entry UNCONDITIONALLY, and
// that entry's AnimationDone → MotionDone is the matched pop for
// the A9 pending_motions node queued below. Without this dispatch
// every StopCompletely (login/teleport SetPosition + every
// MoveToManager PerformMovement head) left an orphan node,
// MotionsPending never drained at idle, and BeginTurnToHeading's
// wait-for-anims gate wedged every armed moveto (the 2026-07-03
// live door bug — server walked the player, the local body never
// moved, rubber-band on the next input).
DefaultSink?.StopCompletely();
// Immediate velocity zero: kept from the R3 stand-in. Retail
// reaches zero through the Ready state's next velocity apply;
// acdream's controller altitude performs that apply in its grounded
// section-2 write, so the immediate zero preserves the established
// teleport/stop behavior for same-frame readers.
PhysicsObj.set_velocity(Vector3.Zero);
AddToQueue(contextId: 0, MotionCommand.Ready, (uint)jumpSnapshot);