## Why
The Agents overview can go stale when Cloud threads change from another
client, especially when the TUI has no conversation stream attached.
## What changed
- Use Cloud stream notifications to update thread status and refresh the
thread list. Poll every 10 seconds while the overview is visible and
no stream is attached.
- Refresh the history already shown while preserving the `Show more`
cursor. Use fresh list metadata for thread names, recency, and unread
state, and restore rows when a refresh catches a missed unarchive.
## Testing
Cover Cloud inventory notifications, polling while detached, pagination
across refreshes, and recovery from a missed unarchive.
GitOrigin-RevId: 63c98438b6ddd2e47dd2d1f419c2a676508c6d91
## Why
A Cloud conversation can miss an entire turn while disconnected. A
successful reattach, even with an idle thread, cannot establish that the
client's history is complete.
## What changed
Add an app-server client operation that reattaches a disconnected,
loaded Cloud thread and returns its cached settings. The worker holds
the replacement stream so the caller can refresh turn and item history
before explicitly installing the stream and receiving buffered events.
Reattachment, recovery history reads, and stream installation share a
deadline and use the original Cloud sign-in and network permit. Dropping
the release handle cancels the replacement. Personal access token
sessions still reconnect by reopening the conversation.
## Testing
Extend Cloud connection tests to cover quiet and busy reattachments,
buffered event delivery, cancellation and retry, slow history reads,
and sign-in changes during recovery.
GitOrigin-RevId: a4e5cb967e097021596bc83aac2f8d1a95373712
## What changed
- Add `EnvironmentSelection` to start Cloud threads with either a saved environment ID or a project checkout in the default environment.
- Expose saved environment discovery through the authenticated Cloud request handle, rejecting results if the account changes.
- Thread environment selection through the app-server client and TUI session startup, and defer executor readiness for either explicit environment choice.
## Testing
Extend prewarm request tests to cover saved environment IDs and deferred readiness. Extend TUI session tests to verify saved environment routing without local working-directory or workspace-root overrides.
GitOrigin-RevId: 626cec9926dad8f1a89b1a3ee9e4470850ae6a76
## Why
Cloud stream failures previously used a generic reopen message even when the conversation was missing, access was denied, or sign-in had changed. Abandoned turn and item list requests could also keep the native worker occupied.
## What changed
- Report specific disconnect reasons for missing conversations, lost access, and changed or expired sign-in, including failures during idle reconnection.
- Report exhausted reconnect attempts and other nontransient recovery failures with dedicated messages.
- Cancel in-flight `ThreadTurnsList` and `ThreadItemsList` requests when their callers drop, matching `ThreadList` behavior.
## Testing
Add regression coverage for abandoned history reads, changed sign-in during accepted idle recovery, and access-denied stream errors.
GitOrigin-RevId: 29923b46c2d377f2247d699757553777a31d08ca
## Why
Opening another Cloud task can fail while loading its history. Keep the current chat, draft, and reply stream intact until the replacement is ready.
## What changed
- Prepare Cloud resumes with a scoped history handle and commit the attachment only after initial history hydration succeeds.
- Discard abandoned or failed preparations, reuse healthy existing attachments, and preserve buffered events through the handoff.
- Route Command Center task selections through the owning backend, including tasks found only in history search.
## Testing
Add regression coverage for failed history loading preserving the chat and draft, prepared stream handoffs and cancellation, backend routing, and history requests completing while a large reply stream remains unread.
GitOrigin-RevId: 67aab50bad4e9ce9216716da459fd5447f133ae1
## What changed
Handle `Ctrl+C` while preparing a Cloud session and before adopting its thread. Clear buffered draft input first; when no draft or modal handles cancellation, request shutdown and abandon the pending switch.
Cancel abandoned Cloud thread-start requests so they cannot replace the active attachment or block subsequent worker commands. Skip queued starts whose caller has already gone away without disturbing existing recovery.
## Testing
Add regression tests for quitting before thread adoption with pending and completed operations, clearing buffered draft input before quitting, and unblocking the Cloud worker after abandoning regular and project thread starts.
GitOrigin-RevId: 11e8cab13f00f4910a382094d5d857faf72a45bc
## Why
An in-flight `ThreadList` request can block the cloud worker from processing subsequent requests even after its caller drops it.
## What changed
Skip queued `ThreadList` requests whose response receiver is closed, and cancel in-flight list handling when the receiver closes. Thread listing has no conversation state to commit, so the worker can safely move on to the next command.
## Testing
Add a regression test that holds a list RPC open, drops the caller's request, and verifies that a subsequent `GetAccount` request completes before the list RPC is released.
GitOrigin-RevId: 7c74e3305d58b85224d9882ea7e24b1ae791ec52
## What changed
Handle `ThreadSetName` requests in the cloud backend through the cloud client's new `set_thread_name` method, without opening an attachment. Trim the requested name and reject empty names or thread IDs.
After the server acknowledges the rename, update the matching loaded thread's name and emit `ThreadNameUpdated`. Leave the cached name unchanged and emit no notification if the request fails.
## Testing
Add tests for the rename request payload, server acknowledgment and error handling, and preservation of the loaded thread's name when a rename fails.
GitOrigin-RevId: eecfe17a9cfba50c9fa9091a38a36c0011ab9246
## Why
A lost Cloud reply stream previously required reopening the conversation, even when it was idle. Recover the displayed conversation automatically while holding queued input until its reply stream is usable.
## What changed
- Add bounded retries for transient stream failures in the displayed, idle conversation, with credential and network-policy checks. Keep explicit reopen behavior when recovery is unavailable or fails.
- Enable HTTP/2 keepalive pings for Cloud connections.
- Queue input while disconnected and resume ordinary submission after recovery. Mark recovered history as potentially incomplete so an explicit reopen reloads missed turns while preserving drafts and reconciling pending submissions.
- Store retained input per backend and apply background settings updates to the owning backend's drafts.
## Testing
Add regression coverage for queued input during disconnection and extend resume and backend-handoff tests to cover history refresh, draft preservation, and retained settings.
GitOrigin-RevId: 3d753e53d3c0d594680a90cac8a75fe33b91e219
## What changed
- Add cloud archive and unarchive requests and support listing archived threads.
- Detach successfully archived threads and emit archive notifications. Report loaded cloud threads from live attachments rather than cached resume metadata, including after archive failures.
- Scope resume picker archive state and transcript previews by backend and thread so archiving a cloud session preserves a local session with the same ID.
- Limit cloud task archive cleanup to the selected thread, preserving child agents and their active session state, and update the confirmation text accordingly.
## Testing
Add regression coverage for archive acknowledgments, archived-thread discovery and restoration, attachment state after archive failures, same-ID sessions across backends, and preservation of attached child agents.
GitOrigin-RevId: bd155be85ee911375d4d326b18f9b5abe8e82b3d
## Why
A queued cloud stream disconnect can outlive a successful reopen of the same conversation, causing an obsolete reconnect error to reach the TUI.
## What changed
Represent cloud reply stream losses with `AppServerEvent::ThreadStreamDisconnected` and filter queued losses superseded by a successful attachment to the same thread. Preserve losses for other threads and any newer disconnects; failed reopen attempts do not supersede pending losses.
Continue displaying current stream disconnects through the TUI's error notification handler.
## Testing
Add regression coverage for successful and failed reopens, disconnect ordering across threads, and TUI handling of disconnect events from the active and foreign backends.
GitOrigin-RevId: 640332b817970717fc816ab5a32bf658c01233bf
## What changed
Expose `cloud_backend::connect` to adapt an authenticated `codex-cloud-client` client to `AppServerClient`. Support account reads, resuming a conversation by ID with saved settings, reading its metadata, listing the loaded thread, and unsubscribing.
Forward turn lifecycle events and agent message deltas, and track thread status from attachment notifications. Keep the previous attachment when a replacement fails, report stream disconnections, and reject turns without an active attachment. Unsupported requests and approval replies return explicit errors.
## Testing
Add tests covering failed attachment replacement, turn admission after disconnect, and thread status tracking across notifications and reattachment.
GitOrigin-RevId: 5a131e814d588cadeb9fb94513b99e92b47e3da4