refactor: remove redundant type casts in agent-session and browser tool#3321
Open
oldschoola wants to merge 1 commit into
Open
Conversation
f9db676 to
a898dd0
Compare
roboomp
reviewed
Jun 23, 2026
roboomp
left a comment
Collaborator
There was a problem hiding this comment.
P0 — lgtm. The diff is tightly scoped to removing redundant Settings.get() casts, and the surrounding schema/types confirm advisor.enabled, browser.cmux, and browser.headless resolve to boolean.
No inline findings. The GitHub diff includes the packages/coding-agent/CHANGELOG.md entry under [Unreleased].
Thanks for the cleanup.
Three redundant 'as boolean' casts on settings.get() return values:
- agent-session.ts: settings.get('advisor.enabled') as boolean
- browser.ts: settings.get('browser.cmux') as boolean | undefined
- browser.ts: settings.get('browser.headless') as boolean
SettingValue<P> already resolves to boolean for these paths (they
have type: 'boolean' with a non-undefined default in the schema),
making the casts unnecessary.
a898dd0 to
7e5b56e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Three redundant
as booleancasts onsettings.get()return values.SettingValue<P>already resolves tobooleanfor these paths (they havetype: "boolean"with a non-undefineddefault in the schema).Changes
agent-session.ts:1737—settings.get("advisor.enabled") as boolean→settings.get("advisor.enabled")browser.ts:84—settings.get("browser.cmux") as boolean | undefined→settings.get("browser.cmux")(the| undefinedwas also wrong — the type isboolean, notboolean | undefined)browser.ts:89—settings.get("browser.headless") as boolean→settings.get("browser.headless")Companion to #3320 which removed 16 redundant casts from
builtin-registry.ts.Tests
bun checkpasses (all 16 packages)ghCLI, SQLite, etc.)