Skip to content

Document using bool args as an anti-pattern in AGENTS.md#6174

Merged
dom96 merged 2 commits intomainfrom
dominik/agents-strong-bool
Feb 25, 2026
Merged

Document using bool args as an anti-pattern in AGENTS.md#6174
dom96 merged 2 commits intomainfrom
dominik/agents-strong-bool

Conversation

@dom96
Copy link
Copy Markdown
Contributor

@dom96 dom96 commented Feb 25, 2026

No description provided.

@dom96 dom96 requested review from a team as code owners February 25, 2026 14:34
@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk bot commented Feb 25, 2026

LGTM

github run

Co-authored-by: Dan Lapid <dlapid@cloudflare.com>
@fhanau
Copy link
Copy Markdown
Contributor

fhanau commented Feb 25, 2026

Maybe it's just me but is this worded too strongly? I know we've introduced WD_STRONG_BOOL to avoid having consecutive boolean arguments, but never using them feels like it will be overkill. rg -w bool src/workerd returns 2537 results, if we're saying bool should never be used do we plan to prospectively convert all of them?

@fhanau
Copy link
Copy Markdown
Contributor

fhanau commented Feb 25, 2026

I guess another concern would be the agent taking issue with code changes to functions that use bool or moving code that uses bool – the agent could see bool being used and raise concerns even though the usage of bool is not increasing.

@dom96
Copy link
Copy Markdown
Contributor Author

dom96 commented Feb 25, 2026

I think never using them is fair, it's important we have strong typing in all cases. I don't think agents should touch existing code that uses bools unless you ask it to. If it does though then we can reconsider this prompt.

@dom96 dom96 merged commit 9775779 into main Feb 25, 2026
22 of 23 checks passed
@dom96 dom96 deleted the dominik/agents-strong-bool branch February 25, 2026 16:45
@harrishancock
Copy link
Copy Markdown
Collaborator

harrishancock commented Feb 25, 2026

Maybe it's just me but is this worded too strongly?

I agree, I suspect we'll need to relax it to something like, "you can use at most one bool parameter". But let's see how it goes.

I think my perfect world would be, "functions may have at most three parameters, and they must all be different types." That's about all my brain can handle. :)

Edit: Another little worry I have is that we don't (yet) support defining strong bools in class scope. So, any private helper function in a class would have to use a publicly-defined type. Not the end of the world, but also not great. I have a branch to relax this constraint but couldn't decide how strongly I felt at the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants