Repository navigation
Run the read action in its own process so a hung imsg-read cannot stall polling (#125 item 2) - #171
Merged
Merged
Conversation
…t stall polling (#125 item 2) WHAT: collect() used to call runReadAction (spawnSync, 180 s timeout) inline, so one hung Mac call held the collector process for up to three minutes and every poll, toast and refresh queued behind it in BarWidget. The due read intent is now started by startReadAction in a detached `collector.ts --read-worker` process. The collector writes read-action.json first (one action at a time, which also keeps Messages' process-global selection to one user), the worker only adds `done` to it, and the collector stays the SOLE writer of state.json, folding the result in with settleReadAction on the poll that started it or a later one. The starting poll waits up to BLIP_READ_GRACE_MS (default 5 s) so the common 1 to 3 s action still reports its outcome in the same poll, as before. WHY: #125 item 2. The attempt is still persisted BEFORE the action starts, a failed intent is never dropped, backoff is counted from when the action ended, a worker silent past 190 s counts as a failure, and a result for an intent a newer gesture replaced is ignored. TESTS: a hung imsg-read no longer holds up polling (mutation: restoring the blocking wait makes it fail), later polls start nothing while it runs, its result is picked up by the next poll, a failure that ends after the poll left is kept with its error, settleReadAction unit cases, grace parsing. bun test: 944 pass, 1 fail (audio-waveform, needs ffmpeg, fails on main too). CLAUDE.md invariant amended: detached from the poll, never from its acknowledgement. LR-T: blip, read-sync, collector, worker, hung-imsg-read LR-D: blip LR-K: issue-125-item-2, read-action-worker, settleReadAction LR-L: law-9, law-10 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BXN1v5rSKpVomPJvPhZCng
nixfred
added a commit
that referenced
this pull request
Nov 25, 2026
… or suspended worker, one writer per file) WHAT: Follow-up to #171 from a fresh-context review, before it goes back on main. - The finished action is settled at the TOP of collect(), and a "*" still running is no longer expanded. Reproduced: a mark-all slower than the 5 s grace was split into per-chat intents by the next poll, which then ran a --chat for a conversation --all had already read, bringing Messages forward on the Mac. - The marker records the worker's pid and /proc start time. A live worker is running however old the clock says it is; a dead one fails on the next poll instead of blocking every read action for 190 s (or longer after a clock set back). - One writer per file: the worker reports into read-action.json.<token>.done and never rewrites the marker, so an old worker cannot overwrite a newer one. - A result must match the attempt count as well as unread and seen. - state.json is saved BEFORE the marker is removed. - Pin/unpin/mute/unmute are refused at once while a worker runs, instead of waiting 60 s on the Mac's Messages lock and then failing. NOT CHANGED: an intent queued behind a slow action still starts on the next poll rather than the moment the action ends. Written down in CLAUDE.md. TESTS: bun test 951 pass, 1 skip, 1 fail (audio-waveform, no ffmpeg here). Each fix has a test that fails when the fix is removed (4 mutations). Not tried against a real gateway Mac. LR-T: blip, read-sync, collector, worker, review-findings LR-D: blip LR-K: read-action-worker, expandFailedMarkAll, pid-liveness, issue-125-item-2 LR-L: law-9, law-10 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BXN1v5rSKpVomPJvPhZCng
nixfred
added a commit
that referenced
this pull request
Nov 25, 2026
WHAT: Weekly contributor notes for the three changes landed today, with what was verified, and the open X-handle question for Nick (@k7cfo). LR-T: blip, weekly-notes, contributors LR-D: blip LR-K: w48, k7cfo, ianswope Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BXN1v5rSKpVomPJvPhZCng
Owner
Author
|
For the record, because this page says "merged" and for a day This was merged on 24 Nov at 17:06 UTC. At 20:54 UTC It is back on
Accepted and not changed: a read queued behind a slow one starts on the next poll. Generated by Claude Code |
nixfred
added a commit
that referenced
this pull request
Nov 25, 2026
WHAT: GitHub and the Forgejo backup are pushed by hand and compared. The forced push mirror between them was removed on 2026-11-25 after it erased the #171 merge. LR-T: blip, remotes, forgejo, mirror LR-D: blip LR-K: push-both LR-L: law-11 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BXN1v5rSKpVomPJvPhZCng
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #125 (item 2). Does not close it: that is the maintainer's call after review.
Problem
collect()calledrunReadAction(spawnSync, 180 s timeout) inline, atcollector.ts2809 and 2810 on main. One hungimsg-readheld the collector process for up to three minutes, and every poll, toast and refresh queued behind it in BarWidget.Change
startReadActionin a detachedcollector.ts --read-workerprocess, and the poll returns.read-action.jsonfirst, so only one action runs at a time. That also keeps Messages' process-global selection to one user.doneto that file. The collector stays the sole writer ofstate.json, and folds the result in (settleReadAction) on the poll that started the action or on a later one.BLIP_READ_GRACE_MS(default 5 s), so the common 1 to 3 s action still reports its outcome in the same poll, as before. A hung one now delays one poll by that much instead of three minutes.--allis still never repeated.CLAUDE.mdinvariant amended: "Never detach it" becomes "detached from the poll, never from its acknowledgement", with the reason.Tests
imsg-readno longer holds up polling. Mutation check: restoring the blocking wait makes it fail (the harness kills the run at 10 s).settleReadActionandparseReadAction, and for the grace parsing.bun test: 944 pass, 1 fail. The failure isaudio-waveform.test.ts, which needs ffmpeg and fails on main too (known exception). The existing 36 read-sync tests pass unchanged.Not done
runReadActionandimsg-readcall as before.Not merged, and not pushed to main.
🤖 Generated with Claude Code
https://claude.ai/code/session_01BXN1v5rSKpVomPJvPhZCng