AutoId review fixes: tag before send, pack waits out combat, sweep retries

- The flight tag is registered BEFORE _requestId again, so a 0xC8 that AC puts on the
  wire inside the call is still tagged. EngineSend returns a token; a call that returns
  false or throws hands it to EngineSendFailed, which retires the entry (a no-op once it
  was matched, or when the slot now holds another id). FlightRecorderTests: a synchronous
  send is tagged, a failed send leaves no live entry, a retire for another id or a bad
  token is a no-op.
- Inventory sends wait (WaitCombat, kept, counted once) while a target is selected, a
  cast is in flight (CastGate.GetCastBusyState) or an attack runs
  (ClientActionGates.TryReadAttacking). Each 0xC8 raises AC's busy count, which plugins
  gate casts on. The selected target and an open container are not held; All mode is
  unchanged. combat= in the minute line, combat in /rc autoid status.
- The login sweep looks into containers only (ItemsCapacity > 0 in the PWD snapshot, the
  engine's own pack rule), skips a tick while the pending list is full, and is marked
  done only when nothing overflowed; otherwise it runs again once there is room.
- CollectOwnedIdsFromSnapshot has its doc comment back; HasPwdSnapshot and the new
  IsContainerInSnapshot have their own. LiveWorld's send is renamed QueueIdentify and
  block-bodied, so check_offthread_mutators.py scans it and its allow-list entry no
  longer also covers the create-path 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 8668f2a3ca
11 changed files with 224 additions and 50 deletions

View file

@ -419,6 +419,34 @@ internal static unsafe class Program
c.EngineSend(0, Corpse);
Out(c, Identify(Corpse));
Has(Last(c), "[cli]", "a send without a requester is not registered");
Eq(c.EngineSend(0, Corpse), -1, "no requester: no token");
// Registered before the call (CombatActionHooks.RequestId): a 0xC8 that AC sends
// synchronously, inside the call, is still tagged.
int sync = c.EngineSend((byte)IdRequester.AutoIdInventory, Corpse);
Out(c, Identify(Corpse));
Has(Last(c), "[eng:autoid-inventory] IdentifyObject 0x80068ACE", "a send made inside the call is tagged");
c.EngineSendFailed(sync, Corpse); // already matched: a no-op
Out(c, Identify(Corpse));
Has(Last(c), "[cli]", "a matched entry is not revived");
// The call returned false (or threw): its entry is retired, so a later 0xC8 for the
// same id is AC's or Decal's.
long foreignFail = c.IdentifyForeignTotal;
int failed = c.EngineSend((byte)IdRequester.AutoIdInventory, Corpse);
Check(failed >= 0, "a registration returns a token");
c.EngineSendFailed(failed, Corpse);
Out(c, Identify(Corpse));
Has(Last(c), "[cli]", "a failed send leaves no live entry");
Eq(c.IdentifyForeignTotal, foreignFail + 1, "and that 0xC8 counts as foreign");
// Retiring a token whose slot now holds another id leaves that entry alone.
int stale = c.EngineSend((byte)IdRequester.AutoIdTarget, Other);
c.EngineSendFailed(stale, Corpse);
c.EngineSendFailed(-1, Other);
c.EngineSendFailed(int.MaxValue, Other);
Out(c, Identify(Other));
Has(Last(c), "[eng:autoid-target]", "a retire for another id, or a bad token, is a no-op");
// 200 sends in a burst (a full RequestId queue drained at once) do not push out other
// engine calls (their own table), and every one of them is matched.