Commit be7e11d
[fix] Retry pending report_status instead of forcing re-download #251
When report_status fails after a configuration apply (e.g. due to a
transient HTTP 502 from the controller), the agent previously deleted
the local checksum files to trigger a full re-download on the next
cycle. That worked but wasted bandwidth and caused the controller to
stay stuck on "modified" until the next real config change.
Instead persist the unreported status in a pending_report marker file
and retry just report_status on the next polling cycle.
Key details addressed from the review:
- Define retry_pending_report as a shell function so "local" is valid
on BusyBox ash, where "local" outside a function is a parse error
that silently crashes the script mid-loop.
- Persist the marker BEFORE calling retry_with_backoff report_status
so a crash or reboot between the retry attempt and the
PENDING_REPORT write does not lose the status.
- Validate the marker contents against the known-good status set
(applied/error) and discard a malformed marker rather than
retrying forever.
- Only remove the marker after a successful report_status.
Closes #251
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 1f8beaa commit be7e11d
2 files changed
Lines changed: 57 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
8 | 13 | | |
9 | 14 | | |
10 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
| 203 | + | |
203 | 204 | | |
204 | 205 | | |
205 | 206 | | |
| |||
825 | 826 | | |
826 | 827 | | |
827 | 828 | | |
| 829 | + | |
828 | 830 | | |
829 | 831 | | |
830 | 832 | | |
| |||
833 | 835 | | |
834 | 836 | | |
835 | 837 | | |
836 | | - | |
| 838 | + | |
837 | 839 | | |
838 | | - | |
| 840 | + | |
839 | 841 | | |
840 | | - | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
841 | 849 | | |
842 | | - | |
843 | | - | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
844 | 856 | | |
845 | 857 | | |
846 | 858 | | |
| |||
977 | 989 | | |
978 | 990 | | |
979 | 991 | | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
980 | 1021 | | |
981 | 1022 | | |
982 | 1023 | | |
| |||
987 | 1028 | | |
988 | 1029 | | |
989 | 1030 | | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
990 | 1036 | | |
991 | 1037 | | |
992 | 1038 | | |
| |||
0 commit comments