Uh oh!
There was an error while loading. Please reload this page.
fix(tui): add null check for local.agent.current() - #8745
Conversation
…lity (anomalyco#8658) Co-authored-by: Mark Henderson <Mark.Henderson99@hotmail.com> Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
The `local.agent.current()` function can return undefined when no agents are available (empty agents list). This caused a TypeError when trying to access `.name` property on undefined. Fix by adding optional chaining and nullish coalescing for safe access: - `local.agent.current()?.name ?? "build"` for agent names - `local.agent.current()?.name ?? ""` for UI display Affected files: - packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx (6 locations) - packages/opencode/src/cli/cmd/tui/component/dialog-agent.tsx (1 location)
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate PRs FoundSeveral PRs address similar or overlapping issues with
Recommendation: Check if PR #8745 is addressing a newly discovered case or if it's duplicating work from earlier PRs, particularly #7920 (prompt-specific) or #7748/#7689 (general agent.current() handling). |
f1ae801 to
08fa7f7CompareClosing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR. |
fix(tui): add null check for local.agent.current()
The
local.agent.current()function can return undefined when no agents areavailable (empty agents list). This caused a TypeError when trying to access
.nameproperty on undefined.Fix by adding optional chaining and nullish coalescing for safe access:
local.agent.current()?.name ?? "build"for agent nameslocal.agent.current()?.name ?? ""for UI displayAffected files: