Skip to content

refactor: remove redundant type casts in agent-session and browser tool#3321

Open
oldschoola wants to merge 1 commit into
can1357:mainfrom
oldschoola:refactor/remove-redundant-casts-agent-session-browser
Open

refactor: remove redundant type casts in agent-session and browser tool#3321
oldschoola wants to merge 1 commit into
can1357:mainfrom
oldschoola:refactor/remove-redundant-casts-agent-session-browser

Conversation

@oldschoola

Copy link
Copy Markdown
Contributor

Problem

Three redundant as boolean casts on settings.get() return values. SettingValue<P> already resolves to boolean for these paths (they have type: "boolean" with a non-undefined default in the schema).

Changes

  • agent-session.ts:1737settings.get("advisor.enabled") as booleansettings.get("advisor.enabled")
  • browser.ts:84settings.get("browser.cmux") as boolean | undefinedsettings.get("browser.cmux") (the | undefined was also wrong — the type is boolean, not boolean | undefined)
  • browser.ts:89settings.get("browser.headless") as booleansettings.get("browser.headless")

Companion to #3320 which removed 16 redundant casts from builtin-registry.ts.

Tests

  • bun check passes (all 16 packages)
  • Pre-existing test failures (39) are identical on clean main — environment-specific (gh CLI, SQLite, etc.)

@github-actions github-actions Bot added the vouched Passed the vouch gate label Jun 23, 2026
@oldschoola oldschoola force-pushed the refactor/remove-redundant-casts-agent-session-browser branch from f9db676 to a898dd0 Compare June 23, 2026 14:41
@roboomp roboomp added agent Agent runtime planning and orchestration refactor review:p0 tool Tool behavior and integrations triaged labels Jun 23, 2026

@roboomp roboomp left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@oldschoola oldschoola force-pushed the refactor/remove-redundant-casts-agent-session-browser branch from a898dd0 to 7e5b56e Compare June 23, 2026 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Agent runtime planning and orchestration refactor review:p0 tool Tool behavior and integrations triaged vouched Passed the vouch gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants