#18429 · @RhoninSeiei · opened Mar 20, 2026 at 6:58 PM UTC · last updated Mar 21, 2026 at 3:49 PM UTC
fix: preserve subtask output and refresh TUI session after provider auth
Score breakdown
Impact
Clarity
Urgency
Ease Of Review
Guidelines
Readiness
Size
Trust
Traction
Summary
This PR fixes two critical bugs: subagent output returning empty after tool calls, and TUI sessions failing to refresh after provider authentication, leading to blank message lists. It includes new regression tests for both issues.
Description
Issue for this PR
Closes #18423 Closes #18427
Type of change
- [x] Bug fix
- [ ] New feature
- [ ] Refactor / code improvement
- [ ] Documentation
What does this PR do?
task was returning the last text part from a subagent session even when that last part was empty, so the orchestrator could receive an empty <task_result> after a tool call. This change now prefers the last non-empty text part and only falls back to the literal last text part when every text part is empty.
The TUI provider auth dialog was also only calling sync.bootstrap() after OAuth or API key setup. In an active session, that left the session cache untouched and the message list could stay blank until leaving and reopening the session. This change adds a force option to TUI session sync and refreshes the current session immediately after provider auth succeeds.
How did you verify your code works?
- Added a regression test for subagent output selection in
test/tool/task.test.ts - Added a regression test for provider auth session refresh in
test/cli/tui/dialog-provider-refresh.test.ts - Ran
/tmp/bun-install/bun-linux-x64/bun test test/tool/task.test.ts test/cli/tui/dialog-provider-refresh.test.ts --timeout 30000 - Ran
/tmp/bun-install/bun-linux-x64/bun run typecheck - Ran
./node_modules/.bin/prettier --check packages/opencode/src/tool/task.ts packages/opencode/src/cli/cmd/tui/component/dialog-provider.tsx packages/opencode/src/cli/cmd/tui/component/dialog-provider-refresh.ts packages/opencode/src/cli/cmd/tui/context/sync.tsx packages/opencode/test/tool/task.test.ts packages/opencode/test/cli/tui/dialog-provider-refresh.test.ts - Push hook also ran
bun turbo typecheck
Screenshots / recordings
N/A. This TUI change updates session refresh behavior rather than terminal layout.
Checklist
- [x] I have tested my changes locally
- [x] I have not included unrelated changes in this PR
Linked Issues
#18423 Ollama subagent executes tool calls correctly but always returns empty text to orchestrator
View issue#18427 Issue: Oauth mid-session causes no messages or responses to display
View issueComments
No comments.
Changed Files
packages/app/src/components/dialog-connect-provider.tsx
+1−1packages/app/src/components/dialog-custom-provider.tsx
+1−1packages/opencode/src/cli/cmd/tui/component/dialog-provider-refresh.ts
+25−0packages/opencode/src/cli/cmd/tui/component/dialog-provider.tsx
+9−7packages/opencode/src/cli/cmd/tui/context/sync.tsx
+2−2packages/opencode/src/tool/task.ts
+2−1packages/opencode/test/cli/tui/dialog-provider-refresh.test.ts
+67−0packages/opencode/test/tool/task.test.ts
+83−1