Separate GUI wait deadlines from RPC ownership and clear resolved uncertainty#22
Problem
Follow-up from the client deadline review of PR #21. A GUI patience deadline can expire while the service still owns a request and sends heartbeats. If the client discards its pending correlation or latches an uncertainty flag, a late terminal reply cannot resolve the operation, or later authoritative state can establish the outcome while the GUI continues blocking actions.
Terry reports that uncertainty conditions in the Android GUI remained latched even after real state synced. That Android behavior has not been independently traced in this review. Audit both Android and the CLI/TUI rather than assuming their implementations are identical.
Relevant code
pkg/tui/draft_helper.go: hard 10-second acknowledgement waits for temporary-leaf creation and admitted helper work; records creation/cleanup uncertainty.pkg/tui/inbox_actions.go: hard 10-second write acknowledgement wait. At PR #21 head38addad, uncertainty refuses subsequent changes for the leaf. A separate change in the current checkout removes that refusal; preserve it rather than treating the old latch as an unfixed current behavior.pkg/ezagentapi/rpc.go: ending a call on its context deadline removes pending correlation, so retaining a UI flag alone is insufficient for late-reply resolution.pkg/tui/completion.go: draft completion already separates its UI wait from the helper acknowledgement waiter, though the latter still has its own fixed limit.
Intended behavior
Separate UI responsiveness budgets, request ownership, connection liveness, and shutdown/cleanup limits. A UI timeout may stop a blocking presentation or enter a temporary unconfirmed state without abandoning the admitted request. While the connection remains live, retain correlation so the original late success or error can resolve the operation. Heartbeats indicate ownership, not proof of useful progress.
A relevant authoritative state sync must clear or supersede restrictions whose uncertainty it resolves. An unrelated refresh is not proof of a mutation's outcome. Late replies must resolve their original operation without overwriting newer user intent or restoring an old selection.
On disconnect, stop expecting a reply from the old connection and reconcile through authoritative state where possible. Do not automatically replay mutations, equate a missed acknowledgement with failure, or claim local cancellation rolled back remote work. Every remaining uncertainty-based restriction needs an explicit resolution path. Preserve bounded shutdown and cleanup behavior.
Acceptance coverage
- A UI deadline expires while matching heartbeats continue; the interface stays usable and the acknowledgement waiter remains owned.
- A late success or error resolves the original pending operation and clears its temporary uncertainty.
- Relevant state sync clears a stale restriction; unrelated sync does not falsely resolve an outcome.
- Late replies cannot overwrite newer actions or current selection.
- Disconnect and shutdown terminate ownership without replay or indefinite worker joins.
This is deferred follow-up work, not an expansion of PR #21. No implementation or wire-contract change is requested in the current task. Any future wire-contract change needs separate approval.
Agent signoff -- openai/gpt-6-astra