What happens
When the TUI auto-syncs a session that references a subagent task whose own session has since been removed (deleted, cleaned up, or never persisted), the unhandled rejection from the 404 propagates and renders an error toast — or in some cases prevents the Task message from rendering at all.
Where
packages/opencode/src/cli/cmd/tui/routes/session/index.tsx — the auto-sync call in the Task message component fires sync.session.sync(props.metadata.sessionId) without handling the rejection.
Why this happens
Subagent sessions are ephemeral by design — they get GC'd, deleted, or never persisted depending on the agent's lifecycle. The parent session's Task message still references the subagent ID. When the TUI tries to fetch that ID, the backend returns 404.
Expected
The Task message renders without the subagent message preview. No error toast.
Repro
- Open a session that used the Task tool to delegate to a subagent
- Remove the subagent session (or let it GC)
- Reopen the parent session in the TUI
- Observe the error toast / missing render
Happy to submit a PR — fix is a one-line .catch(() => {}) plus a comment explaining the reasoning.
What happens
When the TUI auto-syncs a session that references a subagent task whose own session has since been removed (deleted, cleaned up, or never persisted), the unhandled rejection from the 404 propagates and renders an error toast — or in some cases prevents the Task message from rendering at all.
Where
packages/opencode/src/cli/cmd/tui/routes/session/index.tsx— the auto-sync call in the Task message component firessync.session.sync(props.metadata.sessionId)without handling the rejection.Why this happens
Subagent sessions are ephemeral by design — they get GC'd, deleted, or never persisted depending on the agent's lifecycle. The parent session's Task message still references the subagent ID. When the TUI tries to fetch that ID, the backend returns 404.
Expected
The Task message renders without the subagent message preview. No error toast.
Repro
Happy to submit a PR — fix is a one-line
.catch(() => {})plus a comment explaining the reasoning.