Repository navigation
fix: stop a leftover connection test announcing after adding a gateway - #2438
Conversation
Follows up #2433. LostFocus on the URL box can fire after a successful save collapses the form; ScheduleConnectivityTest now returns unless the Add form is open. The debounce delay moves inside the try so its cancellation is observed. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
🦞👀 ClawSweeper review completeClawSweeper finished reviewing this revision. |
|
Codex review: passed. What this changesThe PR prevents connectivity tests from starting after the Add gateway form closes and catches cancellation during the debounce delay. Example: Save a gateway at ws://127.0.0.1:18789 while the URL box retains focus, then let the form collapse.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR fixes a concrete lifecycle gap still present on main, and no introduced correctness defect was found. Reviewed head: Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherConnectionPage receives URL edits, focus events and decoded setup URLs, schedules an HTTP connectivity probe, and presents its result through status text and a screen reader announcement. flowchart LR
A[URL or setup code input] --> B[ConnectionPage scheduler]
B --> C[Add gateway state check]
C --> D[Debounced HTTP probe]
D --> E[Result text]
E --> F[Screen reader announcement]
Technical reviewBest possible solution: Land the focused scheduler guard, discovery ordering correction and cancellation handling through the existing ConnectionPage lifecycle. Do we have a high-confidence way to reproduce the issue? Main's save-to-None transition and unguarded LostFocus scheduler establish the reported path in source, but actual WinUI focus ordering and a late spoken result were not reproduced. Is this the best way to solve the issue? The change fixes admission at the existing scheduler, preserves active-form callers and observes debounce cancellation without adding state, wrappers or a parallel owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3240ab1ddb31. Provenance checked
TestingProof path: unit tests only. SecurityNone. EvidenceWhat I checked:
Likely related people:
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall readiness starts with the lower of the proof and patch scores. It is capped at 3/6 if the fix is partial, the change offers little benefit, a product decision is still open, or the PR reverses an earlier decision without saying why. ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed December 1, 2026, 11:02 PM ET / December 2, 2026, 04:02 UTC. |
Re-checks the Add-form intent before announcing a probe result, and pins the discovered-gateway intent-before-URL order with a source test. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Move the Add gateway probe lifecycle into AddGatewayConnectivityTest so it can be tested without WinUI. Behavioral tests hold a request in flight through Stop and a form close, then release it and assert nothing is reported. Also stop the probe when switching to a saved gateway. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…nload - OnPageUnloaded uses StopConnectivityTest so stale text is cleared. - A failed /health fallback keeps the base non-2xx status, as before the extraction. - Stop rechecks cancellation before /health and disposes replaced token sources. - Tests: pre-buffered Stop fake, ordered save-path guards, base-status test, ledger row. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- Record the base error status and dispose the base response before awaiting /health, so a Stop during the fallback leaves nothing undisposed. - Test: base 503, /health held past Stop then 200, reports nothing and disposes the base. - Source guards: Stop clears and collapses the text; Save stop sits in the success branch. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Unloaded keeps the Add intent, so gate the test on IsLoaded too. Correct the ledger row: the base status is kept only when /health throws. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Hi, I'm a Copilot triage agent (not Scott) posting mounted-UI proof for head Setup: a disposable Windows Sandbox guest running the real Companion app built from this head, connected to the offline fixture Gateway. Portable NVDA 2026.3.1 (official installer, Authenticode signed by NV Access) ran with Speech Viewer and its I/O speech log. A small guest-only TCP listener on
Limits: NVDA's Speech Viewer and log show what NVDA was asked to speak, not audible speaker output. Cancel/Back and Save are not exercised here; those paths keep their unit and source-guard coverage. The screenshots and a 2-minute recording are kept as session artifacts. |
Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
3447f756e7d98b34d560a7f655e19502d8b3432e↑ Review findings fixed, each with a red/green check: Unloaded now clears the text, a failed /health keeps the base status, the Stop test uses pre-buffered content and fails if the final cancellation check is removed, and the save-path guards fail if Stop moves before the save await.
↑ Replaced token sources are disposed; Stop rechecks cancellation before sending /health.
↑ The base response is disposed before the /health await. A test holds /health past Stop and then returns 200: it fails on the previous head (base not disposed) and when the final guard is removed (a result is reported).
↑ Mounted run of this head in a Sandbox guest with NVDA Speech Viewer (evidence): leaving the page while a probe was held produced no result text, no /health request and no speech; a fresh edit after returning was spoken.
↓ Save and Cancel/Back were not run mounted; source guards and unit tests cover them. Speech Viewer text is not audible output.
↑ The test is also gated on IsLoaded, so a LostFocus after Unloaded cannot start one; the source guard fails without it.
↑ CI Gate green on this head after one rerun of an unrelated WSL Gateway restart E2E (Gateway state database held by its maintenance process).
↓ Reported by landing reviewers from source; not reproduced at runtime.
↓ No user report or trace of a late announcement in the field.
Follows up #2433. Related: #1946
What Problem This Solves
After a successful Save & connect on the Add gateway form, the URL box can still have focus. When the form closes, that box loses focus, starts one more connection test, and a screen reader then hears a stale "Cannot reach gateway" or similar result for a form that's already gone.
User Impact
User impact: screen reader users no longer hear a leftover connection-test result after adding a gateway.
Why This Change Was Made
The connection test is now only scheduled while the Add gateway form is open, and a test already running when the form closes no longer announces its result. The discovered-gateway "Add" button now marks the form as open before filling in the URL, so its test still runs. The connection-test lifecycle moved from the page into a small WinUI-free owner,
AddGatewayConnectivityTest, so it can be tested directly, and switching to a saved gateway now stops a pending test too.Evidence
.\build.ps1: all builds succeeded.SettingsManagerIsolationTests.OpenClawTrayDataDirRedirectsSettingsAwayFromRealAppData, which reads the real roaming profile).AddGatewayConnectivityTestTestsuses a fake HTTP handler that holds the request until released. It shows that a test stopped (Back/Save) or whose form closed while in flight reports nothing, that scheduling while the form is closed starts no request, and that an HttpClient timeout reports Unreachable. Red check: makingStop()a no-op fails the stop test, and removing the open-form gate fails the form-closed tests./healthfallback keeps the baseGateway responded with Nstatus as on main, and replaced token sources are disposed.BaseErrorStatusThenHealthFailure_ReportsTheBaseStatusand the Unloaded guard failed before the fix and pass after. Removing the final cancellation check fails the pre-buffered Stop test, and moving Stop before the save await fails the ordered save-path guard. Added a ledger row forAddGatewayConnectivityTestin docs/ARCHITECTURE.md. The base response is now disposed before the/healthawait;StoppedDuringHealthFallback_ShowsNothingAndDisposesTheBaseResponseholds/healthpast Stop, then returns 200, and asserts nothing is reported.Required proof pools
windows-winui-interactive: Add gateway connection-test announcements changed.