Skip to content

fix(ipc): reset the state subscription's reconnect wait after a good connection - #740

Merged
ChuckBuilds merged 1 commit into
mainfrom
fix/ipc-subscription-backoff
Oct 4, 2026
Merged

ChuckBuilds merged 1 commit into
mainfrom
fix/ipc-subscription-backoff

Conversation

@ChuckBuilds

Copy link
Copy Markdown
Owner

Summary

The web's state subscription (StateSubscription._run, src/ipc/client.py, from #735) reset its reconnect wait only when _follow() returned normally. That happens only on stop(). Every real disconnect raises ControlError, so the wait kept doubling across connections. After successive display restarts the web resubscribed 1, 2, 4, 8, 16 and then 30 s later, permanently. Meanwhile it answered from one-shot state.get connections. The docs describe "1 s up to 30 s" per outage.

Fix: the wait goes back to the minimum once a connection got as far as storing a snapshot, whatever ended it. A display without the stream (unknown_command) is still retried at the slow interval.

The other #735 bug found in the same review, subscriber timestamps freezing so current-status answered mode: null after 2 minutes, is fixed separately by #737. This PR does not touch it, and it merges cleanly with #737.

Tests

  • New: TestReconnectBackoff (2, no socket needed, so they run on Windows too).
  • Mutation check: with main's client.py the reset test fails; it expected [1, 2, 4, 1, 1, 2] and got [1, 2, 4, 8, 16, 30].
  • test_ipc_state_stream.py + test_state_stream_readers.py: 70 passed, 11 skipped (AF_UNIX).

Part of a bug sweep

This is one of 10 independent fix PRs from one sweep, all based on main ef69201.

  • Merge order: any. 45 pairwise test merges gave 0 conflicts, and each PR also merges cleanly with fix(ipc): ticks carry the volatile timestamps, so current-status stays known over the socket #737.
  • CHANGELOG: each PR adds its bullet at a different place in Unreleased → Fixes, so squash-merging them one after another needs no conflict fixing.
  • Full suite (Windows), all 10 merged together vs plain main: the same 62 failures and 6 errors on both. These are the known Windows path and file-locking tests. 191 more tests pass.
    • One extra failure in that run, test_backup_manager.py::test_create_backup_contents (os.replace → WinError 5 on a temp zip), was a Windows file-lock flake. It passes on rerun, and nothing here touches create_backup.
  • ledpi: all 10 together ran on ledpi (Pi 4) on top of main, with a clean start and no errors or render stalls in the journal. ledpi is back on plain main.

🤖 Generated with Claude Code

…connection

StateSubscription._run reset its backoff only when _follow() returned
normally, which happens only on stop(). Every real disconnect raises
ControlError, so the wait kept doubling across connections: after
successive display restarts the web resubscribed 1, 2, 4, 8, 16 and then
30 s later for good, answering from one-shot state.get connections in the
meantime. The docs promise "1 s up to 30 s" per outage.

The wait now goes back to the minimum once a connection got as far as
storing a snapshot, whatever ended it. A display without the stream
(unknown_command) is still retried at the slow interval.

The frozen-timestamp bug found in the same review is fixed by #737.

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

coderabbitai Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 29 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c32296b5-edb7-49b2-8bbe-c56e97421a05
📥 Commits

Reviewing files that changed from the base of the PR and between ef69201 and 3d25ed2.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • src/ipc/client.py
  • test/test_ipc_state_stream.py
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@ChuckBuilds
ChuckBuilds merged commit 04f0d8d into main Oct 4, 2026
15 checks passed
@ChuckBuilds
ChuckBuilds deleted the fix/ipc-subscription-backoff branch October 4, 2026 02:18
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