opencode
opencode copied to clipboard
fix(tui): add null safety for local.agent.current().name (#8858)
What does this PR do?
Fixes #8858 - Prevents crash when local.agent.current() returns undefined. Problem: The TUI crashed with:
TypeError: undefined is not an object (evaluating 'local.agent.current().name') This happens when the agent state hasn't been initialized yet (e.g., during startup or when no agents are available).
How did you verify your code works?
- local.agent.current().name
- local.agent.current()?.name ?? "build"
- Code review confirmed all 7 usages of local.agent.current().name now have null safety
- The fallback value "build" matches the default agent name used elsewhere in the codebase
- Verified the fix pattern is consistent with other null safety fixes in the codebase