Skip to content

fix(focus): keep the focus watcher alive through query errors - #179

Merged
jonocodes merged 1 commit into
mainfrom
debug/context-aware-switcher-home-only
Oct 9, 2026
Merged

jonocodes merged 1 commit into
mainfrom
debug/context-aware-switcher-home-only

Conversation

@jonocodes

Copy link
Copy Markdown
Owner

Problem

Context-aware deck switching silently stopped: every client stayed on the Home deck even with Firefox focused.

The daemon started at login before the GNOME extension owned org.deckd.Focus. Its first poll got ServiceUnknown: The name is not activatable, the exception escaped PlatformBackend.watch_active_app, and the focus watcher task ended. The process stayed up and /diag still reported started_ok: true, so neither systemd nor diagnostics flagged it.

Fix

  • watch_active_app catches query errors. It logs the first failure of a streak, retries on every poll, and logs when it recovers. Any transient error (gdbus timeout, gnome-shell restart, extension reload) is now survivable.
  • The /diag focus block gains:
    • healthy: backend started, watcher task alive, and the last poll succeeded. null when focus is disabled.
    • query_error: the current failure.
  • Docs: added a 'Deck stuck on Home?' note in GUIDE § Focus watcher and documented the new fields in the REFERENCE /diag row.

Tests

  • test_watch_active_app_survives_transient_backend_errors: a regression test that reproduces the not-activatable startup race. It failed before the fix and passes after.
  • Five /diag focus-health cases: dead task, failing queries, backend start failure, healthy, and disabled.
  • Full pytest suite: 795 passed.

Verified live: after deploying, Firefox focus switches decks again.

A daemon started at login before the GNOME extension owned
org.deckd.Focus got ServiceUnknown on its first poll; the exception
escaped watch_active_app, ended the focus task, and pinned every
client to the Home deck until restart. started_ok stayed true, so
/diag hid it and systemd never restarted the process.

- watch_active_app logs the first failure of a streak, retries each
  poll, and logs recovery
- /diag focus block gains healthy (backend started, task alive, last
  poll ok) and query_error (current failure)
@jonocodes
jonocodes merged commit b79e0e6 into main Oct 9, 2026
4 checks passed
@jonocodes
jonocodes deleted the debug/context-aware-switcher-home-only branch October 9, 2026 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant