If a game lets you paint yourself into a corner so that you can no longer impact the game state, do you have agency? The obvious answer is that, no, you don't; if agency is defined as "the things I do matter", then being put into a situation where nothing you do matters by definition deprives you of agency.
Okay, but what if a game never lets you paint yourself into that corner: do you really have agency? I would argue that the answer to that is also no, because if there are no consequences for your mistakes, whatever agency you have is conscribed: guard rails to prevent you from driving off the cliff to your doom.
I'm not saying that's a bad thing necessarily. I'm rather fond of guard rails, stop signs, and other things that make driving safer. Here in Michigan some decades back folks noticed that left turns resulted in a lot of accidents, and we started doing a thing where we first turn right in order to turn left - if you hear people talking about "the Michigan left", that's what they're talking about - and it greatly reduced the number of accidents. I don't need to play Mad Max or Vanishing Point whenever I go grocery shopping; I don't want driving to be risky or exciting.
Games, though? Games, I kinda want to be able to put everything on the line. The only thing more exhilarating than making a ballsy move and having it pay off, is making a ballsy move and having it fail spectacularly. Let me take the risks, let me reap the rewards, and if I screw it up, then I own that. There was something one of the guys from Splotter said once, to the effect of, if you can't lose the game on the first turn, why play the first turn?
And that's all well and good in theory, but is less well and not so good when you actually do lose the game on that first turn. Because unlike a fool's mate, where the game ends with Qh4, in most modern board games you've got to sit there and stew in it while the rest of the game plays itself out. A game that, in essence, you're no longer a part of. In a two-hander, it's always possible to simply concede - this is something I explicitly advise players to do in the rules for Supply Lines of the American Revolution: The Northern Theater, 1775-1777 - but that's not really an option with more players, because while you've lost, they're still trying to figure out which one of them will win.
Which is all to say that there are risks to be mitigated and pitfalls to be avoided. Personally I tend to be more aggressive about letting players get into impossible corners in two-player games than at three-plus (for the reasons cited), and in shorter games more than long ones. It also depends on the audience. A game that's more overtly experimental is probably going to be more fragile and unforgiving than one of my hex-and-counter battle games, the latter of which is pitched at a more traditional wargaming audience that has less tolerance for my arty-farty nonsense. I tend to use random elements sparingly when making these sorts of games - I want players to own their failures and their successes, and not blame them on the dice - except when I really lean into it, like in This Guilty Land, where players are seeking to opportunistically capitalize on events over which they have limited control.
I began this little ditty with two questions - if you've painted yourself into a corner, do you have agency? and do you have agency if you can't paint yourself into a corner? - both of which were answered in the negative. And both those answers are true, because like so many things, it's not a binary, but a spectrum - a paradox that each designer has to grapple with anew for each game.