ALL MATERIAL IS INLINE BELOW. Do NOT call any tools other than reading this one file; shell is denied.
You are the RED TEAM seat (Jenny, Gemini) re-checking NarrativeGMC PR-2e, which answers your previous red-team review and Muse's general review. Assume a malicious client and hostile multiplayer conditions. (1) For each of your 6 earlier findings, say whether the disposition below is correct; if you still dispute a rejection, give the exact code/engine evidence. (2) Attack the NEW code in pr2e.diff: SeedFactions/HasDefinition retry, bKeepPlayerFactionsOnUnPossess, empty-seed skip, solver RemoveAll, ensure-guarded dereferences, EnsureAggregator. For each finding: file:line, step-by-step attack, impact, severity, confidence, fix. Note: a diff hunk shows only nearby context; never infer that code is absent just because it is outside a hunk. End with exactly one line: VERDICT: PASS / PASS WITH FIXES / FAIL
===== standin-triage.md =====
Stand-in seats triage (PR-2e)¶
Grok is out of usage until 2026-10-29. Andrew approved Muse and Gemini as stand-ins, with one of them running red team.
| Seat | Model | Role | Artifact | Verdict |
|---|---|---|---|---|
| Susie (Muse) | Muse Spark (Muse Code 1.4.13) | general review | muse-standin.out |
PASS WITH FIXES |
| Jenny (Gemini) | gemini-3.8-flash-high (agy) | red team | gemini-redteam.out |
FAIL (2 of 6 findings real after verification) |
How the Gemini red-team seat ran:
- agy auto-denies shell tools in headless mode, and it does not read stdin.
- So the prompt and all material are inlined into redteam-inline.prompt.md (prompt, FIX_PLAN.md and full-fix.diff).
- The seat is told to read that one file with its file tool only. No --dangerously-skip-permissions, because review seats must not write.
Muse findings → disposition¶
| # | Finding | Disposition |
|---|---|---|
| 1 | checkf/check then dereference: null crash in Shipping |
Fixed. NarrativeGMCMovementComponent.cpp now uses if (ensureMsgf(...)) and NarrativeGMCPawn.cpp uses if (ensure(...)); ensure evaluates its condition in every build. |
| 2 | Pawn reuse: the UnPossessed snapshot seeds the next player's PlayerState | Fixed. New server-only SeedFactions holds pawn-authored defaults plus definition factions. PlayerStates are seeded from it and never from Factions. |
| 3 | Once-guard set even when no definition was assigned yet | Fixed. New virtual HasDefinition() (pawn: CharacterDefinition; NPC: NPCDefinition set, or Super). The guard stays open until a definition exists, so the next possession or BeginPlay applies it. Limit: if a player's PlayerState was already seeded before the definition arrived, it does not get the late definition factions, because PlayerState defaults apply once. |
| 4a | A duplicate aggregator was only detected by ensure, which is silent in Shipping |
Fixed. Now logged as UE_LOG(Error) in every build. The existing aggregator is not destroyed, since that is out of scope for this PR. Moving it into a single-owner subsystem is a follow-up. |
| 4b | "Full world scan" on every BeginPlay | Rejected. TActorIterator<AGMC_Aggregator> walks the class's object list (GetObjectsOfClass, UE 5.7 EngineUtils.h:191, checked on the gaming PC), not every actor, so the cost grows with the number of aggregators (about 1). |
| 4c | Context->GetWorld() not null-checked |
Fixed. Returns early when there is no Context or World. |
| 5 | ASC cached once, so hooks silently go dead if it is swapped | Deferred (minor). No caller swaps the ASC. Logged as a follow-up. |
| 6 | Solver dedup depends on order ([Base, Derived] gives two solvers) |
Fixed. A more-derived class now removes any base instance created earlier. |
| 7 | PlayerState Factions went from BlueprintReadWrite to ReadOnly, breaking Blueprints that set it |
Intentional. Client-side direct writes were the authority bug. Migration note: write through AddFaction/RemoveFaction/SetGenericTeamId on the server. |
Build receipt: gaming_build_pr2e.log (gaming PC, NGMCHostEditor Win64 Development).
Gemini red-team findings → disposition¶
| # | Finding | Disposition |
|---|---|---|
| 1 | Critical: PlayerState Factions/TeamId never registered for replication |
Rejected, false positive. NarrativeGMCPlayerState.cpp:60-61 has DOREPLIFETIME for both. Those lines are unchanged context, so they fall outside the diff hunk that ends at full-fix.diff:490, and the seat inferred they were absent. |
| 2 | Shared pawn hijack: possess and then leave a turret, vehicle or NPC, and the unpossess snapshot converts it to the player's team | Fixed. New bKeepPlayerFactionsOnUnPossess (EditDefaultsOnly), default true so a player's body or corpse keeps the player's factions. ANarrativeGMCNPCPawn sets it false; vehicle and turret classes should set it false too. |
| 3 | DoS from a full-world actor scan in EnsureAggregator |
Rejected. Same as Muse 4b: TActorIterator<T> iterates GetObjectsOfClass(T) (UE 5.7 EngineUtils.h:191). ++Existing advances only within aggregators. |
| 4 | World-time replicator lost on seamless travel because InitGame doesn't run |
Rejected. The UE 5.7 seamless travel handler calls LoadedWorld->InitializeActorsForPlay(PendingTravelURL, false) (World.cpp:8890), which calls AuthorityGameMode->InitGame(...) (World.cpp:5925), so the GameMode spawns the replicator again in the new world. |
| 5 | check/checkf crash on pawns without GMAS |
Fixed in this round (same as Muse 1). Now ensure-guarded, so no crash and no Shipping null dereference. |
| 6 | A lobby or spectator pawn with empty defaults uses up the PlayerState's one-time default application | Fixed. PossessedBy skips ApplyDefaultFactions when SeedFactions is empty. |
===== pr2e.diff ===== diff --git a/Source/GMCExtended/Private/Components/GMCE_OrganicMovementCmp.cpp b/Source/GMCExtended/Private/Components/GMCE_OrganicMovementCmp.cpp index f6025ce..5c9ce82 100644 --- a/Source/GMCExtended/Private/Components/GMCE_OrganicMovementCmp.cpp +++ b/Source/GMCExtended/Private/Components/GMCE_OrganicMovementCmp.cpp @@ -32,24 +32,31 @@ void UGMCE_OrganicMovementCmp::BeginPlay() // We do not allow abstract parent solvers to be instantiated. if (!SolverClass || SolverClass->HasAnyClassFlags(CLASS_Abstract)) continue;
// Make sure we don't have some version of this solver already instantiated, since you
// can set up instances of solvers in configuration as well.
const bool bAlreadyInstantiated = Solvers.ContainsByPredicate([&SolverClass](const UGMCE_BaseSolver* Solver)
{
return Solver && Solver->GetClass()->IsChildOf(SolverClass);
});
if (bAlreadyInstantiated)
continue;
+ + // A more-derived class supersedes a base instantiated earlier, so [Base, Derived] ends with one solver + // like [Derived, Base] does. + Solvers.RemoveAll(&SolverClass + { + return Solver && SolverClass->IsChildOf(Solver->GetClass()); + });
UGMCE_BaseSolver *NewBase = NewObject<UGMCE_BaseSolver>(this, SolverClass);
Solvers.Add(NewBase);
}
// Actually set up solvers.
for (const auto& Solver : Solvers)
{
Solver->SetupSolverInternal(this);
Solver->InitializeSolver();
}
diff --git a/Source/NarrativeGMC/Private/Character/NarrativeGMCMovementComponent.cpp b/Source/NarrativeGMC/Private/Character/NarrativeGMCMovementComponent.cpp index 9e01f22..68fcf0a 100644 --- a/Source/NarrativeGMC/Private/Character/NarrativeGMCMovementComponent.cpp +++ b/Source/NarrativeGMC/Private/Character/NarrativeGMCMovementComponent.cpp @@ -19,27 +19,31 @@ void UNarrativeGMCMovementComponent::BeginPlay() Super::BeginPlay(); }
// ============================================================ // GMC Replication Binding // ============================================================
void UNarrativeGMCMovementComponent::BindReplicationData_Implementation() { Super::BindReplicationData_Implementation();
AbilitySystemComponent = GetOwner()->FindComponentByClass<UGMC_AbilitySystemComponent>();
- checkf(AbilitySystemComponent, TEXT("NarrativeGMC movement requires a GMAS ability component."));
- AbilitySystemComponent->GMCMovementComponent = this;
- AbilitySystemComponent->BindReplicationData();
- // ensureMsgf still evaluates in Shipping (checkf does not), so a pawn missing the component skips GMAS binding
- // instead of dereferencing null.
- if (ensureMsgf(AbilitySystemComponent, TEXT("NarrativeGMC movement requires a GMAS ability component.")))
- {
- AbilitySystemComponent->GMCMovementComponent = this;
- AbilitySystemComponent->BindReplicationData();
-
}
// Bind sprint/slow walk flags for GMC prediction BindBool( bWantsSprint, EGMC_PredictionMode::ClientAuth_Input, EGMC_CombineMode::CombineIfUnchanged, EGMC_SimulationMode::PeriodicAndOnChange_Output, EGMC_InterpolationFunction::TargetValue );
BindBool( bWantsSlowWalk, diff --git a/Source/NarrativeGMC/Private/Character/NarrativeGMCPawn.cpp b/Source/NarrativeGMC/Private/Character/NarrativeGMCPawn.cpp index d8275ab..ef81f00 100644 --- a/Source/NarrativeGMC/Private/Character/NarrativeGMCPawn.cpp +++ b/Source/NarrativeGMC/Private/Character/NarrativeGMCPawn.cpp @@ -35,75 +35,102 @@ void ANarrativeGMCPawn::BeginPlay() }
void ANarrativeGMCPawn::PossessedBy(AController* NewController)
{
// Seed a player's PlayerState BEFORE Super: APawn::PossessedBy attaches the PlayerState and then fires
// ReceivePossessed / controller-changed notifications, which must already see the player's factions.
// Auto-possessing AI controllers possess during PostInitializeComponents, before BeginPlay; local defaults
// must exist before any possession callback sees this pawn.
InitLocalDefaultFactions();
if (HasAuthority() && NewController)
{
ANarrativeGMCPlayerState* PS = Cast
void ANarrativeGMCPawn::UnPossessed() { // After unpossession the getters fall back to this pawn's own state; snapshot the player's current factions // and team so a surviving pawn (or corpse) keeps them instead of reverting to stale defaults. - if (HasAuthority()) + if (HasAuthority() && bKeepPlayerFactionsOnUnPossess) { if (const ANarrativeGMCPlayerState* PS = GetFactionPlayerState()) { Factions = PS->GetFactions(); TeamId = PS->GetGenericTeamId(); } } Super::UnPossessed(); }
void ANarrativeGMCPawn::InitLocalDefaultFactions() { // Once per pawn, server only: later callback mutations and the UnPossessed snapshot must not be overwritten. - if (HasAuthority() && !bLocalDefaultFactionsApplied) + if (!HasAuthority() || bLocalDefaultFactionsApplied) { - Factions.AppendTags(GetDefinitionFactions()); - bLocalDefaultFactionsApplied = true; + return; } + if (!bSeedFactionsCaptured) + { + // First call precedes any possession, so Factions still holds only the pawn-authored defaults. + SeedFactions = Factions; + bSeedFactionsCaptured = true; + } + // No definition yet (spawn -> possess -> assign definition): leave the guard open so the next possession or + // BeginPlay applies it, instead of permanently recording an empty application. + if (!HasDefinition()) + { + return; + } + const FGameplayTagContainer DefinitionFactions = GetDefinitionFactions(); + Factions.AppendTags(DefinitionFactions); + SeedFactions.AppendTags(DefinitionFactions); + bLocalDefaultFactionsApplied = true; +} + +bool ANarrativeGMCPawn::HasDefinition() const +{ + return CharacterDefinition != nullptr; }
FGameplayTagContainer ANarrativeGMCPawn::GetDefinitionFactions() const { return CharacterDefinition ? CharacterDefinition->DefaultFactions : FGameplayTagContainer(); }
ANarrativeGMCPlayerState* ANarrativeGMCPawn::GetFactionPlayerState() const
{
// Only a human player's PlayerState owns faction state. AI controllers with bWantsPlayerState get a bot
// PlayerState (IsABot is replicated, so this holds on every client); those pawns keep pawn-owned state.
ANarrativeGMCPlayerState* PS = GetPlayerState
void ANarrativeGMCPawn::PostInitializeComponents() { // GMC binds replication data inside its PostInitializeComponents. Wire GMAS first. - check(AbilitySystemComponent && NarrativeGMCMovement); - AbilitySystemComponent->GMCMovementComponent = NarrativeGMCMovement; + // ensure, not check: the condition must still guard the dereference in Shipping. + if (ensure(AbilitySystemComponent && NarrativeGMCMovement)) + { + AbilitySystemComponent->GMCMovementComponent = NarrativeGMCMovement; + } Super::PostInitializeComponents(); }
void ANarrativeGMCPawn::GetLifetimeReplicatedProps(TArray
DOREPLIFETIME(ANarrativeGMCPawn, bIsDead);
DOREPLIFETIME(ANarrativeGMCPawn, TeamId);
DOREPLIFETIME(ANarrativeGMCPawn, OwnedGameplayTags);
DOREPLIFETIME(ANarrativeGMCPawn, CharacterDefinition);
DOREPLIFETIME(ANarrativeGMCPawn, Factions);
diff --git a/Source/NarrativeGMC/Private/Framework/NarrativeGMCNPCPawn.cpp b/Source/NarrativeGMC/Private/Framework/NarrativeGMCNPCPawn.cpp index 344d68e..322c218 100644 --- a/Source/NarrativeGMC/Private/Framework/NarrativeGMCNPCPawn.cpp +++ b/Source/NarrativeGMC/Private/Framework/NarrativeGMCNPCPawn.cpp @@ -1,37 +1,45 @@ #include "Framework/NarrativeGMCNPCPawn.h" #include "Items/InventoryComponent.h" #include "AI/NPCDefinition.h" #include "Net/UnrealNetwork.h"
ANarrativeGMCNPCPawn::ANarrativeGMCNPCPawn(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
// NPCs get a separate trading inventory
TradingInventoryComponent = CreateDefaultSubobject
void ANarrativeGMCNPCPawn::BeginPlay() { Super::BeginPlay(); }
UNPCDefinition* ANarrativeGMCNPCPawn::GetNPCDefinition() const { return NPCDefinition.Get(); }
FGameplayTagContainer ANarrativeGMCNPCPawn::GetDefinitionFactions() const { // Soft pointer: Get() is null until the asset is loaded, so load it before reading defaults. if (const UNPCDefinition* Definition = NPCDefinition.LoadSynchronous()) { return Definition->DefaultFactions; } return Super::GetDefinitionFactions(); }
+bool ANarrativeGMCNPCPawn::HasDefinition() const
+{
+ return !NPCDefinition.IsNull() || Super::HasDefinition();
+}
+
void ANarrativeGMCNPCPawn::GetLifetimeReplicatedProps(TArray
#include "Actors/GMCAggregator.h" #include "Engine/World.h" #include "EngineUtils.h"
namespace NarrativeGMC
{
// GMC's aggregator is local, not replicated. Create it before GMC BeginPlay
// registers controllers, pawns and movement components in each world.
inline void EnsureAggregator(UObject* Context)
{
- TActorIterator
/** Pawn-local factions: class defaults (plus the definition's) that seed a player's PlayerState on first
* possession, and the live factions of pawns with no player PlayerState (NPCs, unpossessed pawns).
* Read effective factions with GetEffectiveFactions(); mutate through the interface on the server. */
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Replicated, Category = "NarrativeGMC|Factions", meta = (Categories = "Narrative.Factions"))
FGameplayTagContainer Factions;
- /** On unpossession, keep the player's factions/team on this pawn (a player's body or corpse). Turn off for
-
- shared pawns (vehicles, turrets, NPCs) so a player cannot convert them by possessing and leaving. */
- UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "NarrativeGMC|Factions")
-
bool bKeepPlayerFactionsOnUnPossess = true; + virtual void PossessedBy(AController* NewController) override; virtual void UnPossessed() override;
/** Effective factions: the player's PlayerState while possessed by a player, otherwise this pawn's own. */ UFUNCTION(BlueprintPure, Category = "NarrativeGMC|Factions") FGameplayTagContainer GetEffectiveFactions() const { return GetFactions(); }
/** Effective team id (same ownership rule as GetEffectiveFactions). */ UFUNCTION(BlueprintPure, Category = "NarrativeGMC|Factions") uint8 GetEffectiveTeamId() const { return GetGenericTeamId().GetId(); }
// IAISightTargetInterface — deferred (API changed in 5.2+) @@ -172,21 +177,31 @@ protected: bool bIsDead;
UPROPERTY(Replicated, BlueprintReadOnly, Category = "NarrativeGMC|State") FGenericTeamId TeamId;
/** Gameplay tags granted to this pawn (queried by IGameplayTagAssetInterface). */ UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "NarrativeGMC|Tags") FGameplayTagContainer OwnedGameplayTags;
/** Default factions from this pawn's definition asset. NPC pawns override to read their NPCDefinition. */ virtual FGameplayTagContainer GetDefinitionFactions() const;
-
/** Whether a definition asset is assigned. Until one is, InitLocalDefaultFactions keeps retrying. */
-
virtual bool HasDefinition() const; + /** Server, once per pawn: add the definition factions to this pawn's own Factions. */ void InitLocalDefaultFactions();
-
/** Server-only: InitLocalDefaultFactions has run. */
-
/** Server-only: definition factions have been applied. */ bool bLocalDefaultFactionsApplied = false;
-
/** Server-only: pawn-authored defaults plus definition factions, seeding a player's PlayerState. Unlike
-
- Factions, never overwritten by the UnPossessed snapshot. */
- FGameplayTagContainer SeedFactions; +
- /** Server-only: SeedFactions holds the pawn-authored defaults. */
-
bool bSeedFactionsCaptured = false; + /** The NarrativeGMC PlayerState that owns this pawn's factions and team, or null for NPCs. / class ANarrativeGMCPlayerState GetFactionPlayerState() const; }; diff --git a/Source/NarrativeGMC/Public/Framework/NarrativeGMCNPCPawn.h b/Source/NarrativeGMC/Public/Framework/NarrativeGMCNPCPawn.h index 6145957..52f9094 100644 --- a/Source/NarrativeGMC/Public/Framework/NarrativeGMCNPCPawn.h +++ b/Source/NarrativeGMC/Public/Framework/NarrativeGMCNPCPawn.h @@ -37,17 +37,18 @@ public: // ============================================================ // Trading Inventory (separate from main inventory) // ============================================================
UFUNCTION(BlueprintPure, Category = "NarrativeGMC|NPC") UNarrativeInventoryComponent* GetTradingInventory() const { return TradingInventoryComponent; }
protected:
/** NPCs take default factions from NPCDefinition (as NarrativePro's NPC character does), falling back to
* CharacterDefinition when no NPCDefinition is set. */
virtual FGameplayTagContainer GetDefinitionFactions() const override;
-
virtual bool HasDefinition() const override;
/** Separate inventory for NPC trading/vendor functionality. */ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "NarrativeGMC|NPC") TObjectPtr
TradingInventoryComponent; };