Skip to content

[Bug]: Global Defender priority inversion in _update_agent_status bypasses detection on goal step #483

Closed

Description

@verovaleros

Bug Description

In netsecgame/game/coordinator.py, _update_agent_status checks goal_check before is_detected using if/elif, so a goal-reaching step short-circuits detection evaluation.

Current logic (netsecgame/game/coordinator.py:787-793):

if self.goal_check(agent):
    next_status = AgentStatus.Success
elif self.is_detected(agent):
    next_status = AgentStatus.Fail

Because detection is in an elif, detection is skipped whenever goal_check(agent) is True.

This conflicts with documented behavior in README.md:229:

If the attacker does a successful action in the same step that the defender successfully detects the action, the priority goes to the defender. The reward is a penalty, and the game ends.

Impact:

  • Attacker can receive Success on a step where defender detection should cause Fail.
  • Reward signal is inconsistent with documented rules.
  • Global defender effectiveness is reduced on the most critical (goal) step.

Steps to Reproduce

  1. Start the NetSecGame server with use_global_defender: True in task configuration.
  2. Connect an attacker agent.
  3. Reach a state where one action completes attacker goal.
  4. Send the goal-completing action.
  5. Observe _update_agent_status returns AgentStatus.Success when goal_check(agent) is true, without evaluating is_detected(agent).

Expected Behavior

Detection must have priority over goal completion when both are true in the same step.

For example:

if self.is_detected(agent):
    next_status = AgentStatus.Fail
elif self.goal_check(agent):
    next_status = AgentStatus.Success
elif self.is_timeout(agent):
    next_status = AgentStatus.TimeoutReached

Version

0.1.0

Installation / Deployment Method

Running locally from source

Activity

  1. added
    bug
    on Mar 6, 2026
  2. verovaleros commented on Mar 6, 2026

    @verovaleros
    MemberAuthor

    Originally reported by @jsvobo.

  3. added
    documentation
    on Mar 7, 2026
  4. ondrej-lukas commented on Mar 7, 2026

    @ondrej-lukas
    Member

    This behavior is intended. README needs to be fixed to correspond with the code functionality

  5. linked a pull request that will close this issueOndra update docs #494on Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugdocumentation

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions