Skip to content

fix: preserve subtask output and refresh TUI session after provider auth#18429

Open
RhoninSeiei wants to merge 3 commits intoanomalyco:devfrom
RhoninSeiei:codex/fix-18423-18427
Open

fix: preserve subtask output and refresh TUI session after provider auth#18429
RhoninSeiei wants to merge 3 commits intoanomalyco:devfrom
RhoninSeiei:codex/fix-18423-18427

Conversation

@RhoninSeiei
Copy link

@RhoninSeiei RhoninSeiei commented Mar 20, 2026

Issue for this PR

Closes #18423
Closes #18427

Type of change

  • 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

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions bot added needs:compliance This means the issue will auto-close after 2 hours. needs:title labels Mar 20, 2026
@github-actions
Copy link
Contributor

Hey! Your PR title Fix empty subtask output and refresh TUI sessions after provider auth doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@github-actions github-actions bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Mar 20, 2026
@github-actions
Copy link
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@RhoninSeiei RhoninSeiei changed the title Fix empty subtask output and refresh TUI sessions after provider auth fix: preserve subtask output and refresh TUI session after provider auth Mar 20, 2026
@RhoninSeiei RhoninSeiei force-pushed the codex/fix-18423-18427 branch from 95b2e05 to 0bd2994 Compare March 21, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant