Umm....you guys realise that "name" actors and filmmakers often visit the sets of other filmmakers and actors. It doesn't mean they have anything to do with the movie. Spike Lee was photographed hanging on the set of Spielberg's West Side Story. Pretty sure Lee was not working on the movie.
Unless it's a casting reported by the trades, it's more than likely Penn was just visting one of his BFF's Bradley Cooper, and maybe using that as an opportunity to angle PTA for a role in a future movie. He doesn't even look in period or character. He just looks like Sean Penn on a day out. He's one of the premier networkers in Hollywood (he organised that celebrity Fast Times At Ridgemont High table read last week), and his career is at a low enough point where he has to start making those connections count. I wouldn't be surprised at all though, if Penn get's announced for a role in Cooper's Bernstein.