AutoId review fixes: login pack sweep, refused sends kept, flight tag after send

- The login pack was never appraised: at login the PWD snapshot is cold, so ownership
  reads miss, the item classified Unknown and was skipped at 2 s. Unknown now waits
  (WaitSnapshot) until the snapshot has entries or 120 s pass, and a one-shot sweep runs
  at LoginCompleteAtMs + 30 s (and again after a hot reload's MarkAlreadyComplete, which
  restamps login): the player's owned items plus each owned side pack, uncached ones
  added as inventory work. The 5/s inventory cap still applies.
- The drain moved into AutoIdDrain.cs, a pure unit behind IAutoIdWorld, so it runs
  against a fake world in EngineRobustnessTests (cold snapshot for N seconds, then every
  pack item is sent, none before login + 30 s, at most 5 per second).
- A refused EnqueueRequestId keeps the entry, is not counted as sent, ends the tick's
  sending and does not take the inventory rate slot. The priority target is re-armed on
  refusal.
- The flight tag is registered only after _requestId returns true; the pending table is
  256 (MaxRequestIdQueue); IdentifyTagging covers 200 registrations and 200 matches.
- The 4096 pending cap applies only in Limited mode; _incoming is bounded at 16384 while
  DrainTick returns early, dropping the oldest and counting them.
- 0x0022 InventoryPutObjInContainer is read in SmartBoxHooks.ParseGameEvent so it works
  with ServerMessageStream off; ServerMessageStream is back to its base text.
- check_offthread_mutators.py: the stale DrainPending allow-list entry is replaced by
  LiveWorld's Enqueue.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Daniel Wallace 2026-10-12 16:29:54 -07:00
commit c9bbafbfb4
14 changed files with 670 additions and 218 deletions

View file

@ -60,6 +60,13 @@ internal static class AutoIdPolicy
/// </summary>
public const long InventoryMinIntervalMs = 200;
/// <summary>
/// An object whose place is unknown because the object snapshot has not been filled yet
/// (at login the pack is created before ClientObjectHooks.PrefetchPositions starts) waits
/// for it this long at most before it is dropped.
/// </summary>
public const long UnknownMaxWaitMs = 120_000;
public enum Class
{
/// <summary>The selected target (the priority path).</summary>
@ -88,6 +95,8 @@ internal static class AutoIdPolicy
SkipFresh,
/// <summary>Inventory over its send rate (InventoryMinIntervalMs): keep it and ask again later.</summary>
WaitRate,
/// <summary>Place unknown and the object snapshot still empty: keep it (up to UnknownMaxWaitMs).</summary>
WaitSnapshot,
}
/// <summary>
@ -99,9 +108,11 @@ internal static class AutoIdPolicy
/// <paramref name="fresh"/>: its appraisal is cached and recent (Target, Container).
/// <paramref name="cached"/>: its appraisal is cached at all (Inventory).
/// <paramref name="inventoryRateOk"/>: Inventory only, the send rate allows one now (<see cref="InventoryRateAllows"/>).
/// <paramref name="snapshotWarm"/>: Unknown only, the object snapshot has been filled (an
/// object missing from a warm snapshot is not coming; one missing from a cold one may be).
/// </summary>
public static Verdict Decide(AutoIdMode mode, Class cls, long ageMs, bool inDefer, bool openedAfterSettle,
bool fresh, bool cached, bool inventoryRateOk = true)
bool fresh, bool cached, bool inventoryRateOk = true, bool snapshotWarm = true)
{
switch (mode)
{
@ -133,7 +144,10 @@ internal static class AutoIdPolicy
case Class.Unknown:
// Its place shows up in the snapshot within a tick or two; until it is
// MinAgeMs old it may still turn out to be in the open container or the pack.
return ageMs < MinAgeMs ? Verdict.WaitAge : Verdict.SkipMode;
// While the snapshot has never been filled (login), it waits for it.
if (ageMs < MinAgeMs) return Verdict.WaitAge;
if (!snapshotWarm && ageMs < UnknownMaxWaitMs) return Verdict.WaitSnapshot;
return Verdict.SkipMode;
default: // World
return Verdict.SkipMode;
}