Skip to content

Clear a host-offline answer error once the thread's host reconnects - #4456

Merged
ymichael merged 1 commit into
mainfrom
bb/clear-stale-host-offline-answer-error
Sep 28, 2026
Merged

ymichael merged 1 commit into
mainfrom
bb/clear-stale-host-offline-answer-error

Conversation

@ymichael

@ymichael ymichael commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Answering an approval, plan review or question while the thread's host is offline fails with host_unavailable, and the card shows "Failed to submit response. Host is offline." That message is the React Query mutation's last error (useResolveThreadPendingInteraction), which only changes on the next submit. So after the host reconnected, the card kept saying the host was offline even though the interaction could be answered again. Since #4271 an interaction survives a host outage instead of being cancelled, so this stale message is now the normal path after answering during a drop.

What changed

  • apps/app/src/hooks/mutations/thread-interaction-mutations.ts: useResolveThreadPendingInteraction(threadId) looks up the thread's host (thread → environment → host list, all cached queries the thread view already uses) and hides a host-offline error once that host shows connected. Any other error, or a new attempt that fails, is shown as before.
  • apps/app/src/lib/lifecycle-errors.ts: isHostDisconnectedError recognises the host_unavailable / disconnected API error.
  • Callers pass their threadId: the approval and plan-review card (ThreadPendingInteractionBanner.tsx) and the question form (UserQuestionInteractionContent.tsx), which all use this one hook.

No wire, CLI or server change.

How you verified

  • New thread-interaction-mutations.test.tsx: an answer fails with the host-offline error while the thread's host is disconnected; once the host list shows it connected the error is gone. It fails without the change (expected HttpError: HTTP 502: Host is not connected … to be null).
  • pnpm exec turbo run typecheck lint test --filter=...[origin/main].
  • Same scripted flow on main (1efad32226): after reconnecting, the card still said "Host is offline." until the next click.
  • Live on pnpm start:worktree at this head, with a real Codex approval on a disposable second host reached through a TCP proxy: "Allow once" while the host was offline showed the error; 5s after reconnecting the error was gone and the button still there; "Allow once" again ran the command and the agent replied approved-done. Plan reviews and questions share the code path and the unit test, but were not driven live.

AGENT GENERATED

Answering an approval, plan review or question while the thread's host
was offline showed "Failed to submit response. Host is offline." The
message came from the last submit attempt, so it stayed after the host
came back, although the interaction could be answered again.

The error is now hidden once the thread's host shows connected; a new
attempt that fails shows its own error as before.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@ymichael
ymichael merged commit 683195e into main Sep 28, 2026
18 checks passed
@ymichael
ymichael deleted the bb/clear-stale-host-offline-answer-error branch September 28, 2026 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant