fix(cat): break the bootstrap deadlock that would have kept @cat inert - #768
Merged
Conversation
Caught by checking production rather than by reading the code: the queue had deployed, and the Cat still had no account. Following that through, it never would have got one. The circularity: resolveMentions can only flag @cat when a Cat PROFILE exists, so with no account nothing is ever queued — and the worker called ensureCatAccount AFTER its empty-queue early return, so an empty queue established nothing. Nothing queued, so nothing was established, so nothing queued. A freshly deployed platform would sit there with @cat resolving to nobody, looking exactly like a working feature that nobody had used yet. The worker now establishes the account before it looks at the queue. One primary-key lookup per tick when it is a no-op, which is every tick after the first, and the every-minute timer therefore becomes what brings the Cat into existence. Second half of the same bug, in the timer: `Persistent=true` only replays a run MISSED while the machine was down. A timer enabled for the first time just waits for the next OnCalendar — for a daily timer, up to 24 hours. Production confirmed it: the unit was installed and enabled, LAST was "-", NEXT was 12 hours away. OnActiveSec=1min makes a freshly deployed Cat exist within the minute. Pinned by a test that asserts the ORDERING, not just the call, and proven by restoring the old arrangement — two tests go red. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Caught by checking production rather than reading the code: the queue had deployed, and the Cat still had no account. Following it through, it never would have got one.
The circularity
resolveMentionscan only flag@catwhen a Cat profile exists → with no account, nothing is ever queued. And the worker calledensureCatAccountafter its empty-queue early return → an empty queue established nothing.A freshly deployed platform would sit there with
@catresolving to nobody — looking exactly like a working feature nobody had used yet. Which is the worst kind of broken, because there's nothing to notice.The worker now establishes the account before it looks at the queue. One primary-key lookup per tick when it's a no-op — every tick after the first — and the every-minute timer becomes what brings the Cat into existence.
The second half, in the timer
Persistent=trueonly replays a run missed while the machine was down. A timer enabled for the first time simply waits for the nextOnCalendar— for a daily timer, up to 24 hours.Production confirmed exactly that:
Installed, enabled, never run, next run half a day away.
OnActiveSec=1minmakes a freshly deployed Cat exist within the minute.Pinned so it can't be tidied back
The test asserts the ordering, not just that the call happens:
Proven by restoring the old arrangement — two tests go red, including "establishes the account even when the queue is empty".
Verification
npm run verify— exit 0 (2364 tests)🤖 Generated with Claude Code