Skip to content

Drop a stale Wi-Fi failure once NetworkManager connects that network - #15367

Closed
aholbreich wants to merge 2 commits into
omacom:quattrofrom
aholbreich:fix-network-stale-failure
Closed

aholbreich wants to merge 2 commits into
omacom:quattrofrom
aholbreich:fix-network-stale-failure

Conversation

@aholbreich

Copy link
Copy Markdown
Contributor

Fixes #15341.

Problem. When a connect started from the network panel fails (e.g. ssid-not-found), the row shows the failure ("Network lost"). If NetworkManager later autoconnects that same network on its own, the row keeps the red failure text while the header shows it connected, until the network is clicked again or the shell restarts. Reopening the panel doesn't help.

Cause. failNetworkAction() stores failureSsid/failureReason. They are cleared only by a new panel action, by clearNetworkAction() (reached through checkActionCompletion(), which returns early when no action is in flight), or by failureTimer while the passphrase prompt is open. statusText checks isFailed before isConnected, so the stale reason wins.

Fix. checkActionCompletion() drops the failure when the failed network reports connected, before its in-flight-action guard. It already runs for every network on refresh (panel open) and on the row's connected-state change, so no new wiring is needed.

Tests. New case in test/shell.d/network-test.sh runs the panel's own failNetworkAction, checkActionCompletion and clearNetworkAction against stand-in networks: the failure survives while another network is connected or the failed one is still down, and clears once it connects. It fails on quattro and passes with the fix. network-test.sh 124/124; the other network suites (password, captive portal, manager transition, QR) pass unchanged. The full ./test/shell suite was not run (the change is limited to checkActionCompletion()), and it was not tested against a live NetworkManager.

🤖 Generated with Claude Code

A failed connect from the network panel stores its reason on the row.
Only a new click, a panel-started action completing, or the passphrase
prompt timer cleared it, so when NetworkManager autoconnected the network
later the row kept showing "Network lost" over "Connected".

checkActionCompletion() now drops the failure when the failed network
reports connected, before its in-flight-action guard. It runs for every
network on refresh and on the row's connected-state change, so reopening
the panel or a live reconnect both clear it.

Fixes omacom#15341

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot omarchybot added the bug Something isn't working label Oct 17, 2026
checkActionCompletion now drops any failure on a connected network, but refresh() runs it straight after actionTimeout records "Timed out disconnecting" or "Timed out forgetting" on a network that is still connected, so those were cleared before they were drawn. Record which action failed and clear only a failed connect.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Oct 17, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Thanks for this, Alexander. I reviewed it and ran it on a worker built from the Omarchy ISO, with the shell running from this branch.

The bug is real, and this fixes it. I wrote my own check that runs the panel's own failNetworkAction and checkActionCompletion. A failed connect followed by NetworkManager connecting that network keeps "Network lost" on quattro, and clears with this branch. Your new test fails against quattro's Panel.qml and passes here.

One regression, which I fixed and pushed as 1cb81c8. refresh() calls syncWifiNetworks() synchronously, and that calls checkActionCompletion for every network. So when actionTimeout recorded "Timed out disconnecting" or "Timed out forgetting" on a network that was still connected, the new block cleared it during that same refresh(), before the row ever drew it. The commit adds failureKind, which records which action failed (set in failNetworkAction and in the timeout handler), and limits the clear to a failed connect. It also adds a case to your test. The test fails again with either change reverted.

Tests on the worker: ./test/cli passes. All seven network-* suites pass (network-test.sh 126/126). The full test/shell.d run has 11 failing files outside the network panel (ascii, menu-guards, plugin-validate, webapp-install and others), and every one of them fails the same way on this branch's base commit, so this change didn't cause them. The branch still merges cleanly into current quattro.

Second opinion: Codex Medium reviewed the branch at 1cb81c8 and found no defects. It agreed that the failureKind guard is needed and proportionate, and it confirmed that reopening the panel clears the failure through refresh(true). Its independence from my review isn't guaranteed. It pointed out that the test stubs refresh(), so it doesn't exercise the reopen path end to end.

Fixes #15341, which is already linked. This is now waiting on the maintainer. The unrelated shell test failures are the one thing keeping it from being marked ready.

@omarchybot omarchybot removed the verified Omarchy Triage has verified that this issue is ready for final review label Oct 17, 2026
@greptile-apps

greptile-apps Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge.

Summary

Clears an old Wi-Fi connection failure when NetworkManager later connects that network.

  • The Wi-Fi row clears a failed-connect message when that network connects.

