Skip to content

requestCount is double-counted when the same remote IP appears in multiple /proc/net/tcp rows #12

Description

@Bug-Keeper

sandbox/src/monitor/networkMonitor.ts:190-194:

return {
  requestedIps: [...new Set(snapshots.requestedIps)].sort(),
  requestedHosts: [...new Set(snapshots.requestedHosts ?? [])].sort(),
  requestCount: snapshots.requestedIps.length,
  ...
};

requestedIps is deduped before being returned, but requestCount is taken from the raw (pre-dedup) array length. A single long-lived TCP connection that shows up as both an ESTABLISHED row and a TIME_WAIT row after a reconnect produces requestCount = 2 even though only one host was contacted. Downstream, this feeds result.requestCount which is then written on-chain as requestIpCount (AgentAuditRegistryV2 uses this as a reputation signal).

This makes the metric noisy and developer-unfriendly — two consecutive audits of an identical agent can produce different requestIpCount values purely based on TCP state timing.

Either:

  • requestCount: new Set(snapshots.requestedIps).size, or
  • rename the field to connectionCount and document the noise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions