Skip to content

fix(firmware): don't judge a pending update on a reconnect before reset - #35

Merged
reubenmiller merged 1 commit into
mainfrom
fix/firmware-reconnect-during-update
Nov 19, 2026
Merged

reubenmiller merged 1 commit into
mainfrom
fix/firmware-reconnect-during-update

Conversation

@reubenmiller

Copy link
Copy Markdown
Contributor

Found while testing #34 on an ESP32-C6 (NuttX).

Problem

tedge_fw_on_connected() runs on every session start. In one of 20 test installs, the MQTT session timed out during the download and reconnected just after the download thread had written the pending marker, before the reset:

01:42:00.054 firmware: 1341512 B written in 75 s
01:42:00.074 connected to thin-edge-io.eu-latest.cumulocity.com:9883 ...
01:42:01.734 firmware: 0.17.1-dbg.4 did not come up; running 0.17.1-dbg.3
(reset; 0.17.1-dbg.4 boots and runs fine)

The old image was still running, so the check took the update for a rollback and cleared the marker. The new image booted with nothing to report, and the operation stayed EXECUTING.

Fix

tedge_fw_on_connected() returns early while job_running is set. The marker belongs to the update still in progress on this boot, and the next boot judges it.

Testing

  • The POSIX port builds with -Werror, and its tests pass.
  • Not reproduced on a device yet: hitting it needs a reconnect in a window of about 1.5 s.

🤖 Generated with Claude Code

tedge_fw_on_connected() runs on every session start. If the MQTT session
dropped and came back after the download had written the marker but
before the reset, the old image was still running, so the check read the
update as rolled back, reported it, and cleared the marker. The new image
then booted with nothing to report, and the operation stayed EXECUTING.

Skip the check while this boot's own update is running.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@reubenmiller
reubenmiller merged commit 34907f0 into main Nov 19, 2026
20 checks passed
@reubenmiller
reubenmiller deleted the fix/firmware-reconnect-during-update branch November 19, 2026 03:34
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