Repository navigation
fix(ios): preserve first chat send during agent discovery - #159404
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 27, 2026, 2:02 AM ET / 06:02 UTC (Revision 5). ClawSweeper reviewWhat this changesThe branch captures an iOS chat draft before asynchronous sending, defers automatic agent discovery while the accepted turn is pending, and adds native regression coverage to CI. Merge readiness✅ Ready for maintainer review Current main still has the accepted-send race. The branch addresses a distinct failure left after the earlier typing fix, and the native evidence supports keeping it as the active fix. Priority: P1 Review scores
Verification
How this fits togetherThe iOS chat owner binds the composer to a shared chat model and a Gateway agent route. Draft text and discovered agent identity enter that handoff; sent messages and transcript rows come out of it. flowchart LR
A[Chat composer] --> B[Shared send model]
C[Gateway agent discovery] --> D[iOS chat owner]
B --> D
D --> E{Accepted turn pending}
E -->|Yes| F[Keep turn visible]
E -->|No| G[Apply discovered route]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +2, Config +1, Other +396. Total +399 across 6 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: An accepted send should retain its captured conversation and visible message through settlement, then adopt the discovered agent route; explicit account, session, and agent changes should still invalidate stale sends. Do we have a high-confidence way to reproduce the issue? Yes. The controlled native before capture shows the message left in the composer, and current main retains the asynchronous draft-capture path that permits the race. Is this the best way to solve the issue? Yes. The change repairs the existing send and iOS ownership handoff, with boundary tests for the context changes that must invalidate a pending send. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5e1a2cf4ea76. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
…59404) * fix(ios): preserve first chat send during agent discovery * test(ios): run send hydration regression in CI
What Problem This Solves
Fixes an iOS chat message remaining in the draft or disappearing when the app discovers its default agent during Send.
User Impact
An accepted message keeps its conversation and remains visible through reply completion. Switching accounts, sessions, or explicitly selected agents still invalidates the old send.
Why This Change Was Made
Reserve the draft before asynchronous work starts, and defer initial agent discovery until the accepted turn settles. The chat owner observes completion directly, so a fast send cannot leave discovery waiting for a SwiftUI redraw. The final change contains no investigation logging.
Evidence
025bdaa4d87b67a23a6ba1f0c95f40993d575198in 670.520s: fresh-install setup/relaunch and chat round-trip/control overview. This uses the real local Gateway and native app with a synthetic provider. No store upload is part of this verification.c83463b104bb739f03839811e719d04a7799e4f6(run36294543287), with no failed or pending checks.input.typeText()before the first Send. Its saved proof lacks XCTest’s specific typing error. This PR’s Send repair was not reached by that failure.Controlled native before/after
Both captures render the real chat tab with synthetic text and the same held-health/default-agent-discovery schedule. The probe enters text through the native input and invokes the composer resolver’s Send callback directly; the full release qualification above separately exercises the UI flow.
The model-choice hint in both captures comes from the minimal synthetic Gateway fixture. The capture probe and temporary diagnostic logging are excluded from this PR.