opencode icon indicating copy to clipboard operation
opencode copied to clipboard

fix(tui): add null safety for local.agent.current().name (#8858)

Open shoaibansari5398 opened this issue 18 hours ago • 1 comments

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"
  1. Code review confirmed all 7 usages of local.agent.current().name now have null safety
  2. The fallback value "build" matches the default agent name used elsewhere in the codebase
  3. Verified the fix pattern is consistent with other null safety fixes in the codebase

shoaibansari5398 avatar Jan 16 '26 13:01 shoaibansari5398