Reviews (1) · Last reviewed commit: "Keep a timed-out disconnect or forget on..." · Reviewed by Greptile

dhh pushed a commit that referenced this pull request Nov 13, 2026
* Keep Wi-Fi rows in step with NetworkManager

The rows are primitive snapshots, rebuilt only when the list of networks changes, when the panel opens, or when one of its own actions completes. A listed network that connects, drops, is saved or is forgotten by anything else -- autoconnect, nmcli, another settings tool -- changes state without changing the list, so the rows kept showing the old state until the panel was reopened: a dropped network still "Connected", a connected one under Other Networks, a saved one asking for its password, a forgotten one under Known Networks.

The panel now binds a key over every listed network's state at the root and rebuilds the rows when it changes. Bound at the root, it also sees networks that have no delegate, so it replaces the per-row completion handlers, which missed rows scrolled out of view and everything while the panel was closed. The rebuild leaves identical rows in place, since a new model takes focus from a passphrase being typed, and keeps the cursor on its network through the re-sort. An action whose outcome already holds settles at once, where it used to wait for a change that never came and time out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Track the enterprise reconnect, and follow a hidden row

The immediate settle exists because Quickshell ignores connect() on a connected network and disconnect() on a disconnected one, so those calls can never signal. The enterprise script is different: it creates a profile and brings it up even when the network is already connected, so settling at once would drop its busy state and the failure it may report.

The cursor marked "no row" with "", which is also a hidden network's SSID, so a selected hidden row was left behind when the list re-sorted. It now uses null.

The fixture now drives a disconnect that completes only once stateChanging clears, which is the only thing keeping stateChanging in the key, and checks the in-flight connect is the one it started.

Co-Authored-By: Codex Medium <noreply@openai.com>
Co-Authored-By: Muse Wonder High <noreply@meta.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Drop a failed connect's reason once NetworkManager connects that network

A panel connect that fails or times out leaves its reason on the row. When NetworkManager later connects that network on its own -- the access point comes back, the radio returns -- no action is in flight, so nothing cleared it, and the row read "Timed out connecting" or "Network lost" under a connected header. checkActionCompletion now drops the failure once the network that failed reports connected, before its in-flight guard, and only for a failed connect, since a timed-out disconnect leaves the network connected. The root state key makes it run whenever that network's connected flag changes.

This is the fix proposed in #15367.

Co-Authored-By: Alexander Holbreich <16252784+aholbreich@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Settle before acting, and clear a failure only once its network settles

An action whose network is already in the asked-for state now settles before its call is made instead of after. For connect(), connectWithPsk() and disconnect() nothing changes, since Quickshell ignores those calls then. For the enterprise script it does: it creates a profile and brings it up, so started against a live connection it would run untracked once the next rebuild saw the old link still connected, and a failure of it would be erased by that same link.

The failure clear now waits for the network to stop changing state, as the disconnect and forget checks already do, so a connection that is still coming up and then fails does not take the explanation with it. It also closes a passphrase reprompt opened for that network, which would otherwise sit open over a connected row.

Co-Authored-By: Codex Medium <noreply@openai.com>
Co-Authored-By: Muse Wonder High <noreply@meta.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Close only the completed network's passphrase prompt

A connect that settles closed whatever prompt was open. Now that a connect to an already-connected network settles before anything is asked, a stale row clicked while another network's prompt is open would throw away the passphrase being typed there.

Co-Authored-By: Muse Wonder High <noreply@meta.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Close a passphrase prompt once its network connects, error or not

The prompt was closed only from the failure clear, which needs the failure text. The row's failureTimer clears that text two seconds into a reprompt, so a reconnect after that left the prompt open over the connected network, as did one with no failure behind it at all. A prompt only opens for a network that is not connected, so once that network is connected and settled there is nothing left to ask.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Omarchybot <317366263+omarchybot@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Codex Medium <noreply@openai.com>
Co-authored-by: Muse Wonder High <noreply@meta.com>
Co-authored-by: Alexander Holbreich <16252784+aholbreich@users.noreply.github.com>
@aholbreich

Copy link
Copy Markdown
Contributor Author

Closing as superseded by #18702, which carries this failure clear on top of its root-level row rebuild and merged in 8b6ce31 (#15341 is closed). Thanks for folding it in with credit.

@aholbreich aholbreich closed this Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Network panel: Wi-Fi row keeps showing "Network lost" after NetworkManager reconnects on its own

2 participants